/**
 * Multi-View Image Generation
 * 11town - Premium Dashboard Styles
 * HuggingFace-style 3D Camera Control
 */

/* ===========================================
   CSS Variables (11town Brand)
   =========================================== */
:root {
    /* Core Brand Colors */
    --void: #050505;
    --void-light: #0a0a0a;
    --void-lighter: #111111;
    --terminal: #888888;
    --signal: #FFFFFF;
    --cyan: #00C8FF;
    --pink: #FF1493;
    --gold: #FFD700;
    
    /* Semantic Colors */
    --bg-primary: var(--void);
    --bg-secondary: var(--void-light);
    --bg-tertiary: var(--void-lighter);
    --text-primary: var(--signal);
    --text-secondary: var(--terminal);
    --text-muted: #555555;
    --accent: var(--cyan);
    --accent-hot: var(--pink);
    
    /* Borders */
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --border-accent: rgba(0, 200, 255, 0.3);
    
    /* Glows */
    --glow-cyan: 0 0 20px rgba(0, 200, 255, 0.3);
    --glow-pink: 0 0 20px rgba(255, 20, 147, 0.3);
    --glow-gold: 0 0 20px rgba(255, 215, 0, 0.3);
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Layout */
    --sidebar-width: 200px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    
    /* Animation */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 200ms;
}

/* ===========================================
   Reset & Base
   =========================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

/* ===========================================
   App Layout
   =========================================== */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-logo { 
    padding: var(--space-lg); 
    border-bottom: 1px solid var(--border); 
}

.logo { 
    display: flex; 
    align-items: baseline; 
    text-decoration: none; 
    gap: 2px; 
}

.logo-11 { 
    font-family: var(--font-mono); 
    font-size: 1.75rem; 
    font-weight: 700; 
    color: var(--cyan); 
    letter-spacing: -3px; 
}

.logo-town { 
    font-size: 1.25rem; 
    font-weight: 500; 
    color: var(--text-primary); 
}

.sidebar-nav { 
    flex: 1; 
    padding: var(--space-md); 
    display: flex; 
    flex-direction: column; 
    gap: var(--space-xs); 
}

.nav-item {
    display: flex; 
    align-items: center; 
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary); 
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem; 
    font-weight: 500;
    transition: all var(--duration) var(--ease);
}

.nav-item:hover { 
    color: var(--text-primary); 
    background: rgba(255, 255, 255, 0.03); 
}

.nav-item.active { 
    color: var(--cyan); 
    background: rgba(0, 200, 255, 0.08); 
}

.sidebar-footer { 
    padding: var(--space-md); 
    border-top: 1px solid var(--border); 
}

.api-status { 
    display: flex; 
    align-items: center; 
    gap: var(--space-sm); 
    margin-bottom: var(--space-sm); 
}

.status-dot {
    width: 8px; 
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text { 
    font-family: var(--font-mono); 
    font-size: 0.75rem; 
    color: var(--text-secondary); 
}

.version-info { 
    display: flex; 
    justify-content: space-between; 
    font-size: 0.7rem; 
    color: var(--text-muted); 
}

.version { color: var(--cyan); }

/* ===========================================
   Main Content (legacy - now using .app-content in index.html)
   =========================================== */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-lg);
    min-height: 100vh;
}

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

.header-title { display: flex; align-items: center; gap: var(--space-md); }
.header-title h1 { font-size: 1.5rem; font-weight: 600; }

.header-badge {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 4px 10px;
    background: rgba(0, 200, 255, 0.1);
    color: var(--cyan);
    border: 1px solid rgba(0, 200, 255, 0.2);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.btn-icon:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

/* ===========================================
   Comparison Section
   =========================================== */
.comparison-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
}

.comparison-container {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: var(--space-lg);
}

.image-box {
    flex: 1;
    max-width: 400px;
    display: flex;
    flex-direction: column;
}

.image-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-sm);
}

.image-content {
    position: relative;
    aspect-ratio: 1;
    min-height: 200px;
    max-height: 500px;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.image-content:hover {
    border-color: var(--border-hover);
}

.image-content.dragover {
    border-color: var(--cyan);
    background: rgba(0, 200, 255, 0.05);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-muted);
}

.empty-state svg { opacity: 0.5; }
.empty-title { font-size: 0.9rem; font-weight: 500; color: var(--text-secondary); }
.empty-hint { font-family: var(--font-mono); font-size: 0.75rem; }

