﻿:root {
    /* EASM Brand Identity (Dark Mode) */
    --primary-color: #784BF0;
    --background-color: #030406;
    --panel-color: #101114;
    --panel-color-2: #0A0A0C; 
    --border-color: #2C2D31;
    --heading-color: #F0F0F0;
    --body-text-color: #B6B6B6;
    --text-secondary: #8A8B8E;
    --hover-bg-color: #1A1A1D;
    --accent-glow: rgba(120, 75, 240, 0.4);
    --overlay-bg: rgba(3, 4, 6, 0.5);
    --backdrop-blur-amount: 4px;

    /* Typography */
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Manrope', sans-serif;

    /* Sizing & Radius */
    --border-radius-lg: 0.75rem; /* 12px */
    --border-radius-xl: 1rem;    /* 16px */
    
    /* Consistent Spacing System */
    --space-1: 0.25rem; /* 4px */
    --space-2: 0.5rem;  /* 8px */
    --space-3: 0.75rem; /* 12px */
    --space-4: 1rem;    /* 16px */
    --space-5: 1.25rem; /* 20px */
    --space-6: 1.5rem;  /* 24px */
    --space-8: 2rem;    /* 32px */
    --space-10: 2.5rem; /* 40px */
    --space-12: 3rem;   /* 48px */
}

html.light {
    /* Light Mode Palette */
    --primary-color: #784BF0;
    --background-color: #F4F5F7;
    --panel-color: #FFFFFF;
    --panel-color-2: #F9FAFB;
    --border-color: #EAEBEF;
    --heading-color: #1A1C20;
    --body-text-color: #555860;
    --text-secondary: #8A8C93;
    --hover-bg-color: #F0F0F0;
    --accent-glow: rgba(120, 75, 240, 0.2);
    --overlay-bg: rgba(255, 255, 255, 0.7);
    --backdrop-blur-amount: 2px;
}

/* Base & Layout */
*, *::before, *::after { box-sizing: border-box; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

body {
    height: 100vh;
    overflow: hidden;
    background-color: var(--background-color);
    font-family: var(--font-body);
    color: var(--body-text-color);
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container { display: flex; height: 100%; }

/* Auth Layout */
#login-screen {
    display: none;
    min-height: 100vh;
    padding: var(--space-8);
    align-items: center;
    justify-content: center;
    background: var(--background-color);
}
body:not(.session-active) #login-screen { display: flex; }
body.session-active #login-screen { display: none; }
.login-card {
    width: min(440px, 100%);
    background: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    padding: clamp(var(--space-6), 4vw, var(--space-8));
    box-shadow: 0 32px 60px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}
.login-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-4);
}
.login-brand img { height: 48px; width: auto; }
.login-title {
    font-family: var(--font-heading);
    color: var(--heading-color);
    font-size: clamp(1.75rem, 3vw, 2.4rem);
    text-align: center;
    margin: 0;
}
.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin: 0;
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.login-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    color: var(--text-secondary);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.login-field span { font-weight: 600; }
.login-field input {
    background: var(--panel-color-2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-3) var(--space-4);
    color: var(--heading-color);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.login-field input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(120, 75, 240, 0.35);
}
html.light .login-field input { background: var(--panel-color); }
html.light .login-field input:focus { box-shadow: 0 0 0 3px rgba(120, 75, 240, 0.45); }
.login-error {
    margin: 0;
    font-size: 0.85rem;
    color: #ff6b6b;
    text-align: center;
    min-height: 1.2rem;
}
.login-hint {
    margin: 0;
    font-size: 0.8rem;
    text-align: center;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    #login-screen { padding: var(--space-6); }
    .login-card { padding: var(--space-6); box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4); }
}
@media (max-width: 480px) {
    .login-card { padding: var(--space-5); border-radius: var(--border-radius-lg); }
}

/* Sidebar Layout */
.sidebar {
    width: 360px;
    min-width: 360px;
    background-color: var(--panel-color);
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    transition: transform 0.3s ease-in-out;
    border-right: 1px solid var(--border-color);
}

