/* Feminine & Elegant Beauty App Design */
:root {
    --primary: #E6B4B4; /* Dusty Rose */
    --secondary: #D8C3A5; /* Light Beige */
    --accent: #C6A46F; /* Gold */
    --light: #FDF6F6; /* Very Light Pink */
    --dark: #5D5454; /* Dark Grey */
    --success: #A8D8B9; /* Soft Green */
    --danger: #E8A0A0; /* Soft Red */
    --spacing: 2rem;
    --border-radius: 16px;
    --shadow: 0 10px 35px rgba(93, 84, 84, 0.1);
    --transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

html {
    font-size: 90%;
}

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

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.7;
    min-height: 100vh;
    padding: var(--spacing);
}

.app-container {
    max-width: 1600px;
    margin: 0 auto;
}

/* Elegant Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    margin-bottom: 2rem; /* Reduced margin */
    padding: 0.5rem 0; /* Reduced padding */
    flex-wrap: wrap;
}

.header-top, .header-bottom {
    display: flex;
    align-items: center;
}

.header-top {
    justify-content: space-between;
    width: 100%;
}

.header-bottom {
    gap: 1rem;
}

.header-top {
    gap: 1rem;
}

.brand {
    order: 2;
}

.language-switcher {
    order: 1;
}

.header-top > .header-btn { /* Account button */
    order: 3;
}

.header-top, .header-bottom {
    flex-grow: 1;
    justify-content: flex-end;
}

.header-top {
    justify-content: space-between;
}

.brand {
    flex-grow: 1;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.brand a {
    display: inline-block;
    line-height: 0;
}

.header-bottom {
    justify-content: center;
    gap: 1rem;
}

.header-bottom {
    display: none;
}

@media (max-width: 768px) {
    .app-container {
        /* Fixed static padding to prevent movement */
        padding-left: 10px;
        padding-right: 10px;
    }
    .main-content {
        /* Optional: add padding to main-content if it is the direct card parent */
        padding-left: 0;
        padding-right: 0;
    }
    .card {
        /* Make sure cards take full width but don't overflow to the right */
        width: 100%;
        box-sizing: border-box;
        /* Optional: add a max-width and center if they appear too wide */
        /* max-width: 100%; */
        /* margin-left: auto; */
        /* margin-right: auto; */
    }
}

@media (min-width: 769px) {
    .app-container > header {
        flex-wrap: nowrap;
    }
    .app-container > header .header-top,
    .app-container > header .header-bottom {
        width: auto;
    }
    .app-container > header .header-bottom {
        display: flex;
    }
    .app-container > header .brand {
        flex-grow: 0;
        text-align: left;
        margin-right: auto;
        order: 1;
    }
    .app-container > header .language-switcher {
        order: 2;
    }
    .app-container > header .header-bottom {
        order: 3;
    }
    .app-container > header .header-top > .header-btn {
        order: 4;
    }
}


.header-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--dark);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--secondary);
    border-radius: 30px;
    transition: var(--transition);
}

.header-btn:hover, .header-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.header-btn i {
    font-size: 1.1rem;
}

.language-switcher {
    display: flex;
    gap: 0.5rem;
    border: 1px solid var(--secondary);
    border-radius: 30px;
    padding: 0.2rem;
}

.language-switcher a {
    padding: 0.3rem 0.6rem;
    color: var(--dark);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 30px;
    transition: var(--transition);
}

.language-switcher a.active {
    background: var(--primary);
    color: white;
}


/* Specialist Page Specific Styles */
.analysis-result {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
    padding: 1rem;
}

.analysis-image {
    width: 100%;
    max-height: 400px;
    flex-shrink: 0;
}

.analysis-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.analysis-text-content {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 0; /* Removed for scrollbar-gutter */
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--light);
}

.analysis-text-content h5 {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
}

.analysis-text-content p {
    white-space: pre-wrap;
    font-size: 0.95rem;
}

#analysis-text pre {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.analysis-text-content {
    max-width: 100%;
    word-wrap: break-word;
}

