/* ========================================
   Nano Banana - Vercel Design System
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Vercel Color System */
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-tertiary: #f5f5f5;
    --bg-card: #ffffff;

    /* Brand Accent - Banana Yellow */
    --accent-primary: #f7c948;
    --accent-secondary: #e6b800;
    --accent-glow: rgba(247, 201, 72, 0.25);

    /* Text - Vercel scale */
    --text-primary: #171717;
    --text-secondary: #4d4d4d;
    --text-muted: #808080;

    /* Vercel shadow-as-border (replaces CSS borders) */
    --border-shadow: rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;
    --border-shadow-light: rgb(235, 235, 235) 0px 0px 0px 1px;
    --border-shadow-hover: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px;
    /* Legacy variable names kept for JS compatibility */
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);

    /* Semantic */
    --success: #16a34a;
    --error: #dc2626;
    --warning: #d97706;

    /* Vercel card shadow stack */
    --card-shadow: rgba(0,0,0,0.08) 0px 0px 0px 1px, rgba(0,0,0,0.04) 0px 2px 2px, rgba(0,0,0,0.04) 0px 8px 8px -8px, #fafafa 0px 0px 0px 1px inset;
    --card-shadow-hover: rgba(0,0,0,0.12) 0px 0px 0px 1px, rgba(0,0,0,0.06) 0px 4px 8px;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #f7c948 0%, #e6b800 100%);
    --gradient-bg: #ffffff;
    --gradient-glass: transparent;

    /* Spacing - 8px base */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Radius - Vercel scale */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 8px;
    --radius-xl: 9999px;

    /* Shadows */
    --shadow-sm: rgba(0,0,0,0.04) 0px 2px 4px;
    --shadow-md: rgba(0,0,0,0.08) 0px 4px 12px;
    --shadow-lg: rgba(0,0,0,0.12) 0px 8px 24px;
    --shadow-glow: 0 0 0 3px rgba(247, 201, 72, 0.3);

    /* Transitions */
    --transition-fast: 0.12s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "liga" 1;
}

/* App Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   Announcement Bar
   ======================================== */
.announcement-bar {
    flex: 1;
    background: #fffbeb;
    box-shadow: rgba(247, 201, 72, 0.4) 0px 0px 0px 1px;
    border-radius: var(--radius-md);
    padding: var(--spacing-xs) var(--spacing-md);
    margin: 0 var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    max-width: 600px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.announcement-text {
    flex: 1;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #92400e;
    line-height: 1.4;
}

.announcement-close {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: #92400e;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    opacity: 0.6;
}

.announcement-close:hover {
    opacity: 1;
    background: rgba(146, 64, 14, 0.1);
}

/* ========================================
   Header
   ======================================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) 0;
    margin-bottom: var(--spacing-xl);
    border-bottom: 1px solid #ebebeb;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.logo-icon {
    font-size: 1.5rem;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.logo h1 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.32px;
}

.user-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.auth-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 6px var(--spacing-md);
    background: var(--bg-secondary);
    box-shadow: var(--border-shadow);
    border-radius: 9999px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--error);
    transition: background var(--transition-normal);
}

.auth-status.active .status-dot {
    background: var(--success);
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.avatar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-secondary);
    box-shadow: var(--border-shadow);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.avatar-btn:hover {
    box-shadow: var(--border-shadow-hover);
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.lang-btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    box-shadow: var(--border-shadow);
    border: none;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.lang-btn:hover {
    box-shadow: var(--border-shadow-hover);
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    box-shadow: var(--border-shadow);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    box-shadow: var(--border-shadow-hover);
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* ========================================
   Main Content - Two Panel Layout
   ======================================== */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
    flex: 1;
}

@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: var(--bg-card);
    box-shadow: var(--card-shadow);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
}

.panel-title {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.32px;
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-primary);
}

.panel-title::before {
    content: '';
    width: 3px;
    height: 16px;
    background: var(--accent-primary);
    border-radius: 2px;
}