.sidebar-logo-container {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-color);
}
.sidebar-logo-container img { width: 110px; height: auto; }
.logo-light { display: none; }
html.light .logo-dark { display: none; }
html.light .logo-light { display: block; }

.sidebar-scroll-area {
    flex-grow: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    padding-bottom: var(--space-2);
}
.sidebar-sticky-bottom { flex-shrink: 0; }
#right-sidebar { border-right: none; border-left: 1px solid var(--border-color); }
.sidebar-bottom-gradient {
    background-image: radial-gradient(ellipse at bottom right, rgba(120, 75, 240, 0.25), transparent 70%);
    background-repeat: no-repeat;
    background-position: bottom right;
}
html.light .sidebar-bottom-gradient { background-image: none; }

/* Chat Section Styling */
.chat-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }

/* Main Content Area */
.main-content-wrapper { flex-grow: 1; display: flex; flex-direction: column; overflow: hidden; }
.main-header {
    display: none; align-items: center; justify-content: space-between;
    padding: 0 var(--space-4); height: 73px;
    border-bottom: 1px solid var(--border-color); background-color: var(--panel-color);
    flex-shrink: 0;
}
#main-canvas {
    flex-grow: 1; padding: var(--space-8) var(--space-12);
    overflow-y: auto; position: relative;
}

.main-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}
.main-top-bar .section-title { margin: 0; }
.wallet-display {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    color: var(--heading-color);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}
.wallet-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}
.wallet-amount {
    font-size: 1.1rem;
    font-weight: 600;
}
.wallet-display--sidebar {
    width: 100%;
    justify-content: space-between;
    margin-top: var(--space-4);
}
.wallet-display--mobile{
    display: none;
}

.right-icons{
    display: flex;
    gap: 10px;
}

.logout{
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-lg);
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-align: center;
    place-content: center;
    cursor: pointer;
}

html.light .wallet-display { background: rgba(0, 0, 0, 0.05); }

@media (max-width: 768px) {
    .main-top-bar {
        flex-direction: row;
        align-items: flex-start;
        gap: var(--space-3);
    }
    .wallet-display {
        justify-content: space-between;
    }
    .wallet-display--sidebar{
        display: none;
    }
    .wallet-display--mobile{
        display: block;
    }
}

.main-content-gradient { background-image: radial-gradient(circle at 100% 100%, rgba(120, 75, 240, 0.1), transparent 40%); }
html.light .main-content-gradient { background-image: none; }

