/* --- FONT & VARIABLE DEFINITIONS --- */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;600&family=Lato:wght@300;400&display=swap');
:root {
    --bg-color: #FDFBF8;
    --text-color: #333333;
    --text-light: #888888;
    --accent-color: #B99A6B;
    --border-color: #EAEAEA;
    --error-color: #D9534F;
    --success-color: #5CB85C;
    --font-serif: 'Cormorant Garamond', serif;
    --font-sans: 'Lato', sans-serif;
}

#app-loader {
    z-index: 999;
    background-color: var(--bg-color);
}

/* --- GENERAL & RESET STYLES --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    overflow: auto;
    touch-action: manipulation;
}

/* --- HEADER & LAYOUT --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 3rem;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 100;
}
.logo {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 2rem;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.main-container, .management-view {
    display: grid;
    grid-template-columns: 400px 1fr;
    height: calc(100vh - 105px); /* Adjust based on header height */
}
.fitting-room-panel, .collections-panel {
    border-right: 1px solid var(--border-color);
    padding: 2rem;
    display: flex;
    flex-direction: column;
}
.panel-content-scrollable {
    flex-grow: 1;
    overflow-y: auto;
}
.lookbook-panel, .collection-items-panel {
    padding: 2rem;
    overflow-y: auto;
}
.fitting-room-panel .panel-content-scrollable {
    margin-bottom: 1.5rem;
}
/* --- UI COMPONENTS --- */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.panel-title {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    font-weight: 600;
}
.action-btn {
    font-family: var(--font-sans);
    font-size: .9rem;
    font-weight: 400;
    background: none;
    border: 1px solid var(--border-color);
    padding: .5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all .2s ease;
    text-decoration: none;
    color: var(--text-color); 
}
.action-btn:hover {
    background-color: var(--border-color);
    color: var(--text-color);
}
.item-grid, .lookbook-grid {
    display: grid;
    gap: 1rem;
}
.item-grid { grid-template-columns: repeat(3, 1fr); }
.lookbook-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

.thumbnail-container {
    position: relative;
}
.item-thumbnail, .look-thumbnail {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border .2s ease;
    background-color: #f0f0f0;
}

.item-thumbnail img, .look-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    -webkit-touch-callout: none;
    user-select: none; 
}

.item-thumbnail.selected {
    border: 2px solid var(--accent-color);
}
.delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    opacity: 0;
    transition: opacity .2s ease;
    font-weight: bold;
    z-index: 5;
}
.thumbnail-container:hover .delete-btn {
    opacity: 1;
}
.create-look-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 1rem;
    margin-top: auto; /* Pushes button to the bottom */
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 400;
    color: white;
    background-color: var(--text-color);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color .2s ease;
}
.create-look-btn:hover:not(:disabled) {
    background-color: var(--accent-color);
}
.create-look-btn:disabled {
    background-color: var(--text-light);
    cursor: not-allowed;
}
.hidden { display: none !important; }

/* --- COLLECTIONS --- */
.collections-list { list-style: none; margin-bottom: 2rem; }
.collections-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .75rem;
    cursor: pointer;
    border-radius: 4px;
}
.collections-list li:hover { background-color: #f9f9f9; }
.collections-list li.active { background-color: var(--border-color); font-weight: bold; }
.collection-delete-btn {
    font-size: 1.2rem;
    color: #aaa;
    cursor: pointer;
    padding: 0 .5rem;
    border: none;
    background: none;
}
.collection-delete-btn:hover { color: #333; }
#new-collection-form { display: flex; gap: .5rem; }
#new-collection-input {
    flex-grow: 1;
    border: 1px solid var(--border-color);
    padding: .5rem;
    border-radius: 4px;
}

/* --- STATES (EMPTY, LOADING) --- */
.empty-state {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--text-light);
    margin-top: 2rem;
    margin-bottom: 2rem;
    width: 100%;
}
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 4rem auto;
}
/* Spinner for individual thumbnails */
.thumbnail-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin-top: -15px;
    margin-left: -15px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- ONBOARDING & MODALS --- */
.onboarding-overlay, .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.onboarding-overlay { background-color: var(--bg-color); z-index: 300; }
.modal-content {
    background-color: var(--bg-color);
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    max-width: 90vw;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
#model-modal-content img {
    max-width: 300px;
    max-height: 50vh;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}
.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}
#confirmation-modal-message {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    max-width: 350px;
}
#confirm-action-btn {
    background-color: var(--error-color);
    color: white;
    border-color: var(--error-color);
}
#confirm-action-btn:hover {
    background-color: #c9302c;
    border-color: #c12e2a;
}