.analysis-section {
    margin-bottom: 1rem;
    background-color: #fdfcfa;
    border-radius: var(--border-radius);
    border: 1px solid #f0e9e9;
    overflow: hidden;
}

.analysis-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    cursor: pointer;
    background-color: #f9f6f4;
    transition: background-color 0.3s ease;
}

.analysis-section-header:hover {
    background-color: #f5f2f0;
}

.analysis-section-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
}

.collapsible-icon {
    font-size: 1.2rem;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.analysis-section-header.active .collapsible-icon {
    transform: rotate(45deg);
}

.analysis-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out, padding 0.5s ease;
    padding: 0 1.5rem;
}

.analysis-section-content.show {
    max-height: 1000px;
    padding: 1.5rem;
}

.analysis-section-content pre {
    display: none;
}

.analysis-section-content h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 1.5rem;
}

.analysis-section-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
}

.analysis-section-content p {
    margin-bottom: 0.8rem;
    line-height: 1.8;
    font-size: 0.95rem;
}

.analysis-section-content p strong {
    font-weight: 600;
    color: var(--primary);
}



.placeholder-text-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #8B8080;
    font-size: 1.2rem;
}

.history-item .history-img {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid #EAE2E2;
}

.no-history {
    padding: 2rem;
    text-align: center;
    color: #8B8080;
}

/* Main Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
        "upload"
        "style-color"
        "generation"
        "history";
    gap: 3rem; /* Increased gap */
    margin-bottom: 3rem;
}

@media (min-width: 1024px) {
    .main-content {
        grid-template-columns: 0.9fr 1.1fr;
        grid-template-areas:
            "upload style-color"
            "generation generation"
            "history history";
    }
}

.upload-panel {
    grid-area: upload;
}

.style-and-color-panel {
    grid-area: style-color;
}

.generation-panel {
    grid-area: generation;
}

.history-panel {
    grid-area: history;
    background: #FFFFFF;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Card Design */
.card {
    background: #FFFFFF;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem; /* Adjusted padding */
    transition: var(--transition);
    border: 1px solid transparent;
    height: 100%; /* Make cards in a row equal height */
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 45px rgba(93, 84, 84, 0.12);
    border-color: var(--primary);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    color: white;
    font-weight: 500;
    font-size: 1.2rem;
}

.logout-btn {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border: 1px solid white;
    border-radius: 20px;
    transition: var(--transition);
}

.logout-btn:hover {
    background: white;
    color: var(--primary);
}

/* Upload Area */
.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: center; /* Center content vertically */
    flex-grow: 1; /* Allow it to take available space */
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.upload-icon {
    font-size: 3.5rem;
    color: var(--accent);
    margin-bottom: 1rem;
}

#image-preview {
    width: 100%;
    aspect-ratio: 1 / 1.1;
    border: 2px dashed var(--secondary);
    border-radius: var(--border-radius);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    background-color: var(--light);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex; /* Use flexbox for centering */
    align-items: center;
    justify-content: center;
}

#image-preview:hover {
    border-color: var(--primary);
    transform: scale(1.02);
}

#image-preview.has-image .upload-placeholder {
    opacity: 0;
    pointer-events: none;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--dark);
    text-align: center;
    padding: 1rem; /* Added padding */
    transition: var(--transition);
}

.upload-placeholder .upload-icon {
    font-size: 3rem; /* Slightly smaller icon */
    margin-bottom: 0.8rem;
}

.upload-placeholder .placeholder-text {
    font-size: 1.2rem; /* Adjusted font size */
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.upload-placeholder .file-info {
    font-size: 0.9rem; /* Adjusted font size */
    color: #8B8080;
}

.upload-instructions {
    font-size: 0.9rem;
    color: #8B8080;
    margin-top: 0.5rem;
    max-width: 90%; /* Adjusted max-width */
}

/* Hairstyle Selection */
#category-filters, #color-category-filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.8rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.7rem 1.5rem;
    background: transparent;
    border: 1px solid var(--secondary);
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    color: var(--dark);
}