/* Typography & Section Headers */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: 600; color: var(--heading-color); line-height: 1.3; margin: 0; }
h1 { font-size: 2.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }
.section-header { display: flex; align-items: center; gap: var(--space-2); }
.sidebar-main-header { display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
       
/* Panel (Card) */
.panel {
    background-color: var(--panel-color-2); border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl); margin-top: var(--space-8);
    overflow: hidden;
    animation: panel-enter 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    opacity: 0; transform: translateY(15px);
}
@keyframes panel-enter { to { opacity: 1; transform: translateY(0); } }
.panel-header {
    padding: var(--space-5) var(--space-6); font-size: 1.1rem;
    font-weight: 600; font-family: var(--font-heading); color: var(--heading-color);
    border-bottom: 1px solid var(--border-color);
}
.panel-body { padding: var(--space-6); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); font-family: var(--font-heading); font-weight: 600; font-size: 0.9rem; padding: var(--space-3) var(--space-6); height: 44px; border-radius: var(--border-radius-lg); border: 1px solid transparent; cursor: pointer; transition: all 0.2s ease-in-out; text-decoration: none; }
.btn-primary {color: #000; position: relative; overflow: hidden; }
html.light .btn-primary { background-color: #000; color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 25px rgba(255, 255, 255, 0.3); }
html.light .btn-primary:hover { box-shadow: 0 4px 25px rgba(0, 0, 0, 0.15); }
.btn-primary::after { content: ''; position: absolute; top: 0; left: -150%; width: 70%; height: 100%; background: linear-gradient(120deg, rgba(255,255,255,0) 20%, rgba(255,255,255,0.25) 50%, rgba(255,255,255,0) 80%); transition: left 0.6s ease-in-out; }
.btn-primary:hover::after { left: 150%; }
.btn-secondary { background-color: var(--panel-color); border-color: var(--border-color); color: var(--body-text-color); }
.btn-secondary:hover { background-color: var(--hover-bg-color); color: var(--heading-color); border-color: var(--text-secondary); transform: translateY(-2px); }
.icon-btn { width: 40px; height: 40px; padding: 0; border-radius: var(--border-radius-lg); background-color: var(--panel-color); border: 1px solid var(--border-color); color: var(--text-secondary); }
.icon-btn:hover { color: var(--heading-color); border-color: var(--text-secondary); background-color: var(--hover-bg-color); }

/* Forms & Inputs */
.form-grid { display: grid; gap: var(--space-6); }
.input-box-wrapper { background-color: var(--panel-color); border: 1px solid var(--border-color); border-radius: var(--border-radius-lg); padding: var(--space-2) var(--space-4); display: flex; flex-direction: column; transition: border-color 0.2s ease, box-shadow 0.2s ease; position: relative; }
.input-box-wrapper:focus-within { border-color: var(--primary-color) !important; }
html:not(.light) .input-box-wrapper:focus-within { box-shadow: 0 0 15px 2px var(--accent-glow); }
.input-box-wrapper label { font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); margin-bottom: var(--space-1); }
.input-box-wrapper input, .input-box-wrapper textarea { width: 100%; background: transparent; border: none; outline: none; color: var(--heading-color); font-size: 0.95rem; font-family: var(--font-body); padding: var(--space-1) 0; }
.input-box-wrapper textarea { resize: vertical; }

/* Custom Select Styling */
select {
    appearance: none;
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    color: var(--heading-color);
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: var(--space-3) var(--space-4);
    width: 100%;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px 2px var(--accent-glow);
}

/* Style for select options */
select option {
    background-color: var(--panel-color);
    color: var(--heading-color);
    padding: var(--space-3) var(--space-4);
}

html.light select option {
    background-color: var(--panel-color);
    color: var(--heading-color);
}

/* Custom select arrow */
.select-wrapper::after {
    content: 'expand_more';
    font-family: 'Material Symbols Rounded';
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    transition: color 0.2s ease;
}

.select-wrapper:focus-within::after {
    color: var(--primary-color);
}

/* Select wrapper hover state */
.select-wrapper:hover select {
    border-color: var(--text-secondary);
}

/* Brand Details Layout */
.brand-details-grid { display: grid; grid-template-columns: 1.5fr 2.5fr; gap: var(--space-6); align-items: end; }

/* File Upload */
.sidebar-header { display: flex; flex-direction: column; gap: var(--space-4); }
.file-upload-wrapper { 
    background: var(--background-color); border-radius: var(--border-radius-lg); 
    padding: var(--space-5); text-align: center; border: 2px dashed var(--border-color); 
    color: var(--text-secondary); font-size: 0.9rem; cursor: pointer; 
    transition: all 0.2s ease-in-out; 
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    gap: var(--space-3);
}
.file-upload-wrapper.dragging, .file-upload-wrapper:hover { border-color: var(--primary-color); background: var(--hover-bg-color); color: var(--primary-color); }
.camera-container {
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-3);
    display: none;
}
.camera-container video {
    width: 100%;
    border-radius: var(--border-radius-lg);
    background: #000;
    aspect-ratio: 4 / 3;
}
.camera-action-row {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}
.camera-action-row .btn {
    flex: 1 1 140px;
}
.camera-hint {
    margin-top: var(--space-3);
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

       
/* Image Previews & Asset Panel */
#product-images-preview-container { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.preview-image-wrapper { position: relative; cursor: pointer; border-radius: var(--border-radius-lg); overflow: hidden; border: 2px solid transparent; transition: border-color 0.2s ease; aspect-ratio: 4 / 3; }
.preview-image-wrapper img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s ease; }
.preview-image-wrapper::after { content: ''; position: absolute; inset: 0; background-color: var(--primary-color); opacity: 0; transition: opacity 0.2s ease-in-out; }
.preview-image-wrapper.selected { border-color: var(--primary-color); box-shadow: 0 0 10px 0 var(--accent-glow); }
.preview-image-wrapper.selected::after { opacity: 0.2; }
.preview-image-wrapper:hover img { transform: scale(1.05); }
.selection-checkmark { position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; background-color: var(--primary-color); color: white; border-radius: 50%; display: flex; justify-content: center; align-items: center; border: 2px solid var(--panel-color); transform: scale(0); opacity: 0; transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); }
.preview-image-wrapper.selected .selection-checkmark { transform: scale(1); opacity: 1; }
.preview-image-delete-btn { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: none; border-radius: 999px; background: rgba(3, 4, 6, 0.75); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background-color 0.2s ease, transform 0.2s ease; z-index: 2; }
.preview-image-delete-btn:hover { background: rgba(120, 75, 240, 0.9); transform: scale(1.05); }
.preview-image-delete-btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.preview-image-delete-btn .material-symbols-rounded { font-size: 18px; line-height: 1; }
html.light .preview-image-delete-btn { background: rgba(26, 28, 32, 0.75); color: #fff; }


.canvas-image-card { position: relative; border-radius: var(--border-radius-lg); overflow: hidden; border: 1px solid var(--border-color); flex: 0 1 180px; aspect-ratio: 4 / 3; background: var(--panel-color); }
.canvas-image-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.canvas-image-remove-btn { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: none; border-radius: 999px; background: rgba(3, 4, 6, 0.75); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background-color 0.2s ease, transform 0.2s ease; }
.canvas-image-remove-btn:hover { background: rgba(120, 75, 240, 0.9); transform: scale(1.05); }
.canvas-image-remove-btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.canvas-image-remove-btn .material-symbols-rounded { font-size: 18px; line-height: 1; }
html.light .canvas-image-remove-btn { background: rgba(26, 28, 32, 0.75); color: #fff; }
.generated-image-card {
    cursor: pointer;
}
.generated-image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.generated-image-card .generated-overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: var(--space-4);
    background: linear-gradient(180deg, rgba(3, 4, 6, 0) 0%, rgba(3, 4, 6, 0.86) 100%);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    transition: transform 0.25s ease, opacity 0.25s ease;
}
.generated-image-card:hover .generated-overlay {
    transform: translateY(-6px);
}
.generated-overlay h4 {
    margin: 0;
    font-size: 1rem;
    font-family: var(--font-heading);
    color: #ffffff;
}
.generated-overlay p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.85);
}
.generated-hint {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
}
html.light .generated-image-card .generated-overlay {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.92) 100%);
}
html.light .generated-overlay h4 {
    color: var(--heading-color);
}
html.light .generated-overlay p {
    color: var(--body-text-color);
}
html.light .generated-hint {
    color: var(--text-secondary);
}