.panel-header-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.panel-header-row .panel-title {
    margin-bottom: 0;
}

.save-warning {
    font-size: 0.75rem;
    color: var(--warning);
    background: #fffbeb;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    box-shadow: rgba(217, 119, 6, 0.3) 0px 0px 0px 1px;
    position: relative;
    cursor: help;
}

.save-warning .tooltip {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 8px;
    background: var(--bg-card);
    box-shadow: var(--card-shadow);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 100;
}

.save-warning:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   Form Elements
   ======================================== */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

/* Integrated prompt + image input box */
.prompt-input-box {
    box-shadow: var(--border-shadow);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    transition: box-shadow var(--transition-fast);
    overflow: hidden;
}

.prompt-input-box:focus-within {
    box-shadow: rgba(0,0,0,0.12) 0px 0px 0px 1px, 0 0 0 3px rgba(0, 114, 245, 0.1);
}

.prompt-input-box.drag-over {
    box-shadow: rgba(247, 201, 72, 0.6) 0px 0px 0px 2px;
    background: #fffdf0;
}

/* Images inside the box */
.prompt-input-box .image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-md) 0;
    margin: 0;
}

.prompt-input-box .image-gallery:empty {
    display: none;
}

.prompt-input-box .image-gallery .gallery-item {
    width: 88px;
    height: 88px;
    flex-shrink: 0;
}

/* Textarea inside the box */
.prompt-input-box textarea {
    width: 100%;
    padding: var(--spacing-md);
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9375rem;
    resize: none;
    outline: none;
    line-height: 1.6;
}

.prompt-input-box textarea::placeholder {
    color: var(--text-muted);
}

/* Bottom toolbar */
.input-toolbar {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 8px var(--spacing-md);
    border-top: 1px solid #f0f0f0;
}

.upload-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.upload-icon-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.input-toolbar .char-counter {
    margin-left: auto;
}

/* Standard inputs (not inside prompt box) */
select,
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-primary);
    box-shadow: var(--border-shadow);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
    outline: none;
}

select:focus,
input:focus {
    box-shadow: rgba(0,0,0,0.12) 0px 0px 0px 1px, 0 0 0 3px rgba(0, 114, 245, 0.12);
}

input::placeholder {
    color: var(--text-muted);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23808080' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 36px;
}

/* Settings Row */
.settings-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

/* Prompt Templates */
.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.prompt-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.template-select {
    padding: 5px 28px 5px 8px;
    font-size: 0.8125rem;
    min-width: 110px;
    max-width: 140px;
}

.template-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    box-shadow: var(--border-shadow);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.template-btn:hover {
    box-shadow: var(--border-shadow-hover);
    color: var(--text-primary);
}

.delete-template-btn:hover {
    box-shadow: rgba(220, 38, 38, 0.3) 0px 0px 0px 1px;
    color: var(--error);
    background: #fef2f2;
}