.filter-btn.active, .filter-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(230, 180, 180, 0.3);
}

#hairstyle-grid, #color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    overflow-y: auto;
    padding-right: 0; /* Removed for scrollbar-gutter */
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--light);
}

#hairstyle-grid::-webkit-scrollbar,
#color-grid::-webkit-scrollbar {
    width: 8px;
}

#hairstyle-grid::-webkit-scrollbar-track,
#color-grid::-webkit-scrollbar-track {
    background: var(--light);
    border-radius: 10px;
}

#hairstyle-grid::-webkit-scrollbar-thumb,
#color-grid::-webkit-scrollbar-thumb {
    background-color: var(--secondary);
    border-radius: 10px;
    border: 2px solid var(--light);
}

#hairstyle-grid::-webkit-scrollbar-thumb:hover,
#color-grid::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary);
}

.hairstyle-card, .color-card {
    border: 1px solid #EAE2E2;
    border-radius: var(--border-radius);
    padding: 0.8rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: white;
}

.hairstyle-card:hover, .color-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(93, 84, 84, 0.1);
    border-color: var(--accent);
}

.hairstyle-card.selected, .color-card.selected {
    border-color: var(--primary);
    background-color: var(--light);
    box-shadow: 0 8px 20px rgba(230, 180, 180, 0.2);
}

.hairstyle-card img, .color-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 0.8rem;
    transition: var(--transition);
}

.hairstyle-card:hover img, .color-card:hover img {
    transform: scale(1.05);
}

/* Panel Controls */
.panel-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.panel-title {
    margin-bottom: 1.5rem; 
    text-align: center; 
    font-weight: 600; 
    color: var(--dark);
}

#gender-filters {
    display: flex;
    gap: 0.5rem;
    background: var(--light);
    padding: 0.5rem;
    border-radius: 30px;
}

.gender-btn {
    padding: 0.5rem 1.2rem;
    background: transparent;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    color: var(--dark);
}

.gender-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 5px 10px rgba(230, 180, 180, 0.3);
}

/* Main Selection Tabs */
.main-selection-tabs {
    display: flex;
    gap: 0; /* Removed gap */
    margin-bottom: 2rem;
    border-bottom: 1px solid #EAE2E2; /* Thinner border */
    justify-content: center; /* Center the tabs */
}

.main-tab {
    flex: 1;
    padding: 0.8rem 1rem; /* Adjusted padding */
    font-size: 1rem; /* Adjusted font size */
    font-weight: 600;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--dark);
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    text-align: center; /* Center text */
    position: relative;
}

.main-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.panel-content {
    display: none;
}

.style-and-color-panel .card {
    display: flex;
    flex-direction: column;
}

.panel-content.active {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
    align-content: flex-start;
}

#hairstyle-grid, #color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    overflow-y: auto;
    padding-right: 0; /* Removed for scrollbar-gutter */
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--light);
    flex-grow: 1;
    align-content: flex-start;
}


/* Generate Button */
#generate-btn {
    padding: 0;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 1rem;
    width: 100%;
    box-shadow: 0 8px 25px rgba(230, 180, 180, 0.4);
    position: relative;
    overflow: hidden;
}

#generate-btn .btn-content {
    padding: 1.2rem 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    position: relative;
    z-index: 2;
}

#generate-btn .progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.2s ease-out;
    z-index: 1;
    opacity: 0.8;
}

#generate-btn:disabled {
    background: #D3CACA;
    cursor: not-allowed;
    opacity: 0.8;
    box-shadow: none;
}

#generate-btn:not(:disabled):hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(198, 164, 111, 0.4);
}

/* History Styles */
.history-list {
    flex: 1;
    overflow-y: auto;
    max-height: 70vh;
    padding: 1.5rem;
}

.history-item {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    border-bottom: var(--border-radius);
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    background: #FFFFFF;
    border-radius: var(--border-radius);
    margin-bottom: 1.2rem;
    box-shadow: 0 5px 15px rgba(93, 84, 84, 0.05);
}

