/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    padding: 30px;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-logo {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: contain;
}

.header-text h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c2c2c;
    margin-bottom: 5px;
}

.header-text p {
    font-size: 1.1rem;
    color: #666;
    font-weight: 400;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* Form Section */
.form-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

.form-section h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.8rem;
    font-weight: 600;
    color: #2c2c2c;
    margin-bottom: 25px;
    border-bottom: 3px solid #FFCC00;
    padding-bottom: 10px;
}

.namecard-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: #2c2c2c;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
    background: #fafafa;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #FFCC00;
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.1);
}

.form-group input:required,
.form-group textarea:required {
    border-left: 4px solid #FFCC00;
}

/* Image Upload Area */
.image-upload-area {
    position: relative;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    background: #fafafa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.image-upload-area:hover {
    border-color: #FFCC00;
    background: rgba(255, 204, 0, 0.05);
}

.image-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-placeholder {
    padding: 40px 20px;
    text-align: center;
    color: #6c757d;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.upload-placeholder p {
    font-size: 1rem;
    margin-bottom: 5px;
}

.upload-placeholder small {
    font-size: 0.85rem;
    color: #999;
}

.image-preview {
    position: relative;
    padding: 20px;
}

.image-preview img {
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

.remove-image {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-image:hover {
    background: #c82333;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

/* Preview Section */
.preview-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

.preview-section h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.8rem;
    font-weight: 600;
    color: #2c2c2c;
    margin-bottom: 25px;
    border-bottom: 3px solid #4CAF50;
    padding-bottom: 10px;
}

.preview-container {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.namecard-preview {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#namecardCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: white;
}

.placeholder {
    text-align: center;
    color: #6c757d;
    padding: 40px 20px;
}

.placeholder p {
    font-size: 1.1rem;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #FFCC00 0%, #FFD54F 100%);
    color: #2c2c2c;
    box-shadow: 0 2px 4px rgba(255, 204, 0, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #FFB300 0%, #FFCC00 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 204, 0, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #388E3C 0%, #4CAF50 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
}

.btn-warning {
    background: #fd7e14;
    color: white;
}

.btn-warning:hover {
    background: #e8681a;
    transform: translateY(-2px);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

/* Status Messages */
.status-message {
    background: #d4edda;
    color: #155724;
    padding: 12px 20px;
    border-radius: 8px;
    margin-top: 15px;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.status-message.warning {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.status-message.clickable {
    cursor: pointer;
    transition: all 0.3s ease;
}

.status-message.clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: #2c2c2c;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: #f8f9fa;
    color: #2c2c2c;
}

.modal-body {
    padding: 30px;
}

.modal-body ol {
    padding-left: 20px;
}

.modal-body li {
    margin-bottom: 12px;
    line-height: 1.6;
}

.tip-box {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    color: #856404;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    border-top: 1px solid #e9ecef;
    margin-top: 30px;
}

/* Loading Animation */
.loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #FFCC00;
    border-top: 4px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .header-text h1 {
        font-size: 2rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .container {
        padding: 15px;
    }
    
    .header, .form-section, .preview-section {
        padding: 20px;
    }
    
    #namecardCanvas {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .header-text h1 {
        font-size: 1.6rem;
    }
    
    .form-section h2, .preview-section h2 {
        font-size: 1.4rem;
    }
    
    .modal-content {
        margin: 10px;
    }
    
    .modal-header, .modal-body {
        padding: 20px;
    }

    #namecardCanvas {
        max-width: 100%;
    }
}

/* Disabled button styles */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    position: relative;
}

.btn:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Tooltip on hover for disabled buttons */
.btn:disabled:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 8px;
    pointer-events: none;
    opacity: 0;
    animation: tooltipFadeIn 0.3s ease forwards;
}

.btn:disabled:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #333;
    margin-bottom: 2px;
    opacity: 0;
    animation: tooltipFadeIn 0.3s ease forwards;
}

@keyframes tooltipFadeIn {
    to { opacity: 1; }
}

/* Focus indicators for accessibility */
.btn:focus,
input:focus,
textarea:focus {
    outline: 2px solid #FFCC00;
    outline-offset: 2px;
}

/* Animation for smooth transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.namecard-preview {
    animation: fadeIn 0.3s ease;
}

/* Image Manipulation Controls */
.image-controls {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.image-controls h3 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: #2c2c2c;
    margin: 0 0 15px 0;
    font-size: 1.1rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.zoom-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.zoom-control label {
    font-weight: 600;
    min-width: 50px;
}

.zoom-control input[type="range"] {
    flex: 1;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.zoom-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: #FFCC00;
    border-radius: 50%;
    cursor: pointer;
}

.zoom-control input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #FFCC00;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#zoomValue {
    font-weight: 600;
    min-width: 50px;
    text-align: center;
    color: #2c2c2c;
}

.position-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.position-controls label {
    font-weight: 600;
}

.position-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.horizontal-controls {
    display: flex;
    gap: 5px;
}

.position-btn {
    width: 35px;
    height: 35px;
    border: 1px solid #ccc;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.position-btn:hover {
    background: #FFCC00;
    border-color: #FFCC00;
    color: #2c2c2c;
}

.position-btn:active {
    transform: scale(0.95);
}

#resetPosition {
    background: #f8f9fa;
    font-size: 12px;
}

#resetPosition:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

@media (max-width: 768px) {
    .control-group {
        gap: 12px;
    }
    
    .zoom-control {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .zoom-control label {
        min-width: auto;
    }
    
    .position-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
}