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

/* ===== CSS VARIABLES / DESIGN TOKENS ===== */
:root {
    /* Colors - Dark Theme */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a28;
    --bg-card: rgba(22, 22, 35, 0.8);
    --bg-card-hover: rgba(30, 30, 48, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);

    /* Accent Colors */
    --accent-primary: #7c5cfc;
    --accent-primary-hover: #9478ff;
    --accent-secondary: #00d4aa;
    --accent-gradient: linear-gradient(135deg, #7c5cfc 0%, #00d4aa 100%);
    --accent-gradient-hover: linear-gradient(135deg, #9478ff 0%, #1aebb9 100%);
    --accent-glow: 0 0 30px rgba(124, 92, 252, 0.3);
    --accent-glow-secondary: 0 0 30px rgba(0, 212, 170, 0.3);

    /* Text */
    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b8;
    --text-tertiary: #666680;
    --text-accent: #9478ff;

    /* Status */
    --success: #00d4aa;
    --warning: #ffb347;
    --error: #ff5c75;
    --info: #5c9cfc;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(124, 92, 252, 0.3);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 50%;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.6);
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 18px;
}

body {
    font-family: 'Heebo', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Background animated gradient */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 50%, rgba(124, 92, 252, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(0, 212, 170, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 80%, rgba(92, 156, 252, 0.04) 0%, transparent 50%);
    z-index: -1;
    animation: bgShift 20s ease-in-out infinite;
}

@keyframes bgShift {

    0%,
    100% {
        transform: translate(0, 0);
    }

    33% {
        transform: translate(-2%, 1%);
    }

    66% {
        transform: translate(2%, -1%);
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* ===== NAVIGATION ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    z-index: 1000;
    transition: all var(--transition-normal);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
    text-decoration: none;
}

.nav-brand .icon {
    font-size: 1.5rem;
    -webkit-text-fill-color: initial;
}

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

.nav-link {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    background: none;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
}

.nav-link.active {
    color: var(--accent-primary);
    background: rgba(124, 92, 252, 0.1);
}

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

.nav-user-name {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-top: 64px;
    min-height: calc(100vh - 64px);
    padding: var(--space-2xl) var(--space-xl);
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-sm);
    font-family: 'Heebo', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-normal);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-gradient-hover);
    transform: translateY(-1px);
    box-shadow: 0 0 40px rgba(124, 92, 252, 0.4);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-accent);
}

.btn-danger {
    background: rgba(255, 92, 117, 0.15);
    color: var(--error);
    border: 1px solid rgba(255, 92, 117, 0.2);
}

.btn-danger:hover {
    background: rgba(255, 92, 117, 0.25);
}

.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
    border-radius: var(--radius-md);
}

.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.8rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all var(--transition-normal);
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-medium);
    box-shadow: var(--shadow-md);
}

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

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    transition: all var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-accent);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.purple {
    background: rgba(124, 92, 252, 0.15);
    color: var(--accent-primary);
}

.stat-icon.green {
    background: rgba(0, 212, 170, 0.15);
    color: var(--accent-secondary);
}

.stat-icon.blue {
    background: rgba(92, 156, 252, 0.15);
    color: var(--info);
}

.stat-icon.orange {
    background: rgba(255, 179, 71, 0.15);
    color: var(--warning);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: var(--space-lg);
}

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

.form-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Heebo', sans-serif;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.15);
}

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

/* ===== UPLOAD AREA ===== */
.upload-area {
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    padding: var(--space-3xl) var(--space-xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent-primary);
    background: rgba(124, 92, 252, 0.05);
}

.upload-area.dragover {
    transform: scale(1.01);
    box-shadow: var(--accent-glow);
}

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

.upload-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    pointer-events: none;
}

.upload-subtext {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    pointer-events: none;
}

.upload-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

/* ===== IMAGE PREVIEW GRID ===== */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-normal);
}

.preview-item:hover {
    border-color: var(--accent-primary);
    transform: scale(1.03);
}

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