.char-counter {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.char-counter.warning {
    color: var(--warning);
}

.char-counter.error {
    color: var(--error);
}

/* ========================================
   Image Upload - gallery items
   ======================================== */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--border-shadow);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.gallery-item:hover {
    box-shadow: var(--border-shadow-hover);
    transform: scale(1.02);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: rgba(0,0,0,0.15) 0px 0px 0px 1px;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.gallery-item:hover .remove-btn {
    opacity: 1;
}

/* Send button (replaces generate button) */
.send-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--text-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.send-btn:hover:not(:disabled) {
    background: #2d2d2d;
    transform: scale(1.06);
    box-shadow: var(--shadow-md);
}

.send-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.send-btn .btn-text {
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn .btn-loader {
    display: none;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.send-btn.loading .btn-text {
    display: none;
}

.send-btn.loading .btn-loader {
    display: block;
}

/* ========================================
   Generate Button (legacy - keep for safety)
   ======================================== */
.generate-btn {
    width: 100%;
    padding: 10px var(--spacing-lg);
    background: var(--text-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 0.9375rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: auto;
    letter-spacing: -0.16px;
}

.generate-btn:hover:not(:disabled) {
    background: #2d2d2d;
    box-shadow: var(--shadow-md);
}

.generate-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.generate-btn.loading .btn-text {
    display: none;
}

.generate-btn .btn-loader {
    display: none;
}

.generate-btn.loading .btn-loader {
    display: block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ========================================
   Output Area
   ======================================== */
.output-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    min-height: 240px;
}

.empty-state svg {
    opacity: 0.3;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.output-gallery {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.output-item {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--border-shadow);
    animation: fadeIn 0.4s ease;
}

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

.output-item img {
    width: 100%;
    display: block;
}

.output-item-actions {
    display: flex;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    border-top: 1px solid #ebebeb;
}

.action-btn {
    flex: 1;
    padding: 7px var(--spacing-md);
    background: var(--bg-primary);
    box-shadow: var(--border-shadow);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.action-btn:hover {
    box-shadow: var(--border-shadow-hover);
    color: var(--text-primary);
}

.action-btn.primary {
    background: var(--accent-primary);
    box-shadow: none;
    color: #1a1000;
    font-weight: 600;
}

.action-btn.primary:hover {
    background: var(--accent-secondary);
    box-shadow: var(--shadow-sm);
}

/* Progress Bar */
.progress-container {
    display: none;
    margin-top: var(--spacing-md);
}

.progress-container.active {
    display: block;
}

.progress-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--text-primary);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: var(--spacing-sm);
}

/* ========================================
   Output Viewer
   ======================================== */
.output-viewer {
    display: none;
    flex: 1;
    gap: var(--spacing-md);
}

.output-viewer.active {
    display: flex;
}

.output-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--border-shadow);
}

.output-main img {
    width: 100%;
    flex: 1;
    object-fit: contain;
    background: #f0f0f0;
    cursor: pointer;
    min-height: 200px;
    max-height: 400px;
}

.output-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm);
    background: var(--bg-primary);
    border-top: 1px solid #ebebeb;
}