/* --- IMPROVEMENT: Advanced Color Palette --- */
.color-palette-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.color-palette-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background-color: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
}

.color-palette-swatches {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.color-swatch-wrapper {
    position: relative;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-md);
    border: 2px solid var(--border-color);
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.color-swatch:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
}

.color-swatch.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.delete-swatch {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 16px;
    height: 16px;
    background: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.delete-swatch:hover {
    background: var(--primary-color);
    color: white;
}

.default-swatch .delete-swatch {
    display: none;
}

.placeholder-card { min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--text-secondary); border: 2px dashed var(--border-color); border-radius: var(--border-radius-xl); background-color: var(--panel-color); padding: var(--space-4); }
.loading-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--space-6); }
.loading-placeholder { background-color: var(--panel-color); border: 1px solid var(--border-color); border-radius: var(--border-radius-lg); aspect-ratio: 4 / 3; animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

/* Recent Chats Modal */
.modal-overlay {
    position: fixed; inset: 0; background-color: var(--overlay-bg);
    backdrop-filter: blur(var(--backdrop-blur-amount)); z-index: 100;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content {
    background-color: var(--panel-color); border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl); width: 90vw; max-width: 500px;
    max-height: 80vh; display: flex; flex-direction: column;
    transform: scale(0.95); transition: transform 0.3s ease;
}
.modal-overlay.active .modal-content { transform: scale(1); }
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.modal-body { padding: var(--space-6); overflow-y: auto; flex-grow: 1; }
.modal-chats-list { display: flex; flex-direction: column; gap: var(--space-2); }
.modal-chat-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-3) var(--space-4); border-radius: var(--border-radius-lg);
    cursor: pointer; transition: background-color 0.2s ease;
}
.modal-chat-item:hover { background-color: var(--hover-bg-color); }
.modal-chat-item-name { flex-grow: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-chat-item-actions { display: flex; gap: var(--space-2); }
.modal-chat-item-actions .icon-btn { width: 32px; height: 32px; }

#imageDetailsModal .modal-content {
    max-width: 640px;
    width: 90vw;
}
#imageDetailsModal .modal-body, .modal-footer {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
    padding: var(--space-4) var(--space-6);
}
#imageDetailsModal img {
    width: 100%;
    max-width: 280px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
}
#imageDetailsModal .detail-form {
    flex: 1 1 220px;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