.preview-remove {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.preview-item:hover .preview-remove {
    opacity: 1;
}

/* ===== COMPARISON VIEW TOGGLE ===== */
.view-toggle {
    display: inline-flex;
    gap: 2px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 3px;
    border: 1px solid var(--border-subtle);
}

.view-toggle-btn {
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    border: none;
    background: none;
    color: var(--text-secondary);
    font-family: 'Heebo', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.view-toggle-btn.active {
    background: var(--accent-primary);
    color: white;
}

.view-toggle-btn:hover:not(.active) {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
}

/* ===== SLIDER COMPARISON ===== */
.comparison-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
    margin-top: var(--space-lg);
}

.comparison-grid.side-by-side {
    display: block;
    column-width: 500px;
    column-gap: var(--space-xl);
}

.comparison-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.comparison-grid.side-by-side .comparison-card {
    display: inline-block;
    width: 100%;
    margin-bottom: var(--space-xl);
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
}

.comparison-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--border-medium);
}

/* Slider mode */
.comparison-slider {
    position: relative;
    overflow: hidden;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    max-height: calc(100vh - 220px);
    background: var(--bg-tertiary);
    touch-action: none;
    -webkit-touch-callout: none;
}

.comparison-slider .slider-img-original,
.comparison-slider .slider-img-edited {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(100vh - 220px);
    object-fit: contain;
    pointer-events: none;
    -webkit-user-drag: none;
    user-select: none;
}

.comparison-slider .slider-img-edited {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    clip-path: inset(0 0 0 50%);
    pointer-events: none;
    -webkit-user-drag: none;
}

.comparison-slider .slider-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    background: white;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
    z-index: 10;
    pointer-events: none;
    transform: translateX(-50%);
}

.comparison-slider .slider-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(124, 92, 252, 0.5);
}

.comparison-slider .slider-handle::before {
    content: '◀ ▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.6rem;
    color: var(--accent-primary);
    z-index: 1;
    letter-spacing: 2px;
    white-space: nowrap;
}

.comparison-slider .slider-label {
    position: absolute;
    bottom: 12px;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 5;
    pointer-events: none;
}

.comparison-slider .slider-label.original {
    left: 12px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
}

.comparison-slider .slider-label.edited {
    right: 12px;
    background: rgba(124, 92, 252, 0.6);
    backdrop-filter: blur(8px);
}

/* Side-by-side mode (old layout) */
.comparison-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    background: var(--border-subtle);
}

.comparison-side {
    position: relative;
    overflow: hidden;
}

.comparison-side img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
    transition: transform var(--transition-slow);
}

.comparison-side:hover img {
    transform: scale(1.05);
}

.comparison-label {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.comparison-label.original {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
}

.comparison-label.edited {
    background: rgba(124, 92, 252, 0.6);
    backdrop-filter: blur(8px);
}

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

.comparison-filename {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== PROGRESS BAR ===== */
.progress-container {
    margin: var(--space-lg) 0;
}

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

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 4px;
    transition: width var(--transition-slow);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: var(--space-sm);
}

.pulse-animation {
    animation: pulseGlow 1.5s infinite alternate !important;
    background: var(--accent-primary) !important;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 5px rgba(124, 92, 252, 0.4);
        opacity: 0.8;
    }

    100% {
        box-shadow: 0 0 25px rgba(124, 92, 252, 0.9);
        opacity: 1;
    }
}

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

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

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    /* Constrain to viewport */
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.95);
    transition: all var(--transition-slow);
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.modal-close-btn {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    z-index: 1;
}

.modal-close-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-medium);
    transform: scale(1.1);
}

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

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-xl);
}

.modal-footer {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.modal-footer .btn {
    flex: 1;
}

.modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.6;
    padding-right: 8px;
    padding-bottom: var(--space-md);
    margin-bottom: 0px;
    min-height: 0;
    max-height: 50vh;
}

/* ===== STYLE PROFILE CARDS ===== */
.styles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-lg);
}

.style-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.style-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.style-card:hover::before {
    opacity: 1;
}

.style-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.style-card.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(124, 92, 252, 0.2), var(--shadow-lg);
}

.style-card.selected::before {
    opacity: 1;
}