.history-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(93, 84, 84, 0.08);
}

.history-thumbnail {
    width: 150px;
    height: 195px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid #EAE2E2;
}

.history-details {
    flex: 1;
}

.history-name {
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--dark);
}

.history-date {
    font-size: 0.9rem;
    color: #8B8080;
}

.history-actions {
    display: flex;
    gap: 1rem;
}

.action-btn {
    background: var(--light);
    border: 1px solid #EAE2E2;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 15px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dark);
}

.action-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
    border-color: var(--primary);
}

.delete-btn:hover {
    background: var(--danger);
}

.logout-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 0.8rem 1.8rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 50px;
    transition: var(--transition);
    background: #FFFFFF;
    color: var(--dark);
    border: 1px solid var(--secondary);
}

.logout-button:hover {
    background: var(--light);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(230, 180, 180, 0.2);
}


/* Modal Styles */
.history-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(40, 30, 30, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.modal-content {
    background: #FFFFFF;
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 1100px;
    width: 90%;
    max-height: 90vh;
    position: relative;
    box-shadow: 0 30px 60px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
}

.modal-body {
    display: flex;
    gap: 2.5rem;
    flex: 1;
    overflow: hidden;
}

.modal-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light);
    border-radius: var(--border-radius);
    padding: 1rem;
}

.modal-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--border-radius);
}

.modal-info-panel {
    flex-basis: 350px;
    display: flex;
    flex-direction: column;
}

.modal-info-panel h3 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.modal-details {
    margin: 0 0 2rem 0;
    padding: 1.5rem;
    background: var(--light);
    border-radius: var(--border-radius);
}

.modal-info-panel .download-full-btn {
    margin-top: auto;
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: #8B8080;
    transition: var(--transition);
    background: var(--light);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}



.download-full-btn {
    padding: 1rem 2rem;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: block;
    margin: 0 auto;
    box-shadow: 0 8px 25px rgba(230, 180, 180, 0.4);
}

.download-full-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(198, 164, 111, 0.4);
}

/* Elegant Modal Styles */
.elegant-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(93, 84, 84, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none !important;
    align-items: center;
    justify-content: center;
}

.elegant-modal.show {
    display: flex !important;
    animation: fadeIn 0.3s ease-out;
}

.elegant-modal-content {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 25px 50px rgba(93, 84, 84, 0.3);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
    border: 1px solid var(--secondary);
}

.elegant-modal-header {
    padding: 2rem 2rem 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(216, 195, 165, 0.3);
}

.modal-icon {
    font-size: 2.5rem;
    color: var(--danger);
    margin-bottom: 1rem;
    display: block;
}

.elegant-modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.elegant-modal-body {
    padding: 1.5rem 2rem 2rem;
}

.warning-box {
    background: linear-gradient(135deg, #fef2f2, #fdf2f2);
    border-left: 4px solid var(--danger);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.warning-title {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.warning-subtitle {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
}

.elegant-modal .form-group {
    margin-bottom: 1.5rem;
}

.elegant-modal .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
    font-size: 1rem;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--secondary);
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    color: var(--dark);
    transition: var(--transition);
    box-sizing: border-box;
}

.form-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(230, 180, 180, 0.1);
}

.elegant-modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border: 2px solid var(--secondary);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    background: white;
    color: var(--dark);
    text-decoration: none;
}

.btn-secondary:hover {
    background: var(--light);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    background: var(--danger);
    color: white;
    text-decoration: none;
}

.btn-danger:hover {
    background: #d87979;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(232, 160, 160, 0.4);
}

.error-message {
    color: var(--danger);
    margin-top: 1rem;
    display: none;
    padding: 0.8rem;
    background: #fef2f2;
    border-radius: 8px;
    font-weight: 500;
    border-left: 4px solid var(--danger);
}