.preview-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.btn-clear {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 20px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    padding-bottom: 2px; /* Visual adjustment for × character */
}

.btn-clear:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.image-footer { margin-top: var(--space-sm); }

.url-input-row {
    display: flex;
    gap: var(--space-sm);
}

.url-input-row input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.url-input-row input:focus {
    outline: none;
    border-color: var(--cyan);
}

.btn-small {
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.btn-small:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.btn-action:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

.comparison-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-md);
    color: var(--text-muted);
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===========================================
   Control Section
   =========================================== */
.control-section { 
    display: flex; 
    flex-direction: column; 
    gap: var(--space-md); 
}

.control-card {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--space-xl);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
}

/* 3D Viewport Area */
.viewport-area { 
    display: flex; 
    flex-direction: column; 
}

.sphere-container {
    flex: 1;
    min-height: 400px;
    background: linear-gradient(180deg, #0c0c0c 0%, #080808 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
}

.sphere-container canvas { 
    width: 100% !important; 
    height: 100% !important; 
    display: block;
}

.prompt-display {
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--cyan);
    text-align: center;
}

/* Controls Area */
.controls-area { 
    display: flex; 
    flex-direction: column; 
    gap: var(--space-lg); 
}

.slider-group { 
    display: flex; 
    flex-direction: column; 
    gap: var(--space-xs); 
}

.slider-header { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
}

.slider-header label { 
    font-size: 0.85rem; 
    font-weight: 500; 
    color: var(--text-primary); 
}

.slider-value { 
    display: flex; 
    align-items: center; 
    gap: 2px; 
}

.slider-value input {
    width: 60px;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-align: center;
}

.slider-value input:focus {
    outline: none;
    border-color: var(--cyan);
}

.slider-value .unit { 
    font-family: var(--font-mono); 
    font-size: 0.8rem; 
    color: var(--text-muted); 
}

/* Custom Range Sliders */
.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider.cyan::-webkit-slider-thumb { background: var(--cyan); box-shadow: var(--glow-cyan); }
.slider.pink::-webkit-slider-thumb { background: var(--pink); box-shadow: var(--glow-pink); }
.slider.yellow::-webkit-slider-thumb { background: var(--gold); box-shadow: var(--glow-gold); }
.slider.gold::-webkit-slider-thumb { background: var(--gold); box-shadow: var(--glow-gold); }

.slider-scale {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 4px;
    gap: 2px;
}

.slider-scale span {
    text-align: center;
    white-space: nowrap;
    flex: 1;
}

.slider-scale span:first-child {
    text-align: left;
    flex: none;
}

.slider-scale span:last-child {
    text-align: right;
    flex: none;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-sm) 0;
}

.checkbox-label input { display: none; }

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--duration) var(--ease);
    position: relative;
}

.checkbox-label input:checked + .checkmark {
    background: var(--cyan);
    border-color: var(--cyan);
}

.checkbox-label input:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--void);
    font-size: 12px;
    font-weight: bold;
}

/* Presets */
.presets-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.presets-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.btn-preset {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.btn-preset:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
}

.btn-secondary, .btn-primary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--pink);
    border: 1px solid var(--pink);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #ff3399;
    box-shadow: var(--glow-pink);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===========================================
   Advanced Panel
   =========================================== */
.advanced-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.advanced-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    list-style: none;
    transition: all var(--duration) var(--ease);
}

.advanced-toggle::-webkit-details-marker { display: none; }

.advanced-toggle:hover { 
    color: var(--text-primary); 
    background: rgba(255, 255, 255, 0.02); 
}

.advanced-toggle .chevron { 
    margin-left: auto; 
    transition: transform var(--duration) var(--ease); 
}

.advanced-panel[open] .chevron { transform: rotate(180deg); }

.advanced-content { 
    padding: var(--space-lg); 
    border-top: 1px solid var(--border); 
}

.advanced-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); 
    gap: var(--space-md); 
}

.input-group { 
    display: flex; 
    flex-direction: column; 
    gap: var(--space-xs); 
}

.input-group label { 
    font-family: var(--font-mono); 
    font-size: 0.7rem; 
    color: var(--text-muted); 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}

