/* ===================================================
   REDSCAN  — Premium Design System v2.0
   =================================================== */

/* ─────────── DESIGN TOKENS ─────────── */
:root {
    --bg: #080b12;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-2: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.35);

    --primary: #6366f1;
    --primary-h: #4f52d4;
    --primary-glow: rgba(99, 102, 241, 0.25);
    --accent: #22d3ee;
    --accent-glow: rgba(34, 211, 238, 0.2);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    --text: #e2e8f0;
    --text-muted: #64748b;
    --text-soft: #94a3b8;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --blur: blur(18px);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

    /* legacy aliases so existing PHP/JS still works */
    --bg-color: var(--bg);
    --card-bg: var(--surface);
    --primary-color: var(--primary);
    --primary-hover: var(--primary-h);
    --text-color: var(--text);
    --border-color: var(--border);
    --glass-blur: var(--blur);
    --surface-color: #111520;
}

/* ─────────── RESET & BASE ─────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Outfit', system-ui, sans-serif;
    font-size: 15px;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 0;
    /* Animated gradient mesh background */
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(99, 102, 241, .12) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 100%, rgba(34, 211, 238, .08) 0%, transparent 55%),
        radial-gradient(ellipse at 60% 40%, rgba(99, 102, 241, .05) 0%, transparent 40%);
    background-attachment: fixed;
}

body.dark-theme {
    /* keep compat class */
}

/* ─────────── TYPOGRAPHY ─────────── */
h1,
h2,
h3,
h4,
h5 {
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
}

h1 {
    font-size: clamp(1.5rem, 4vw, 2.2rem);
}

h3 {
    font-size: 1.1rem;
}

p {
    line-height: 1.65;
    color: var(--text-soft);
}

.highlight {
    color: var(--primary);
    font-weight: 700;
}

/* ─────────── UTILITY ─────────── */
.hidden {
    display: none !important;
}

/* ─────────── NAV ─────────── */
nav {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 32px;
    background: rgba(8, 11, 18, 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 1px 0 var(--border);
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-right: auto;
}

.logo small {
    display: block;
    font-size: 0.62rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-top: 1px;
}

/* ─────────── BUTTONS ─────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: .01em;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
    user-select: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-h) 0%, #6366f1 100%);
    box-shadow: 0 6px 20px rgba(99, 102, 241, .4);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .18);
}

.btn-outline {
    background: transparent;
    color: var(--text-soft);
    border-color: var(--border);
}

.btn-outline:hover {
    background: var(--surface-2);
    color: #fff;
    border-color: rgba(255, 255, 255, .2);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
}

.btn-lg {
    padding: 13px 28px !important;
    font-size: 0.95rem !important;
    border-radius: var(--radius) !important;
}

/* Progress button */
.btn-progress {
    position: relative;
    overflow: hidden;
    transition: none !important;
}

.btn-progress::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--progress, 0%);
    background: rgba(255, 255, 255, .18);
    transition: width .1s ease;
    z-index: 1;
}

.btn-progress span {
    position: relative;
    z-index: 2;
}

/* ─────────── GLASS CARD ─────────── */
.glass-card {
    background: var(--surface);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    position: relative;
}

/* Subtle inner top-edge highlight */
.glass-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    background: linear-gradient(160deg, rgba(255, 255, 255, .06) 0%, transparent 60%);
    pointer-events: none;
}

/* ─────────── UPLOAD BOX ─────────── */
.upload-box {
    border: 2px dashed var(--border);
    text-align: center;
    cursor: pointer;
    transition: all .3s ease;
    padding: 70px 30px;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.upload-box:hover,
.upload-box.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, .06);
    box-shadow: 0 0 60px rgba(99, 102, 241, .12);
}

.upload-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    display: block;
    filter: drop-shadow(0 0 16px rgba(99, 102, 241, .4));
}

.upload-icon-small {
    font-size: 1.1rem;
}

/* ─────────── ALERT INFO ─────────── */
.alert-info {
    margin-top: 22px;
    padding: 10px 20px;
    background: rgba(99, 102, 241, .08);
    border: 1px solid rgba(99, 102, 241, .2);
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    color: #a5b4fc;
}