.style-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.style-summary {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.style-meta {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-subtle);
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.style-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

/* ===== STATUS BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-pending {
    background: rgba(255, 179, 71, 0.15);
    color: var(--warning);
}

.badge-processing {
    background: rgba(92, 156, 252, 0.15);
    color: var(--info);
}

.badge-completed {
    background: rgba(0, 212, 170, 0.15);
    color: var(--success);
}

.badge-failed {
    background: rgba(255, 92, 117, 0.15);
    color: var(--error);
}

/* ===== ANIMATIONS ===== */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stagger-1 {
    animation-delay: 0.1s;
    opacity: 0;
}

.stagger-2 {
    animation-delay: 0.2s;
    opacity: 0;
}

.stagger-3 {
    animation-delay: 0.3s;
    opacity: 0;
}

.stagger-4 {
    animation-delay: 0.4s;
    opacity: 0;
}

/* ===== LOADING SPINNER ===== */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: var(--space-xl) auto;
}

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

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
    color: var(--text-secondary);
}

.loading-text {
    margin-top: var(--space-md);
    font-size: 0.9rem;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
}

.page-subtitle {
    color: var(--text-secondary);
    margin-top: var(--space-xs);
    font-size: 0.9rem;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: var(--space-3xl);
    color: var(--text-tertiary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.4;
}

.empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.empty-text {
    font-size: 0.9rem;
    margin-bottom: var(--space-lg);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    top: 80px;
    left: var(--space-xl);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 3.7s forwards;
    max-width: 380px;
    backdrop-filter: blur(20px);
}

.toast-success {
    background: rgba(0, 212, 170, 0.2);
    border: 1px solid rgba(0, 212, 170, 0.3);
    color: var(--success);
}

.toast-error {
    background: rgba(255, 92, 117, 0.2);
    border: 1px solid rgba(255, 92, 117, 0.3);
    color: var(--error);
}

.toast-info {
    background: rgba(92, 156, 252, 0.2);
    border: 1px solid rgba(92, 156, 252, 0.3);
    color: var(--info);
}

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

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* ===== AUTH PAGE ===== */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 64px);
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

/* ===== LANDING PAGE ===== */
.landing-hero {
    text-align: center;
    padding: var(--space-3xl) 0;
}

.landing-hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: var(--space-lg);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto var(--space-xl);
    line-height: 1.6;
}

.landing-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-3xl);
}

.feature-card {
    text-align: center;
    padding: var(--space-xl);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
}

.feature-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.feature-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ===== SECTION HEADER ===== */
.section-header {
    margin-bottom: var(--space-xl);
}

.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ===== SELECT DROPDOWN ===== */
.form-select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
}

.form-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.15);
}

.form-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 2px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 3px;
    margin-bottom: var(--space-xl);
}

.tab {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    text-align: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    transition: all var(--transition-fast);
}

.tab.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tab:hover:not(.active) {
    color: var(--text-primary);
}

/* ===== MOCK MODE BANNER ===== */
.mock-banner {
    background: rgba(255, 179, 71, 0.1);
    border: 1px solid rgba(255, 179, 71, 0.2);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: 0.85rem;
    color: var(--warning);
}

.mock-banner .icon {
    font-size: 1.2rem;
}

/* ===== PROGRESSIVE UPLOAD UI ===== */
.progressive-header-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 8px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.processing-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    gap: var(--space-md);
    font-size: 0.85rem;
}

.processing-placeholder.uploading-state {
    background: rgba(92, 156, 252, 0.06);
}

.processing-placeholder.queued-state {
    background: rgba(255, 255, 255, 0.02);
}

.processing-spinner-ring {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-right-color: var(--accent-primary);
    border-radius: 50%;
    animation: spinRing 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    box-sizing: border-box;
}

@keyframes spinRing {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.upload-progress-icon {
    font-size: 1.5rem;
    animation: pulseUpload 1.2s ease-in-out infinite;
}

@keyframes pulseUpload {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.15);
        opacity: 1;
    }
}

.queued-dots {
    font-size: 1.3rem;
    opacity: 0.4;
}