.nav-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    box-shadow: var(--border-shadow);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.nav-btn:hover:not(:disabled) {
    box-shadow: var(--border-shadow-hover);
    color: var(--text-primary);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-counter {
    font-size: 0.8125rem;
    color: var(--text-muted);
    min-width: 48px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.output-actions {
    display: flex;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    border-top: 1px solid #ebebeb;
}

/* Output Thumbnails Sidebar */
.output-thumbs {
    width: 56px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 2px;
}

.output-thumb {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    overflow: visible;
    box-shadow: var(--border-shadow-light);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    position: relative;
}

.output-thumb:hover {
    box-shadow: var(--border-shadow-hover);
}

.output-thumb.active {
    box-shadow: rgba(247, 201, 72, 0.8) 0px 0px 0px 2px;
}

.output-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: calc(var(--radius-sm) - 1px);
}

.thumb-delete {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-primary);
    border: none;
    color: white;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.output-thumb:hover .thumb-delete {
    opacity: 1;
}

.thumb-delete:hover {
    background: var(--error);
}

/* ========================================
   Image Preview Modal
   ======================================== */
.preview-modal {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-modal img {
    max-width: 100%;
    max-height: calc(90vh - 60px);
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.preview-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: var(--bg-primary);
}

.preview-download-btn {
    margin-top: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 10px var(--spacing-xl);
    background: var(--text-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 0.9375rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.preview-download-btn:hover {
    background: #2d2d2d;
    box-shadow: var(--shadow-md);
}

/* ========================================
   Modal
   ======================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-primary);
    box-shadow: var(--card-shadow), var(--shadow-lg);
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 400px;
    transform: scale(0.96);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid #ebebeb;
}

.modal-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.16px;
}

.modal-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    box-shadow: var(--border-shadow);
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #fef2f2;
    box-shadow: rgba(220, 38, 38, 0.3) 0px 0px 0px 1px;
    color: var(--error);
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-desc {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.auth-input-wrapper {
    position: relative;
    margin-bottom: var(--spacing-md);
}

.auth-input-wrapper input {
    padding-right: 44px;
}

.toggle-visibility {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition-fast);
}

.toggle-visibility:hover {
    color: var(--text-primary);
}

.save-auth-btn {
    width: 100%;
    padding: 10px;
    background: var(--text-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 0.9375rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.save-auth-btn:hover {
    background: #2d2d2d;
    box-shadow: var(--shadow-sm);
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast-container {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.toast {
    padding: 10px var(--spacing-lg);
    background: var(--text-primary);
    border-radius: var(--radius-md);
    color: #ffffff;
    font-size: 0.875rem;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.25s ease;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    max-width: 360px;
}

@keyframes slideIn {
    from {
        transform: translateX(calc(100% + 16px));
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    background: #171717;
    border-left: 3px solid var(--success);
}

.toast.error {
    background: #171717;
    border-left: 3px solid var(--error);
    max-width: 400px;
}

.toast.warning {
    background: #171717;
    border-left: 3px solid var(--warning);
}

.toast-message {
    flex: 1;
    word-break: break-word;
    color: #ffffff;
}

.toast-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.125rem;
    cursor: pointer;
    padding: 0 4px;
    margin-left: 4px;
    transition: color var(--transition-fast);
    line-height: 1;
}

.toast-close:hover {
    color: rgba(255, 255, 255, 0.9);
}

/* ========================================
   Scrollbar
   ======================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #e5e5e5;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #d0d0d0;
}

/* ========================================
   Responsive Adjustments
   ======================================== */
@media (max-width: 600px) {
    .app-container {
        padding: var(--spacing-md);
    }

    .header {
        flex-wrap: wrap;
        gap: var(--spacing-md);
        margin-bottom: var(--spacing-lg);
    }

    .settings-row {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: var(--spacing-md);
    }
}

/* ========================================
   Task Queue
   ======================================== */
.task-queue-container {
    background: var(--bg-secondary);
    box-shadow: var(--border-shadow);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    overflow: hidden;
}

.task-queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px var(--spacing-md);
    background: var(--bg-tertiary);
    border-bottom: 1px solid #ebebeb;
}

.task-queue-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.task-queue-list {
    max-height: 200px;
    overflow-y: auto;
}

.task-empty {
    padding: var(--spacing-md);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.task-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid #ebebeb;
    transition: background var(--transition-fast);
}

.task-item:last-child {
    border-bottom: none;
}

.task-item:hover {
    background: var(--bg-tertiary);
}

.task-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-sm);
}

.task-prompt {
    font-size: 0.8125rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.task-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.task-status {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.task-status.pending {
    color: var(--warning);
}

.task-status.completed {
    color: var(--success);
}

.task-status.failed {
    color: var(--error);
}

.task-progress-bar {
    flex: 1;
    height: 3px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    max-width: 100px;
}

.task-progress-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 50%, var(--accent-primary) 100%);
    background-size: 200% 100%;
    animation: taskFlow 2s ease-in-out infinite;
}

@keyframes taskFlow {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.task-actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.task-action-btn {
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius-sm);
    box-shadow: var(--border-shadow);
    border: none;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.task-action-btn:hover {
    box-shadow: var(--border-shadow-hover);
    color: var(--text-primary);
}

.task-action-btn.primary {
    background: var(--accent-primary);
    box-shadow: none;
    color: #1a1000;
    font-weight: 600;
}

.task-action-btn.primary:hover {
    background: var(--accent-secondary);
    box-shadow: var(--shadow-sm);
}

.task-action-btn.danger:hover {
    box-shadow: rgba(220, 38, 38, 0.3) 0px 0px 0px 1px;
    background: #fef2f2;
    color: var(--error);
}