#imageDetailsModal .detail-form label {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    font-size: 0.85rem;
    color: var(--text-secondary);
}
#imageDetailsModal .detail-form input,
#imageDetailsModal .detail-form textarea {
    background: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-3);
    color: var(--heading-color);
    font-family: var(--font-body);
}
html.light #imageDetailsModal .detail-form input,
html.light #imageDetailsModal .detail-form textarea {
    background: var(--panel-color-2);
}
#imageDetailsModal .detail-form textarea {
    resize: vertical;
    min-height: 140px;
}

#left-sidebar-toggle{
    display: none;
}

#left-sidebar-close{
    display: none;
}

/* Responsiveness */
.mobile-overlay { position: fixed; inset: 0; background-color: var(--overlay-bg); backdrop-filter: blur(var(--backdrop-blur-amount)); z-index: 40; opacity: 0; transition: opacity 0.3s ease-in-out; pointer-events: none; }
.mobile-overlay.active { opacity: 1; pointer-events: auto; }

@media (max-width: 1280px) {
    .sidebar { position: fixed; height: 100%; top: 0; z-index: 50; box-shadow: 0 0 40px rgba(0,0,0,0.5); }
    #left-sidebar { left: 0; transform: translateX(-100%); }
    #left-sidebar.active { transform: translateX(0); }
    #left-sidebar.active #left-sidebar-close {
        display: inline-flex;
    }
    #right-sidebar { right: 0; transform: translateX(100%); }
    #right-sidebar.active { transform: translateX(0); }
    .main-header { display: flex; }
     #left-sidebar-toggle{
        display: inline-flex;
        margin-bottom: 30px;
    }
}
@media (max-width: 1024px) {
    #main-canvas { padding: var(--space-8); }
     #left-sidebar-toggle{
        display: inline-flex;
        margin-bottom: 30px;
    }
}
@media (max-width: 768px) {
    .sidebar { width: 90vw; max-width: 320px; min-width: 0; }
    #main-canvas { padding: var(--space-4); }
    .panel-body { padding: var(--space-4); }
    .panel-header { padding: var(--space-4); }
    h1 { font-size: 1.5rem; }
    #product-images-preview-container { gap: var(--space-3); }
    .brand-details-grid { grid-template-columns: 1fr; align-items: start; }
    .generate-section-body { flex-direction: column; align-items: stretch; }
    .generate-section-body .select-wrapper, .generate-section-body .btn { width: 100%; }
    #left-sidebar{
        min-width: 100%;
    }
    #left-sidebar-toggle{
        display: inline-flex;
        margin-bottom: 30px;
    }
}