/* Upload Timer */
.upload-timer {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Inter', monospace;
    background: rgba(92, 156, 252, 0.15);
    color: var(--info);
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.upload-timer.done {
    background: rgba(0, 212, 170, 0.15);
    color: var(--success);
}

/* Per-image status badges */
.image-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.status-queued {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-tertiary);
}

.status-uploading {
    background: rgba(92, 156, 252, 0.15);
    color: var(--info);
    animation: pulseBadge 1.5s ease-in-out infinite;
}

@keyframes pulseBadge {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.status-uploaded {
    background: rgba(0, 212, 170, 0.1);
    color: var(--accent-secondary);
}

.status-processing {
    background: rgba(124, 92, 252, 0.15);
    color: var(--accent-primary);
    animation: pulseBadge 1.5s ease-in-out infinite;
}

.status-completed {
    background: rgba(0, 212, 170, 0.15);
    color: var(--success);
}

.status-error {
    background: rgba(255, 92, 117, 0.15);
    color: var(--error);
}

/* Comparison info tweaks for progressive mode */
.comparison-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .main-content {
        padding: var(--space-lg) var(--space-md);
    }

    .landing-hero h1 {
        font-size: 2.2rem;
    }

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

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

    .nav-links {
        display: none;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .styles-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== DOWNLOAD TOOLBAR ===== */
.download-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-top: var(--space-md);
    margin-bottom: var(--space-sm);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    gap: var(--space-md);
    flex-wrap: wrap;
}

.download-toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.download-toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.download-toolbar-hint {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* ===== IMAGE CARD ACTIONS (checkbox + download) ===== */
.image-card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.comparison-card:hover .image-card-actions,
.comparison-card.selected .image-card-actions {
    opacity: 1;
}

/* ===== IMAGE SELECT CHECKBOX ===== */
.image-select-checkbox {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.image-select-checkbox:hover {
    border-color: var(--accent-primary);
    background: rgba(124, 92, 252, 0.3);
    transform: scale(1.1);
}

.image-select-checkbox.checked {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(124, 92, 252, 0.5);
}

.image-select-checkbox .checkbox-icon::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    transition: all var(--transition-fast);
}

.image-select-checkbox.checked .checkbox-icon::after {
    content: '✓';
    display: block;
    width: auto;
    height: auto;
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
}

/* ===== SINGLE DOWNLOAD BUTTON ===== */
.btn-download-single {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
    padding: 0;
}

.btn-download-single:hover {
    background: rgba(0, 212, 170, 0.5);
    border-color: var(--accent-secondary);
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(0, 212, 170, 0.4);
}

/* ===== SELECTED CARD STATE ===== */
.comparison-card.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(124, 92, 252, 0.3), var(--shadow-md);
}

.comparison-card.selected::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(124, 92, 252, 0.05);
    pointer-events: none;
    z-index: 1;
    border-radius: var(--radius-lg);
}

/* ===== RESPONSIVE DOWNLOAD ===== */
@media (max-width: 640px) {
    .download-toolbar {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .download-toolbar-left,
    .download-toolbar-right {
        width: 100%;
        justify-content: center;
    }

    .image-card-actions {
        opacity: 1;
    }
}

/* ===== FULLSCREEN LIGHTBOX ===== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--space-md);
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
}

.lightbox-overlay.active {
    opacity: 1;
}

.lightbox-img {
    max-width: 85vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    cursor: default;
    transition: opacity 0.15s ease;
}

.lightbox-content {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    cursor: default;
}

.lightbox-nav {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.lightbox-nav:hover {
    background: rgba(124, 92, 252, 0.5);
    border-color: var(--accent-primary);
    transform: scale(1.15);
    box-shadow: 0 0 20px rgba(124, 92, 252, 0.4);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 28px;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 10001;
}

.lightbox-close:hover {
    background: rgba(255, 92, 117, 0.5);
    border-color: var(--error);
    transform: scale(1.1);
}

.lightbox-label {
    padding: 6px 20px;
    border-radius: var(--radius-sm);
    background: rgba(124, 92, 252, 0.6);
    backdrop-filter: blur(8px);
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}