* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Lato', sans-serif;
    background: linear-gradient(135deg, #2E2947 0%, #3d3660 100%);
    min-height: 100vh;
    color: #f5f5f5;
}

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

header {
    text-align: center;
    margin-bottom: 60px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    font-weight: 900;
    background: linear-gradient(135deg, #F5D168 0%, #F0A356 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#credits {
    font-weight: 900;
    background: linear-gradient(135deg, #F5D168 0%, #F0A356 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 1.1rem;
    color: #d0d0d0;
    font-weight: 300;
}

main {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 50px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    border: 1px solid rgba(245, 209, 104, 0.1);
}

/* Carousel */
.carousel-container {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 40px;
    background: rgba(0, 0, 0, 0.2);
}

.carousel-track {
    display: flex;
    height: 100%;
    gap: 15px;
    will-change: transform;
}

.carousel-track img {
    width: 300px;
    height: 100%;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: 6px;
}

.upload-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.upload-card {
    position: relative;
}

.upload-box {
    border: 2px dashed rgba(245, 209, 104, 0.3);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.03);
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.upload-box:hover {
    border-color: #F5D168;
    background: rgba(245, 209, 104, 0.08);
}

.upload-box.drag-over {
    border-color: #F0A356;
    background: rgba(240, 163, 86, 0.15);
    border-style: solid;
}

.upload-content {
    width: 100%;
}

.upload-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    color: #F5D168;
}

.upload-box h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: #F5D168;
    font-weight: 700;
}

.upload-box p {
    color: #c0c0c0;
    font-size: 0.9rem;
    font-weight: 300;
}

.preview {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}

.preview.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.preview .remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.preview .remove-btn:hover {
    background: #c0392b;
}

.generate-btn {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #2E2947;
    background: linear-gradient(135deg, #F5D168 0%, #F0A356 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Lato', sans-serif;
    box-shadow: 0 4px 15px rgba(245, 209, 104, 0.3);
}

.generate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #F0A356 0%, #e89345 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 209, 104, 0.4);
}

.generate-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.result-section {
    margin-top: 50px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #F5D168 0%, #F0A356 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
}

.result-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.result-image-container {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(245, 209, 104, 0.2);
}

.result-image-container img {
    width: 100%;
    height: auto;
    display: block;
}

.result-description {
    background: rgba(255, 255, 255, 0.05);
    padding: 30px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(245, 209, 104, 0.1);
}

.result-description h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #F5D168;
    font-weight: 700;
}

.result-description p {
    font-size: 1rem;
    line-height: 1.7;
    color: #d0d0d0;
    flex-grow: 1;
    font-weight: 300;
}

.secondary-btn {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    font-weight: 700;
    color: #F5D168;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid #F5D168;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Lato', sans-serif;
}

.secondary-btn:hover {
    background: linear-gradient(135deg, #F5D168 0%, #F0A356 100%);
    color: #2E2947;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(245, 209, 104, 0.3);
}

footer {
    text-align: center;
    color: #b0b0b0;
    margin-top: 60px;
    font-weight: 300;
}

/* Mobile Menu */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: rgba(46, 41, 71, 0.98);
        backdrop-filter: blur(10px);
        flex-direction: column;
        padding: 20px;
        gap: 20px;
        border-bottom: 1px solid rgba(245, 209, 104, 0.2);
        box-shadow: 0 4px 6px rgba(0,0,0,0.3);
        display: none;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu li {
        width: 100%;
        text-align: center;
    }

    .nav-btn {
        display: block;
        width: 100%;
    }

    header h1 {
        font-size: 2rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    main {
        padding: 30px 20px;
    }
    
    .upload-section {
        grid-template-columns: 1fr;
    }

    .upload-box {
        min-height: 250px;
    }
    
    .upload-options {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .upload-options label {
        justify-content: center;
        padding: 10px 16px;
    }
    
    .result-content {
        grid-template-columns: 1fr;
    }

    .result-description {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px 15px;
    }

    header h1 {
        font-size: 1.75rem;
    }

    main {
        padding: 25px 15px;
    }

    .upload-box {
        padding: 30px 15px;
        min-height: 220px;
    }

    .upload-icon {
        width: 40px;
        height: 40px;
    }

    .upload-box h3 {
        font-size: 1.1rem;
    }
}

/* Hairstyle sample chooser */
.upload-options {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.upload-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(245, 209, 104, 0.2);
    white-space: nowrap;
}

.upload-options label:hover {
    background: rgba(245, 209, 104, 0.1);
    border-color: rgba(245, 209, 104, 0.4);
}

.upload-options input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(245, 209, 104, 0.5);
    border-radius: 50%;
    outline: none;
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
    margin: 0;
}

.upload-options input[type="radio"]:checked {
    border-color: #F0A356;
    background: rgba(240, 163, 86, 0.2);
}

.upload-options input[type="radio"]:checked::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F5D168 0%, #F0A356 100%);
}