.error-message.show {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* Insufficient Credit Modal */
.insufficient-credit-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(93, 84, 84, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none !important;
    align-items: center;
    justify-content: center;
}

.insufficient-credit-modal.show {
    display: flex !important;
    animation: fadeIn 0.3s ease-out;
}

.insufficient-credit-modal .elegant-modal-content {
    max-width: 450px;
}

.insufficient-credit-modal .modal-icon {
    color: var(--accent);
}

.credit-info {
    background: linear-gradient(135deg, #fefbf0, #fdf6f0);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.credit-info h4 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.credit-info p {
    color: #666;
    font-size: 0.95rem;
    margin: 0;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.8rem;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    background: linear-gradient(90deg, var(--primary), var(--accent));
    color: white;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(230, 180, 180, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(198, 164, 111, 0.4);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Account Page Styles */
.account-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: #FFFFFF;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
}
.account-container h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--dark);
}
.account-info p {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}
.account-info strong {
    color: var(--primary);
}
.referral-section {
    margin-top: 2rem;
    padding: 2rem;
    background: linear-gradient(45deg, var(--light), #fdf6f6);
    border-radius: 12px;
    border: 1px solid var(--secondary);
}
.referral-section h2 {
    font-size: 1.8rem;
    color: var(--dark);
    margin-bottom: 0.75rem;
}
.referral-section p {
    font-size: 1rem;
    color: #555;
    max-width: 600px;
    margin: 0 auto 1.5rem auto;
}
.referral-box {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}
.referral-box input {
    width: 100%;
    max-width: 400px;
    padding: 0.8rem 1rem;
    border: 1px solid var(--secondary);
    border-right: none;
    border-radius: 10px 0 0 10px;
    background-color: #fff;
    color: var(--dark);
    font-size: 1rem;
}
.referral-box button {
    padding: 0.8rem 1.5rem;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: white;
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}
.referral-box button:hover {
    background: var(--accent);
    border-color: var(--accent);
}
.referral-limit {
    font-size: 0.9rem;
    color: #777;
}
.credits-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #EAE2E2;
}
.credits-section h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}
.purchase-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}
.add-credits-form button {
    width: 100%;
    padding: 1.5rem 1rem;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 8px 25px rgba(230, 180, 180, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
}
.add-credits-form button:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(198, 164, 111, 0.4);
}
.add-credits-form button .fas {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}
.back-link {
    display: inline-block;
    margin-top: 2.5rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.back-link:hover {
    text-decoration: underline;
}

/* Login/Register Page Styles */
.login-container {
    max-width: 450px;
    width: 100%;
    padding: 3rem var(--spacing);
}
.form-card {
    background: #FFFFFF;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}
.form-title {
    text-align: center;
    font-weight: 600;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--dark);
}
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
}
.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--secondary);
    border-radius: 10px;
    transition: var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 180, 180, 0.3);
}
.submit-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(198, 164, 111, 0.3);
}
.switch-form {
    text-align: center;
    margin-top: 1.5rem;
}
.lang-selector {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}
.lang-selector a {
    margin: 0 10px;
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
}
.lang-selector a.active {
    color: var(--primary);
    font-weight: 700;
}