/* Number Input Styles */
.number-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--panel-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.number-input-wrapper input {
    width: 50px;
    text-align: center;
    border: none;
    background: transparent;
    color: var(--heading-color);
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: var(--space-2);
    -moz-appearance: textfield;
}

.number-input-wrapper input::-webkit-outer-spin-button,
.number-input-wrapper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.number-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.number-btn:hover {
    background: var(--hover-bg-color);
    color: var(--heading-color);
}

/* Utility classes */
.icon-xl { font-size: 2.5rem; }
.icon-lg { font-size: 4rem; }
.icon-sm { font-size: 1rem; }
.mt-space-1 { margin-top: var(--space-1); }
.mt-space-2 { margin-top: var(--space-2); }
.mt-space-3 { margin-top: var(--space-3); }
.mt-space-4 { margin-top: var(--space-4); }
.mt-space-6 { margin-top: var(--space-6); }
.mt-space-8 { margin-top: var(--space-8); }
.mb-space-4 { margin-bottom: var(--space-4); }
.mb-space-6 { margin-bottom: var(--space-6); }
.section-title { margin-bottom: var(--space-8); }
.panel-hidden { display: none; }
.panel-compact { margin-top: 0; }
.flex-wrap-gap { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.generate-toolbar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-6); flex-wrap: wrap; }
.min-width-200 { min-width: 200px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.hidden { display: none !important; }
.full-width { width: 100%; }
.w-100 { width: 100%; }
.text-small-muted { font-size: 0.75rem; color: var(--text-secondary); }
.text-heading { color: var(--heading-color); }
.text-sm { font-size: 0.9rem; }
.justify-self-start { justify-self: start; }
.divider { border-top: 1px solid var(--border-color); width: 100%; }
.range-control { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-2); }
.tabular-numeric { font-variant-numeric: tabular-nums; }
.text-center { text-align: center; }

.gap-space-4 { gap: var(--space-4); }
.gap-space-8 { gap: var(--space-8); }
.modal-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin: var(--space-4) 0 var(--space-2);
}

.modal-chat-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.modal-chat-item-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.modal-placeholder {
    padding: var(--space-4);
    color: var(--text-secondary);
}
.panel-toggle button {
    margin-left: auto;
}

.panel-toggle .material-symbols-rounded {
    transition: transform 0.2s ease;
}

.panel-toggle button[aria-expanded="true"] .material-symbols-rounded {
    transform: rotate(180deg);
}

.collapsible {
    display: none;
}

.collapsible.is-expanded {
    display: block;
}

.store-tab-group {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.store-tab {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.store-tab.active {
    background-color: var(--primary-color);
    color: var(--heading-color);
}

.store-fields {
    display: none;
}

.store-fields.active {
    display: block;
}

/* Generated Images Grid */
.generated-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-4);
}

.generated-images-grid img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.generated-images-grid img:hover {
    transform: scale(1.05);
}

/* Image Preview Overlay */
/* Image Preview Overlay - Fullscreen */
.image-preview-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.95);
  padding: clamp(16px, 5vw, 64px);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.image-preview-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

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

.preview-content img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 0 40px rgba(0,0,0,0.6);
  transition: transform 0.3s ease;
}
.mobile-camera-popup {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.95);
  color: #fff;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  z-index: 10000;
  padding: 10px;
  box-sizing: border-box;
}

.popup-header {
  display: flex;
  justify-content: flex-end;
  padding: 10px;
}

.close-btn {
  background: #333;
  border: none;
  font-size: 28px;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
}

.header-right-section{
    display: flex;
    gap: 5px;
}

.popup-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.popup-body video {
  width: 100%;
  max-height: 60%;
  border-radius: 12px;
  background: #000;
}