/* ─────────── FEATURE CARDS ─────────── */
.features-section {
    padding: 36px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 0;
}

.feature-item {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: all .25s ease;
    position: relative;
    overflow: hidden;
}

.feature-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity .25s;
}

.feature-item:hover {
    border-color: var(--border-glow);
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.feature-item:hover::after {
    opacity: 1;
}

.feature-item h4 {
    font-size: .95rem;
    margin-bottom: 8px;
    color: #fff;
}

.feature-item p {
    font-size: .83rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0;
}

/* ─────────── QUEUE ─────────── */
.queue-section {
    margin-top: 40px;
    padding: 0 32px 32px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.batch-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.queue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 18px;
}

.queue-item {
    position: relative;
    overflow: hidden;
    transition: transform .3s ease, border-color .3s ease;
    display: flex;
    flex-direction: column;
    cursor: grab;
    border-radius: var(--radius);
}

.queue-item:active {
    cursor: grabbing;
}

.queue-item:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
}

.queue-thumb {
    width: 100%;
    aspect-ratio: 3/4;
    background: #000;
    border-radius: var(--radius-sm);
    object-fit: contain;
    margin-bottom: 12px;
}

.delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(239, 68, 68, .8);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all .2s;
    z-index: 5;
    font-size: 16px;
    backdrop-filter: blur(4px);
}

.queue-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    background: #ef4444;
    transform: scale(1.1);
}

.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--primary);
    width: 0%;
    transition: width .3s ease;
}

.queue-item.ready .progress-bar {
    width: 100%;
    background: var(--success);
    opacity: 0;
    transition: opacity 1s, width .3s;
}

.queue-status-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .7);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 20px;
    text-align: center;
}

.status-text {
    font-size: 0.85rem;
    color: #fff;
    margin-top: 10px;
}

/* ─────────── SORTABLE ─────────── */
.sortable-ghost {
    opacity: .4;
    background: var(--primary) !important;
}

/* ─────────── STATS ─────────── */
.stats-section {
    margin-top: 56px;
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 32px;
}

.stats-container {
    display: flex;
    align-items: center;
    gap: 40px;
    padding: 24px 56px;
    border-radius: 60px;
    background: rgba(99, 102, 241, .04);
    border: 1px solid rgba(99, 102, 241, .15);
    backdrop-filter: blur(10px);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-top: 2px;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border);
}

.stats-accuracy-note {
    font-size: .72rem;
    color: var(--text-muted);
    margin-top: 14px;
    opacity: .6;
}

/* ─────────── RATING ─────────── */
.rating-container {
    margin-top: 40px;
    text-align: center;
    padding: 32px;
}

.star-rating {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 16px 0;
    font-size: 2rem;
}

.star {
    cursor: pointer;
    color: #1e293b;
    transition: all .2s;
}

.star:hover,
.star.active {
    color: #fbbf24;
    transform: scale(1.15);
}

.rating-stats {
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* ─────────── LOADER ─────────── */
.loader-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.spinner {
    width: 38px;
    height: 38px;
    border: 3px solid rgba(255, 255, 255, .08);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loader-progress-text {
    font-size: .88rem;
    color: var(--primary);
    font-weight: 600;
    margin-top: 6px;
}

/* ─────────── MODAL ─────────── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.modal-content {
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.close-modal {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
}

.close-modal:hover {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

/* ─────────── EDITOR / CROP MODAL BODY ─────────── */
.editor-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
    height: 70vh;
    min-height: 500px;
    overflow: hidden;
    padding: 20px;
}

.canvas-container {
    background: #0d101a;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px;
    position: relative;
    height: 100%;
    min-height: 0;
    border: 1px solid var(--border);
}

#editor-canvas {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
    transition: transform .2s ease;
    transform-origin: center center;
}

/* ─────────── ZOOM CONTROLS ─────────── */
.zoom-controls {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(8, 11, 18, .85);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    z-index: 5;
    opacity: .55;
    transition: opacity .25s;
}

.zoom-controls:hover {
    opacity: 1;
}

.zoom-controls button {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background .2s;
}

.zoom-controls button:hover {
    background: rgba(255, 255, 255, .18);
}

#zoom-level {
    font-size: .82rem;
    font-weight: 600;
    min-width: 46px;
    text-align: center;
}

