/* ==========================================================================
   SmileBot - Main Stylesheet
   ========================================================================== */

:root {
    /* Primary Colors — soft indigo */
    --primary: #6366F1;
    --primary-light: #818CF8;
    --primary-dark: #4F46E5;
    --primary-glow: rgba(99, 102, 241, 0.15);

    /* Neutrals — wider spread for clear layer separation */
    --black: #08090D;
    --grey-900: #111319;
    --grey-800: #1A1D27;
    --grey-700: #242836;
    --grey-600: #313648;
    --grey-500: #434860;
    --grey-400: #6B7194;
    --grey-300: #9CA3B8;
    --grey-200: #CBD5E1;
    --grey-100: #E2E8F0;
    --white: #F8FAFC;

    /* Status Colors */
    --success: #10B981;
    --success-light: #34D399;
    --error: #EF4444;
    --error-light: #F87171;
    --warning: #F59E0B;
    --info: #6366F1;

    /* Backgrounds */
    --bg-primary: var(--black);
    --bg-secondary: var(--grey-900);
    --bg-card: var(--grey-800);
    --bg-input: var(--grey-700);

    /* Text */
    --text-primary: var(--white);
    --text-secondary: var(--grey-200);
    --text-muted: var(--grey-300);
    --text-heading: var(--white);

    /* Borders */
    --border-color: var(--grey-600);
    --border-light: var(--grey-700);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.7), 0 4px 8px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px var(--primary-glow);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

/* Light theme overrides */
.theme-light {
    --primary: #4F46E5;
    --primary-light: #6366F1;
    --primary-dark: #4338CA;
    --primary-glow: rgba(79, 70, 229, 0.12);

    --bg-primary: #F4F4F5;
    --bg-secondary: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-input: #F4F4F5;
    --grey-300: #52525B;
    --grey-500: #D4D4D8;
    --grey-600: #E4E4E7;
    --grey-700: #F4F4F5;
    --text-primary: #18181B;
    --text-secondary: #3F3F46;
    --text-muted: #71717A;
    --text-heading: #09090B;
    --border-color: #D4D4D8;
    --border-light: #E4E4E7;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px var(--primary-glow);
}

.theme-light .card {
    box-shadow: var(--shadow-sm);
    border-color: var(--border-light);
}

.theme-light .nav-tab:hover {
    color: var(--text-primary);
}

.theme-light .nav-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.theme-light .table tr:hover {
    background: #F4F4F5;
}

.theme-light .option-card:hover {
    border-color: var(--border-color);
    background: #F9F9FB;
}

.theme-light .btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.theme-light .btn-secondary:hover:not(:disabled) {
    background: #D4D4D8;
}

.theme-light .btn-primary {
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.theme-light .btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.3);
}

.theme-light .btn-ghost:hover:not(:disabled) {
    background: var(--bg-input);
}

.theme-light .form-label {
    color: var(--text-secondary);
}

.theme-light .disclaimer {
    background: rgba(245, 158, 11, 0.06);
    border-color: rgba(245, 158, 11, 0.3);
}

.theme-light .badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
}

.theme-light .badge-error {
    background: rgba(239, 68, 68, 0.1);
    color: #B91C1C;
}

.theme-light .badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #B45309;
}

.theme-light .upload-area {
    background: #F9F9FB;
}

.theme-light .upload-area:hover {
    background: rgba(79, 70, 229, 0.03);
}

.theme-light .code-block {
    background: #F4F4F5;
    color: #1D4ED8;
}

.theme-light .stat-card {
    box-shadow: var(--shadow-sm);
}

.theme-light .history-item:hover {
    box-shadow: var(--shadow-md);
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-light);
}

img {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-heading);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.875rem; }
.text-center { text-align: center; }

/* ==========================================================================
   Layout
   ========================================================================== */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.container-sm { max-width: 600px; }
.container-md { max-width: 800px; }
.container-lg { max-width: 1000px; }

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-content {
    flex: 1;
    padding: var(--space-xl) 0;
}

/* Grid */
.grid {
    display: grid;
    gap: var(--space-md);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Flex */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-light);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-heading);
}

.card-glow {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(99, 102, 241, 0.1);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--grey-500);
    border-color: var(--grey-400);
}

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

.btn-outline:hover:not(:disabled) {
    background: var(--primary);
    color: #FFFFFF;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--grey-700);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--error);
    color: var(--white);
}

.btn-danger:hover:not(:disabled) {
    background: var(--error-light);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover:not(:disabled) {
    background: var(--success-light);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

/* ==========================================================================
   Forms
   ========================================================================== */

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

.form-label {
    display: block;
    margin-bottom: var(--space-xs);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--grey-300);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--grey-500);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--grey-700);
}

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

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23A1A1AA' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-hint {
    margin-top: var(--space-xs);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.form-error {
    color: var(--error);
}

/* ==========================================================================
   Navigation & Tabs
   ========================================================================== */

.nav-tabs {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 0;
}

.nav-tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 0;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.nav-tab:hover {
    color: var(--text-secondary);
}

.nav-tab.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* ==========================================================================
   Header
   ========================================================================== */

.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-md) 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-heading);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* ==========================================================================
   Stats Cards
   ========================================================================== */

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-wrapper {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-input);
}

.table tr:hover {
    background: var(--grey-700);
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-light);
}

.badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error-light);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-info {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.badge-neutral {
    background: var(--grey-600);
    color: var(--text-secondary);
}

/* ==========================================================================
   Alerts / Notices
   ========================================================================== */

.alert {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    border: 1px solid;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--warning);
    color: var(--warning);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
    color: var(--error-light);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success-light);
}