/* --- NOTIFICATION BANNER --- */
.notification {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 2rem;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: top 0.4s ease-in-out;
}
.notification.show {
    top: 20px;
}
.notification.error {
    background-color: var(--error-color);
}
.notification.success {
    background-color: var(--success-color);
}

@media (max-width: 900px) {
    .app-header { 
    padding: 1.5rem 1rem; 
    gap: 1rem;
    }

    html {
        font-size: 15px; 
    }

    .main-container, .management-view {
        grid-template-columns: 1fr;
        height: auto;
    }
    .fitting-room-panel, .collections-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    #new-collection-input {
        font-size: 16px;
    }

    .action-btn {
        padding: .5rem .9rem; 
        font-size: 0.9rem;   
    }
    
    .logo {
        font-size: 1.6rem;
    }

    .header-actions {
        gap: 0.5rem; 
    }
}

/* --- IMAGE PREVIEW MODAL --- */
#image-preview-modal .modal-content {
    padding: 1rem;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
#preview-image {
    object-fit: contain;
    margin-bottom: 1rem;
}

button:focus, button:active, .action-btn:focus, .action-btn:active, .create-look-btn:focus, .create-look-btn:active, .delete-btn:focus, .delete-btn:active {
    outline: none;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent; 
}

button:focus-visible, .action-btn:focus-visible, .create-look-btn:focus-visible, .delete-btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* ADD THIS TO THE BOTTOM of style.css */

/* --- VIEW TABS --- */
.view-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}
.tab-btn {
    flex-grow: 1;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all .2s ease;
    margin-bottom: -1px;
}
.tab-btn:hover {
    color: var(--text-color);
}
.tab-btn.active {
    color: var(--text-color);
    border-bottom: 2px solid var(--accent-color);
}

.thumbnail-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    background-color: #f0f0f0;
}
.thumbnail-error {
    flex-direction: column;
    text-align: center;
    font-size: 0.8rem;
    color: var(--error-color);
    padding: 0.5rem;
}
.thumbnail-error-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

html, body {
    height: 100%;
}
.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
main#main-app, div#management-view {
    flex-grow: 1;
}

/* --- FOOTER STYLES --- */
.app-footer {
    text-align: center;
    padding: 2.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: auto;
}

.footer-links {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--text-light);
    text-decoration: none;
    margin: 0 0.5rem;
}

.footer-links a:hover {
    color: var(--text-color);
    text-decoration: underline;
}

/* --- LEGAL PAGE STYLES --- */
.legal-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    line-height: 1.6;
    flex-grow: 1;
}

.legal-container h1 {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.legal-container h2 {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}

.legal-container p {
    margin-bottom: 1rem;
}

.legal-container a[href^="mailto:"] {
    color: var(--accent-color);
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s ease;
}

.legal-container a[href^="mailto:"]:hover {
    color: var(--text-color);
    text-decoration: none;
}

.legal-container ul {
    margin-left: 2rem;
}

/* --- LANDING PAGE STYLES --- */
.landing-page-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 3rem 2rem;
    background-color: var(--bg-color);
}

.landing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 900px;
    gap: 1.5rem; /* Defines space between direct children */
}

.landing-content .tagline {
    font-family: var(--font-serif);
    font-size: 2.8rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0rem;
}

.landing-content .description {
    max-width: 650px;
    font-size: 1.1rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* The 3-column feature section */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    width: 100%;
    margin: 1.5rem 0;
}

.feature-card {
    text-align: left;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.feature-card h3 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.feature-card p {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* Styling the main Sign-In button */
.signin-btn-large {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1rem 3rem;
    border-radius: 30px;
    background-color: var(--text-color);
    color: white;
    border-color: var(--text-color);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.signin-btn-large:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.landing-content .legal-text {
    font-size: 0.85rem;
    color: var(--text-light);
    max-width: 400px;
}

.legal-text a {
    color: var(--text-color);
    text-decoration: underline;
}


@media (max-width: 900px) {
    .landing-content .tagline {
        font-size: 2.2rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr; 
        gap: 1rem;
    }

    .feature-card {
        text-align: center;
    }
}
/* --- ELEGANT SIDE-BY-SIDE COMPARISON STYLES --- */
#comparison-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    width: 100%;
    max-width: 300px; 
    margin: 2rem auto;
}

.comparison-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.comparison-item img {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid var(--border-color); 
    border-radius: 8px;
}

.comparison-label {
    position: absolute;
    bottom: 8px;
    right: 8px;
    margin: 0;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 400;
    font-family: var(--font-sans);
    color: var(--text-color);
    background-color: rgba(253, 251, 248, 0.85); 
    backdrop-filter: blur(2px); 
    border-radius: 4px;
}

@media (max-width: 500px) {
    #comparison-container {
        max-width: 300px;
        gap: 1.5rem;
    }
    
}