/* ─────────── CONTROL GROUPS ─────────── */
.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    font-size: .75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
}

.filter-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.filter-btn {
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--border);
    color: var(--text-soft);
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: .8rem;
    transition: all .2s;
    font-family: inherit;
}

.filter-btn:hover {
    background: var(--surface-2);
    color: #fff;
}

.filter-btn.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, .12);
    color: #fff;
}

input[type="range"] {
    width: 100%;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* ─────────── MODE MODAL ─────────── */
.mode-card {
    transition: all .25s;
    cursor: pointer;
}

.mode-card:hover {
    background: rgba(255, 255, 255, .08) !important;
    transform: translateY(-4px);
}

.mode-card.active {
    border-color: var(--primary) !important;
    background: rgba(99, 102, 241, .1) !important;
}

/* ─────────── STATUS BADGE ─────────── */
.status-badge {
    background: var(--surface);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: .78rem;
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--warning);
}

.status-badge.ready .status-dot {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, .5);
    }

    50% {
        box-shadow: 0 0 0 5px rgba(16, 185, 129, 0);
    }
}

/* ─────────── LANG SWITCHER ─────────── */
.lang-switcher {
    display: flex;
    gap: 4px;
    background: var(--surface);
    padding: 4px;
    border-radius: 30px;
    border: 1px solid var(--border);
}

.lang-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .73rem;
    cursor: pointer;
    font-weight: 600;
    transition: all .2s;
}

.lang-btn:hover {
    color: #fff;
}

.lang-btn.active {
    background: var(--primary);
    color: #fff;
}

/* ─────────── ID PHOTO PAGE LAYOUT ─────────── */
.page-layout {
    display: grid;
    grid-template-columns: 330px 1fr;
    gap: 20px;
    height: calc(100vh - 58px);
    /* 58px = nav height */
    padding: 16px 24px;
}

.sidebar {
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.sidebar-content::-webkit-scrollbar {
    width: 4px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.sidebar-footer {
    padding: 16px 20px;
    background: rgba(0, 0, 0, .2);
    border-top: 1px solid var(--border);
}

.sidebar h3 {
    font-size: .88rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 16px;
}

/* ─────────── WORKFLOW STEPPER ─────────── */
.workflow-stepper {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
    overflow: hidden;
}

.step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all .2s;
    color: var(--text-muted);
}

.step.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.step.done {
    background: rgba(16, 185, 129, .12);
    color: var(--success);
    border-color: rgba(16, 185, 129, .2);
}

.step-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: 700;
}

.step.active .step-num {
    background: rgba(255, 255, 255, .25);
}

.step-label {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ─────────── FORM ELEMENTS ─────────── */
.form-select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: .88rem;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    transition: border-color .2s;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-select option {
    background: #1a1d27;
    color: #fff;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

/* modern toggle checkbox */
.checkbox-group input[type="checkbox"] {
    width: 36px;
    height: 20px;
    cursor: pointer;
    appearance: none;
    border-radius: 20px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    transition: all .2s;
    position: relative;
    flex-shrink: 0;
}

.checkbox-group input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-group input[type="checkbox"]::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    top: 2px;
    left: 2px;
    transition: transform .2s;
}

.checkbox-group input[type="checkbox"]:checked::after {
    transform: translateX(16px);
}

/* ─────────── SLIDERS (MODERN) ─────────── */
.slider-container {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, .03);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.modern-range {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, .08);
    border-radius: 4px;
    outline: none;
}

.modern-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px var(--primary-glow);
    transition: transform .15s;
}

.modern-range::-webkit-slider-thumb:hover {
    transform: scale(1.25);
}

/* ─────────── ENHANCEMENT SLIDERS (ID PHOTO) ─────────── */
.enhancement-sliders {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 16px;
    background: rgba(255, 255, 255, .02);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.slider-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.value-badge {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(99, 102, 241, .15);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, .25);
    padding: 2px 8px;
    border-radius: 5px;
    font-size: .75rem;
    font-weight: 700;
}

.small-badge {
    font-size: .7rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 2px 7px;
    border-radius: 5px;
    color: var(--text-soft);
}