.input-group input {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.input-group input:focus {
    outline: none;
    border-color: var(--cyan);
}

.seed-input {
    display: flex;
    gap: var(--space-xs);
}

.seed-input input { flex: 1; }

.btn-mini {
    width: 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.btn-mini:hover { border-color: var(--cyan); }

/* ===========================================
   Page Sections (Generate / History)
   =========================================== */
.page-section {
    display: none;
    flex-direction: column;
    height: 100%;
}

.page-section.active {
    display: flex;
}

/* ===========================================
   History Section (Full Page)
   =========================================== */
.history-stats-bar {
    display: flex;
    gap: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.history-stat {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--cyan);
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.history-list-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-xl);
    color: var(--text-muted);
    text-align: center;
    min-height: 300px;
}

.history-empty svg {
    opacity: 0.3;
}

.history-empty .empty-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* History Item - Collapsed */
.history-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    overflow: hidden;
    transition: all var(--duration) var(--ease);
}

.history-item:hover {
    border-color: var(--cyan);
}

.history-item-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    cursor: pointer;
    transition: background var(--duration) var(--ease);
}

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

.history-item-thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-tertiary);
}

.history-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-item-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.history-item-params {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-item-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: transform var(--duration) var(--ease);
}

.history-item.expanded .history-item-toggle {
    transform: rotate(180deg);
}

/* History Item - Expanded */
.history-item-details {
    display: none;
    padding: var(--space-md);
    padding-top: 0;
    border-top: 1px solid var(--border);
}

.history-item.expanded .history-item-details {
    display: block;
}

.history-item-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.history-image-box {
    position: relative;
}

.history-image-box img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
}

.history-image-label {
    position: absolute;
    top: var(--space-xs);
    left: var(--space-xs);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
}

/* Original: Pink background, Cyan text */
.history-image-label.label-original {
    background: var(--pink);
    color: var(--cyan);
}

/* Generated: Cyan background, Pink text */
.history-image-label.label-generated {
    background: var(--cyan);
    color: var(--pink);
}

.history-item-prompt {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--cyan);
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-md);
}

.history-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.history-meta-tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
}

.history-item-actions {
    display: flex;
    gap: var(--space-sm);
}