/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    header {
        flex-direction: column;
        gap: 0;
        padding: 0 1rem; /* Add horizontal padding directly to the header */
        margin-bottom: 1.5rem;
        background: var(--light);
        z-index: 100;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    }

    .header-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 0.5rem 0; /* Remove horizontal padding from children */
        gap: 1rem;
    }

    .header-top .language-switcher,
    .header-top > .header-btn {
        flex: 1;
    }

    .header-top .language-switcher {
        justify-content: flex-start;
    }
    
    .header-top > .header-btn {
        justify-content: flex-end;
    }

    .brand {
        flex: 2;
        text-align: center;
    }

    .brand img {
        height: 40px;
    }

    .header-btn-text {
        display: none;
    }

    .header-top > .header-btn {
        padding: 0.6rem 0.8rem;
    }

    .header-bottom {
        display: flex;
        width: 100%;
        gap: 0;
        border-top: 1px solid #eee;
        justify-content: center;
    }

    .header-bottom .header-btn {
        flex: 1;
        justify-content: center;
        border: none;
        border-radius: 0;
        padding: 0.8rem;
        border-bottom: 3px solid transparent;
        background: transparent;
        color: var(--dark);
        max-width: 200px; /* Max width for tabs */
    }
    .header-bottom .header-btn.active {
        border-bottom-color: var(--primary);
        background: var(--light);
        color: var(--primary);
    }
    .header-bottom .header-btn i {
        margin-right: 0.5rem;
    }
    .header-bottom .header-btn .header-btn-text {
        display: inline;
    }
    
    .main-content {
        padding: 1rem; /* Add padding to match header */
    }

    .card {
        padding: 1rem; /* Reduce padding on mobile */
    }

    .style-and-color-panel .card {
        height: auto; /* Let height be natural */
    }

    .panel-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    #gender-filters {
        justify-content: center;
    }

    #category-filters, #color-category-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 10px;
        justify-content: flex-start;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    #category-filters::-webkit-scrollbar, #color-category-filters::-webkit-scrollbar {
        display: none;
    }

    .history-item {
        flex-direction: column;
        text-align: center;
    }
    
    .history-actions {
        margin-top: 1rem;
        justify-content: center;
    }
    
    #hairstyle-grid, #color-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .hairstyle-card img, .color-card img {
        height: 120px;
    }

    .modal-body {
        flex-direction: column;
        overflow-y: auto;
    }

    .modal-info-panel {
        flex-basis: auto;
        margin-top: 1.5rem;
    }

    .modal-info-panel .download-full-btn {
        margin-top: 1.5rem;
    }

    .login-container {
        width: 100%;
        max-width: none;
        padding: 1.5rem 1rem;
    }

    .form-card {
        box-shadow: none;
        border-radius: 0;
    }

    .form-title {
        font-size: 1.8rem;
    }

    .account-container h1 {
        font-size: 2rem;
    }

    .account-container h2 {
        font-size: 1.5rem;
    }

    .account-info p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    #hairstyle-grid, #color-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    #category-filters, #color-category-filters {
        gap: 0.5rem;
        margin-bottom: 1.5rem;
    }
}


@media (max-width: 768px) {
    .app-container {
        padding-left: 10px;
        padding-right: 10px;
    }
    .main-content {
        /* Prevent double padding if main-content already has some */
        padding-left: 0;
        padding-right: 0;
    }
    .card {
        width: 100%;
        box-sizing: border-box;
        /* Remove any margin-left: 0 or margin-right: auto;
           that could create imbalance */
        margin-left: 0;
        margin-right: 0;
    }
}

/* Streaming Analysis Styles */
.typing-cursor {
    animation: typing-blink 1s infinite;
    color: var(--primary);
    font-weight: bold;
}

@keyframes typing-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.streaming-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--dark);
    opacity: 0.7;
    font-style: italic;
}

.streaming-indicator i {
    color: var(--primary);
}

/* Footer Styles */
.app-footer {
    position: relative;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    margin-top: 60px;
    padding: 40px 20px;
    border-top: 1px solid rgba(93, 84, 84, 0.1);
    background-color: var(--light);
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    text-align: center;
}

.app-footer .container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.app-footer .footer-content {
    text-align: center;
}

.app-footer .footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-bottom: 25px;
}

.app-footer .footer-links a {
    color: var(--dark);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    padding: 8px 16px;
    border-radius: var(--border-radius);
    position: relative;
}

.app-footer .footer-links a:hover {
    color: var(--primary);
    background-color: rgba(230, 180, 180, 0.1);
    transform: translateY(-2px);
}

.app-footer .footer-links a:before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
    transform: translateX(-50%);
}

.app-footer .footer-links a:hover:before {
    width: 100%;
}

.app-footer p {
    color: var(--dark);
    font-size: 0.85rem;
    margin: 0;
    opacity: 0.7;
    font-weight: 400;
}

@media (max-width: 768px) {
    .app-footer {
        padding: 30px 15px;
    }
    
    .app-footer .footer-links {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .app-footer .footer-links a {
        padding: 10px 20px;
        font-size: 1rem;
    }
}