/* ─────────── CONTROL SUBGROUPS ─────────── */
.control-subgroup {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-subgroup label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--text-muted);
    font-weight: 700;
}

/* ─────────── BUTTON GROUP (CROP MODAL) ─────────── */
.btn-group {
    display: flex;
    background: #090c14;
    border-radius: var(--radius-sm);
    padding: 5px;
    gap: 6px;
    border: 1px solid var(--border);
}

.btn-icon {
    flex: 1;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    border-radius: 6px !important;
    background: #141724 !important;
    border: 1px solid var(--border) !important;
    color: var(--text-soft);
    cursor: pointer;
    transition: all .2s;
    padding: 0 !important;
}

.btn-icon:hover {
    background: #1e2235 !important;
    border-color: var(--primary) !important;
    color: var(--primary);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: color .2s;
    line-height: 1;
}

.btn-text:hover {
    color: #fff;
}

/* ─────────── STRAIGTEN GROUP (CROP) ─────────── */
.straighten-group {
    flex: 1;
    min-width: 240px;
}

.straighten-group .label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

/* ─────────── CROPPER TOOLBAR ─────────── */
.cropper-toolbar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 22px;
    background: rgba(255, 255, 255, .02);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow-y: auto;
    width: 340px;
    flex-shrink: 0;
}

/* ─────────── PRIMARY UPLOAD SECTION (ID PHOTO) ─────────── */
.upload-zones {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

/* ─────────── PROCESSING DASHBOARD (ACTIVITY LOG) ─────────── */
.processing-dashboard {
    background: rgba(0, 0, 0, .25);
    border-radius: var(--radius-sm);
    padding: 12px;
    border: 1px solid var(--border);
    max-height: 145px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    font-size: .78rem;
}

/* ─────────── HORIZONTAL ACTIONS ─────────── */
.horizontal-actions {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-end;
    align-items: center;
    gap: 14px !important;
    padding: 18px 22px;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, .02);
}

/* ─────────── PREVIEW CONTAINER ─────────── */
.preview-container {
    background: #090c14;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
}

#paper-preview {
    /* Removed max-width/height to prevent aspect ratio distortion. 
       The .preview-container handles overflow with scrollbars. */
    display: block;
}

/* ─────────── CONVERT PAGE ─────────── */
.convert-container {
    max-width: 860px;
    margin: 0 auto;
    padding: 36px 24px;
}

.format-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.format-btn {
    padding: 8px 20px;
    border-radius: 30px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    font-size: .82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all .2s;
}

.format-btn:hover {
    background: var(--surface-2);
    color: #fff;
}

.format-btn.active {
    background: rgba(99, 102, 241, .12);
    border-color: var(--primary);
    color: #fff;
}

/* ─────────── NAV LINKS IN BODY ─────────── */
.nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
}

/* ─────────── MODE CONTROL ─────────── */
.mode-control {
    margin-left: 0;
}

/* ─────────── UPLOAD PREVIEW (ID PHOTO sidebar) ─────────── */
.upload-preview-img {
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: block;
    aspect-ratio: 3/4;
    object-fit: contain;
    background: #0a0d16;
}

/* ─────────── RESPONSIVE ─────────── */
@media (max-width: 900px) {
    .page-layout {
        grid-template-columns: 1fr;
        height: auto;
        padding: 12px;
    }

    .sidebar {
        height: auto;
        max-height: 70vh;
    }

    .editor-body {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .cropper-toolbar {
        width: 100%;
    }
}

@media (max-width: 640px) {
    nav {
        padding: 10px 16px;
        gap: 10px;
    }

    .logo {
        font-size: 1.15rem;
    }

    .upload-box {
        padding: 50px 20px;
    }

    .stats-container {
        flex-direction: column;
        gap: 20px;
        padding: 28px;
        border-radius: 20px;
        width: 90%;
    }

    .stat-divider {
        width: 80%;
        height: 1px;
    }

    .queue-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .batch-actions {
        flex-direction: column;
    }

    .editor-body {
        grid-template-columns: 1fr;
    }
}

/* ─────────── CROP CONTAINER ─────────── */
.crop-container {
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

#crop-image {
    max-width: 100%;
    max-height: 100%;
    display: block;
}