.capture-btn {
  width: 120px;
  border-radius: 25px;
}

.popup-footer {
  background: #111;
  padding: 12px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.captured-thumbnails {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  padding-bottom: 5px;
}

.captured-thumbnails img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border: 2px solid #fff;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.2s;
}

.captured-thumbnails img.selected {
  border-color: #4caf50;
  opacity: 1;
}

.upload-btn {
  border-radius: 25px;
  font-weight: bold;
}

.preview-content img:hover {
  transform: scale(1.02);
}

.close-preview {
  position: absolute;
  top: clamp(16px, 4vw, 32px);
  right: clamp(16px, 4vw, 32px);
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 1.4rem;
  transition: background 0.2s ease;
}

.close-preview:hover {
  background: rgba(120, 75, 240, 0.8);
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}


/* Button Group */
.button-group {
    display: flex;
    gap: var(--space-2);
}

body.chat-init-locked {
    cursor: progress;
}

body.chat-init-locked .app-container {
    pointer-events: none;
    user-select: none;
    filter: grayscale(0.4);
    opacity: 0.65;
}

.file-upload-wrapper {
  position: relative;
  transition: all 0.3s ease;
}

/* Disabled look when uploading */
.file-upload-wrapper.uploading {
  pointer-events: none;
  opacity: 0.6;
  filter: grayscale(0.3);
}

/* Overlay spinner only */
.loader-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 15, 18, 0.4); /* subtle light-black veil */
  backdrop-filter: blur(2px);
  display: none; /* hidden by default */
  justify-content: center;
  align-items: center;
  border-radius: var(--border-radius-lg);
  z-index: 10;
}

.file-upload-wrapper.uploading .loader-overlay {
  display: flex;
}

/* Spinner */
.loader {
  width: 36px;
  height: 36px;
  border: 3px solid var(--primary-color);
  border-bottom-color: transparent;
  border-radius: 50%;
  animation: rotation 1s linear infinite;
}

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


.canvas-image-placeholder {
  border: 2px dashed var(--primary-color);
  border-radius: var(--border-radius-lg);
  background: var(--panel-color-2);
  width: 180px;
  aspect-ratio: 4 / 3;
  margin: 0 4px;
}
.color-palette-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.color-palette-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  position: relative;
  border: 0.4px solid #444;
}

.color-swatch:hover {
  transform: scale(1.1);
  border-color: #888;
}

.color-swatch.active {
  border-color: #000;
  box-shadow: 0 0 0 2px white, 0 0 0 4px #000;
}

.add-color-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}

.add-color-btn input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
#generatePromptBtn.loading {
  opacity: 0.8;
  cursor: wait;
}

#generatePromptBtn .spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  border: 2px solid #fff;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
/* Chat start animation */
.chat-start-animation {
  animation: chatStartFade 0.8s ease forwards;
}

@keyframes chatStartFade {
  0% {
    opacity: 0;
    transform: translateY(15px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Optional glow pulse on header */
.chat-start-glow {
  animation: chatGlow 1.2s ease-out;
}

@keyframes chatGlow {
  0% {
    box-shadow: 0 0 0px rgba(120, 75, 240, 0.6);
  }
  50% {
    box-shadow: 0 0 25px rgba(120, 75, 240, 0.9);
  }
  100% {
    box-shadow: 0 0 0px rgba(120, 75, 240, 0.0);
  }
}
/* Busy overlay for generation */
.gen-busy-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0,0,0,.28);
  backdrop-filter: blur(2px);
  z-index: 10;
  border-radius: 12px;
}
.gen-busy-overlay.active { display: flex; }

.gen-busy-ring {
  width: 28px; height: 28px;
  border: 3px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: gen-spin 0.9s linear infinite;
}
.gen-busy-text {
  color: #fff;
  font-weight: 600;
  letter-spacing: .2px;
}

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

/* ensure the container can host the overlay */
.generated-images-host {
  position: relative;
}

.api_key_open_ai
{
    display: none;
}