.upload-options input[type="radio"]:hover {
    border-color: #F5D168;
}

.upload-samples {
    max-height: none;
}

.sample-categories {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(245, 209, 104, 0.2);
}

.category-group {
    margin-bottom: 15px;
}

.category-group:last-child {
    margin-bottom: 0;
}

.category-label {
    display: block;
    font-size: 0.85rem;
    color: #F5D168;
    margin-bottom: 8px;
    font-weight: 600;
}

.category-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.category-btn {
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #c0c0c0;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(245, 209, 104, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Lato', sans-serif;
}

.category-btn:hover {
    background: rgba(245, 209, 104, 0.1);
    border-color: rgba(245, 209, 104, 0.4);
    color: #F5D168;
}

.category-btn.active {
    background: linear-gradient(135deg, #F5D168 0%, #F0A356 100%);
    color: #2E2947;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(245, 209, 104, 0.3);
}

.sample-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 10px;
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
}

.sample-grid::-webkit-scrollbar {
    width: 6px;
}

.sample-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.sample-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #F5D168 0%, #F0A356 100%);
    border-radius: 3px;
}

.sample-grid::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #F0A356 0%, #e89345 100%);
}

.sample-grid img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border 0.2s, transform 0.2s;
}

.sample-grid img:hover {
    border-color: #F5D168;
    transform: scale(1.05);
}

.sample-grid img.selected {
    border-color: #F0A356;
    box-shadow: 0 0 15px rgba(245, 209, 104, 0.5);
}

/* Crop Modal */
.crop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.crop-modal-content {
    background: rgba(46, 41, 71, 0.98);
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(245, 209, 104, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.crop-modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid rgba(245, 209, 104, 0.2);
}

.crop-modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #F5D168 0%, #F0A356 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.crop-modal-body {
    padding: 30px;
    flex: 1;
    overflow: auto;
}

.crop-container {
    max-width: 100%;
    max-height: 500px;
    margin: 0 auto;
}

.crop-container img {
    max-width: 100%;
    display: block;
}

.crop-modal-footer {
    padding: 20px 30px;
    border-top: 1px solid rgba(245, 209, 104, 0.2);
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.crop-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Lato', sans-serif;
}

.crop-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #F5D168;
    border: 2px solid rgba(245, 209, 104, 0.3);
}

.crop-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(245, 209, 104, 0.5);
}

.crop-btn-primary {
    background: linear-gradient(135deg, #F5D168 0%, #F0A356 100%);
    color: #2E2947;
    box-shadow: 0 4px 15px rgba(245, 209, 104, 0.3);
}

.crop-btn-primary:hover {
    background: linear-gradient(135deg, #F0A356 0%, #e89345 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 209, 104, 0.4);
}

@media (max-width: 768px) {
    .crop-modal-content {
        max-width: 95%;
    }
    
    .crop-modal-header,
    .crop-modal-body,
    .crop-modal-footer {
        padding: 20px;
    }
    
    .crop-container {
        max-height: 400px;
    }
    
    .crop-modal-footer {
        flex-direction: column;
    }
    
    .crop-btn {
        width: 100%;
    }
}

/* Error Modal */
.error-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.error-modal-content {
    background: rgba(46, 41, 71, 0.98);
    border-radius: 12px;
    max-width: 450px;
    width: 100%;
    border: 1px solid rgba(231, 76, 60, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.error-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(231, 76, 60, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.error-modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: #e74c3c;
}

.error-modal-close {
    background: none;
    border: none;
    color: #c0c0c0;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.error-modal-close:hover {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.error-modal-body {
    padding: 30px 25px;
    text-align: center;
}

.error-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-icon svg {
    width: 30px;
    height: 30px;
}

.error-modal-body p {
    color: #e0e0e0;
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
    font-weight: 400;
}

.error-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid rgba(231, 76, 60, 0.2);
    display: flex;
    justify-content: flex-end;
}

.error-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Lato', sans-serif;
    min-width: 80px;
}

.error-btn-primary {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.error-btn-primary:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.error-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid rgba(231, 76, 60, 0.2);
    display: flex;
    justify-content: flex-end;
    gap: 15px; /* adds space between buttons */
}

.error-btn-golden {
    background: linear-gradient(135deg, #F5D168 0%, #F0A356 100%);
    color: #2E2947;
    box-shadow: 0 4px 15px rgba(245, 209, 104, 0.3);
}

.error-btn-golden:hover {
    background: linear-gradient(135deg, #F0A356 0%, #e89345 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 209, 104, 0.4);
}

@media (max-width: 480px) {
    .error-modal-content {
        max-width: 90%;
    }
    
    .error-modal-header,
    .error-modal-body,
    .error-modal-footer {
        padding: 15px 20px;
    }
    
    .error-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 15px;
    }
    
    .error-icon svg {
        width: 25px;
        height: 25px;
    }
}