.alert-info {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--info);
    color: var(--primary-light);
}

/* ==========================================================================
   Upload Area
   ========================================================================== */

.upload-area {
    border: 2px dashed var(--grey-500);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--bg-input);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.06);
    box-shadow: inset 0 0 30px rgba(99, 102, 241, 0.04);
}

.upload-area.has-file {
    border-color: var(--success);
    border-style: solid;
    background: rgba(16, 185, 129, 0.04);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.upload-text {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Progress Steps
   ========================================================================== */

.progress-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    margin-bottom: var(--space-xl);
}

.progress-step {
    display: flex;
    align-items: center;
}

.step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    background: var(--grey-700);
    color: var(--text-muted);
    border: 2px solid var(--grey-500);
    transition: all var(--transition-base);
}

.step-line {
    width: 40px;
    height: 2px;
    background: var(--grey-500);
    transition: background var(--transition-base);
}

.progress-step.active .step-circle {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.progress-step.completed .step-circle {
    background: var(--success);
    color: var(--white);
    border-color: var(--success);
}

.progress-step.completed .step-line,
.progress-step.active .step-line {
    background: var(--primary);
}

/* ==========================================================================
   Image Comparison
   ========================================================================== */

.image-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.comparison-item {
    text-align: center;
}

.comparison-label {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-sm);
}

.comparison-label.before {
    color: var(--text-muted);
}

.comparison-label.after {
    color: var(--success);
}

.comparison-image {
    width: 100%;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
}

.comparison-image.after {
    border-color: var(--success);
}

/* ==========================================================================
   Disclaimer
   ========================================================================== */

.disclaimer {
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    font-size: 0.875rem;
}

.disclaimer-title {
    font-weight: 600;
    color: var(--warning);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.disclaimer-text {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ==========================================================================
   Code Block
   ========================================================================== */

.code-block {
    background: var(--black);
    border: 1px solid var(--grey-600);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    overflow-x: auto;
    color: var(--primary-light);
}

/* ==========================================================================
   Loading States
   ========================================================================== */

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

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

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

.loading-text {
    margin-top: var(--space-md);
    color: var(--text-muted);
}

/* ==========================================================================
   Option Cards (Treatment/Shade Selection)
   ========================================================================== */

.option-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

@media (max-width: 600px) {
    .option-grid {
        grid-template-columns: 1fr;
    }
}

.option-card {
    background: var(--bg-input);
    border: 2px solid var(--grey-500);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: center;
}

.option-card:hover {
    border-color: var(--grey-400);
    background: var(--grey-600);
}

.option-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 20px var(--primary-glow), inset 0 0 20px rgba(99, 102, 241, 0.04);
}

.option-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: var(--space-xs);
}

.option-card-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Credits Display
   ========================================================================== */

.credits-display {
    text-align: center;
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.credits-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.credits-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-heading);
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

.hidden { display: none !important; }
.visible { display: block !important; }

.w-full { width: 100%; }

/* ==========================================================================
   Embed specific styles
   ========================================================================== */

.embed-container {
    max-width: 700px;
    margin: 0 auto;
    padding: var(--space-lg);
}

body.is-embed {
    background: transparent;
}

body.is-embed .embed-container {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    min-height: 100vh;
}

/* ==========================================================================
   History List
   ========================================================================== */

.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.history-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.history-item:hover {
    border-color: var(--grey-500);
    box-shadow: var(--shadow-md);
}

.history-thumb {
    flex-shrink: 0;
    display: flex;
    gap: 4px;
}

.history-thumb img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.history-thumb img.after-thumb {
    border-color: var(--success);
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 2px;
}

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

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

.history-toolbar .form-input,
.history-toolbar .form-select {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.history-count {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.history-empty {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .history-item {
        flex-wrap: wrap;
    }
    .history-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
    max-width: 420px;
    width: calc(100% - 2 * var(--space-lg));
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid;
    pointer-events: auto;
    animation: toast-in 0.3s ease forwards;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.toast.toast-removing {
    animation: toast-out 0.25s ease forwards;
}

.toast-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
    line-height: 1;
    margin-top: 1px;
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.875rem;
    line-height: 1.4;
    word-break: break-word;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.125rem;
    opacity: 0.5;
    padding: 0;
    line-height: 1;
    transition: opacity var(--transition-fast);
}

.toast-close:hover {
    opacity: 1;
}

/* Toast variants */
.toast-success {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--success-light);
}

.toast-error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--error-light);
}

.toast-warning {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--warning);
}

.toast-info {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--primary-light);
}

/* Light theme toast overrides */
.theme-light .toast-success {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.25);
    color: #047857;
}

.theme-light .toast-error {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
    color: #B91C1C;
}

.theme-light .toast-warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.25);
    color: #B45309;
}

.theme-light .toast-info {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(59, 130, 246, 0.25);
    color: #1D4ED8;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

@media (max-width: 768px) {
    .toast-container {
        top: var(--space-md);
        right: var(--space-md);
        left: var(--space-md);
        width: auto;
        max-width: none;
    }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }

    .container {
        padding: 0 var(--space-sm);
    }

    .card {
        padding: var(--space-md);
    }

    .nav-tabs {
        flex-wrap: wrap;
    }

    .header-content {
        flex-wrap: wrap;
    }

    .image-comparison {
        grid-template-columns: 1fr;
    }
}