.history-item-actions button {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.history-item-actions button:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

.history-item-actions .btn-use {
    background: var(--pink);
    border-color: var(--pink);
    color: white;
}

.history-item-actions .btn-use:hover {
    background: var(--magenta);
    border-color: var(--magenta);
}

.history-item-actions .btn-delete {
    background: transparent;
    border-color: #ef4444;
    color: #ef4444;
}

.history-item-actions .btn-delete:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.history-item-actions .btn-delete:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-export {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.btn-export:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

/* ===========================================
   Modal
   =========================================== */
.modal-overlay {
    display: none;
    position: fixed; 
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 300;
    align-items: center; 
    justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h3 { 
    font-size: 1.2rem; 
    margin-bottom: var(--space-sm); 
}

.modal-content p { 
    color: var(--text-secondary); 
    margin-bottom: var(--space-lg); 
}

.tac-input-group { margin-bottom: var(--space-lg); }

.tac-input-group input {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 1.5rem;
    text-align: center;
    letter-spacing: 8px;
}

.tac-input-group input:focus {
    outline: none;
    border-color: var(--cyan);
}

.modal-actions { 
    display: flex; 
    gap: var(--space-md); 
}

.modal-actions button { flex: 1; }

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

.toast {
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    animation: slideIn 0.3s var(--ease);
}

.toast.success { border-color: rgba(16, 185, 129, 0.5); color: #10b981; }
.toast.error { border-color: rgba(239, 68, 68, 0.5); color: #ef4444; }

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

/* Note: Site header styles are inline in index.html for exact 11town.com match */

/* ===========================================
   Responsive
   =========================================== */
@media (max-width: 1100px) {
    .control-card { 
        grid-template-columns: 1fr; 
    }
    .viewport-area { order: 1; }
    .controls-area { order: 2; }
}

@media (max-width: 900px) {
    .comparison-container { 
        flex-direction: column; 
        align-items: center; 
    }
    .comparison-arrow { 
        transform: rotate(90deg); 
        padding: var(--space-md) 0; 
    }
    .image-box { max-width: 100%; }
}

@media (max-width: 600px) {
    .comparison-section, 
    .control-card, 
    .advanced-panel { padding: var(--space-md); }
    .header-title h1 { font-size: 1.25rem; }
    .image-content {
        min-height: 150px;
        max-height: 400px;
    }
}

/* ===========================================
   TAC Modal Styles (ad-scrapper design)
   =========================================== */
.tac-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    animation: tacFadeIn 0.3s ease;
}

.tac-modal.hidden {
    display: none;
}

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

.tac-modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    width: 100%;
    max-width: 420px;
    animation: tacSlideIn 0.3s ease;
}

@keyframes tacSlideIn {
    from { 
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to { 
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.tac-modal-header {
    background: rgba(10, 10, 10, 0.9);
    border-bottom: 1px solid var(--border-primary);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tac-modal-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.tac-modal-icon {
    width: 32px;
    height: 32px;
    background: rgba(0, 200, 255, 0.1);
    border: 1px solid rgba(0, 200, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.tac-modal-title {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.tac-modal-close {
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.tac-modal-close:hover {
    color: var(--pink);
}

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

.tac-modal-desc {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: var(--space-lg);
}

.tac-info-box {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    background: rgba(0, 200, 255, 0.05);
    border: 1px solid rgba(0, 200, 255, 0.2);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.tac-info-icon {
    color: var(--cyan);
    flex-shrink: 0;
    margin-top: 2px;
}

.tac-info-text {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
}

.tac-success-box {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: rgba(0, 200, 255, 0.1);
    border: 1px solid rgba(0, 200, 255, 0.3);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.tac-success-icon {
    color: var(--cyan);
    font-size: 16px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 200, 255, 0.2);
    border-radius: 50%;
}

.tac-success-content {
    flex: 1;
}

.tac-success-title {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--cyan);
    margin: 0 0 2px 0;
}

.tac-success-desc {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
}

.tac-email-highlight {
    color: var(--text-primary);
}

.tac-input-group {
    margin-bottom: var(--space-md);
}

.tac-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
    text-align: left;
}

.tac-code-input {
    width: 100%;
    height: 56px;
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid var(--border-primary);
    color: var(--cyan);
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-align: center;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tac-code-input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0, 200, 255, 0.1);
}

.tac-code-input::placeholder {
    color: var(--text-muted);
    opacity: 0.3;
}

.tac-error {
    background: rgba(255, 80, 80, 0.1);
    border: 1px solid rgba(255, 80, 80, 0.3);
    color: #FF5050;
    font-family: var(--font-mono);
    font-size: 11px;
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-md);
}

.tac-error.hidden {
    display: none;
}

.tac-btn {
    width: 100%;
    height: 48px;
    border: none;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: all 0.2s ease;
}

.tac-btn-primary {
    background: var(--cyan);
    color: var(--bg-primary);
}

.tac-btn-primary:hover {
    background: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.3);
}

.tac-btn-primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.tac-btn-link {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    padding: var(--space-md);
    transition: color 0.2s ease;
    height: auto;
}

.tac-btn-link:hover {
    color: var(--cyan);
}

.tac-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl) 0;
}

.tac-spinner {
    width: 40px;
    height: 40px;
    animation: tacSpin 1s linear infinite;
}

.tac-spinner-bg {
    opacity: 0.2;
}

.tac-spinner-fg {
    color: var(--cyan);
}

@keyframes tacSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.tac-loading-text {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    margin-top: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tac-modal-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-primary);
    background: rgba(5, 5, 5, 0.8);
}

.tac-footer-text {
    font-family: var(--font-mono);
    font-size: 10px;
    color: rgba(136, 136, 136, 0.6);
    text-align: center;
    margin: 0;
}

.tac-footer-link {
    color: var(--cyan);
    text-decoration: none;
}

.tac-footer-link:hover {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

@media (max-width: 480px) {
    .tac-modal {
        padding: var(--space-md);
    }
    
    .tac-modal-content {
        width: 100%;
    }
}

/* ===========================================
   Site Footer
   =========================================== */
.site-footer {
    padding: var(--space-lg) var(--space-xl);
    border-top: 1px solid var(--border-primary);
    text-align: center;
    background: rgba(5, 5, 5, 0.6);
    margin-top: auto;
}

.site-footer-text {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 0;
}

.site-footer-text a {
    color: var(--pink);
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-footer-text a:hover {
    color: var(--cyan);
}
