/* ============================================================
   MetaCamo Tools — Master Stylesheet
   Pure CSS, tanpa framework, tanpa CDN
   ============================================================ */

/* ── 1. CSS Variables (Design Tokens) ─────────────────────── */
:root {
    /* Warna utama */
    --primary:        #6C63FF;
    --primary-dim:    #5550CC;
    --primary-ghost:  rgba(108, 99, 255, 0.12);
    --primary-border: rgba(108, 99, 255, 0.35);

    /* Background layer */
    --bg:      #0F0F13;
    --surface: #1A1A24;
    --card:    #222232;
    --card-2:  #2A2A3E;

    /* Border */
    --border:        rgba(255, 255, 255, 0.08);
    --border-hover:  rgba(255, 255, 255, 0.14);

    /* Teks */
    --text:      #F0F0F5;
    --text-sec:  #8A8A9A;
    --text-muted:#5A5A6A;

    /* Aksen semantik */
    --success:  #22C55E;
    --success-bg: rgba(34, 197, 94, 0.12);
    --error:    #EF4444;
    --error-bg: rgba(239, 68, 68, 0.12);
    --warning:  #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --info:     #38BDF8;
    --info-bg:  rgba(56, 189, 248, 0.12);

    /* Border radius */
    --r-card: 12px;
    --r-btn:  6px;
    --r-inp:  8px;
    --r-chip: 20px;

    /* Shadow */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);

    /* Sidebar */
    --sidebar-w-collapsed: 64px;
    --sidebar-w-expanded:  220px;
    --sidebar-transition:  0.22s cubic-bezier(0.4, 0, 0.2, 1);

    /* Transisi umum */
    --t: 0.15s ease;

    /* Z-index layers */
    --z-sidebar:  100;
    --z-modal:    200;
    --z-toast:    300;
    --z-overlay:  150;
}

/* ── Light Mode Variables ─────────────────────────────────── */
[data-theme="light"] {
    --primary:       #5046E5;
    --primary-dim:   #4038C4;
    --primary-ghost: rgba(80, 70, 229, 0.10);

    --bg:      #F4F4F8;
    --surface: #FFFFFF;
    --card:    #FFFFFF;
    --card-2:  #F0F0F8;

    --border:       rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.14);

    --text:      #1A1A2E;
    --text-sec:  #5A5A7A;
    --text-muted:#9A9AAA;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.10);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
}

/* ── 2. Reset & Base ──────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--t), color var(--t);
}

a {
    color: var(--primary);
    text-decoration: none;
}
a:hover { text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

ul, ol { list-style: none; }

code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.875em;
    background: var(--card-2);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ── 3. Layout ────────────────────────────────────────────── */

/* Wrapper utama: sidebar + content */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-w-collapsed);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sidebar);
    transition: width var(--sidebar-transition);
    overflow: hidden;
}

.sidebar.expanded {
    width: var(--sidebar-w-expanded);
}

/* Logo area sidebar */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    height: 64px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-logo .logo-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo .logo-icon svg {
    width: 18px;
    height: 18px;
    stroke: #fff;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-logo .logo-text {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.2px;
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity var(--sidebar-transition), transform var(--sidebar-transition);
    pointer-events: none;
}

.sidebar.expanded .logo-text {
    opacity: 1;
    transform: translateX(0);
}

/* Navigasi sidebar */
.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--r-inp);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--t), color var(--t);
    color: var(--text-sec);
    margin-bottom: 2px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.nav-item:hover {
    background: var(--border);
    color: var(--text);
    text-decoration: none;
}

.nav-item.active {
    background: var(--primary-ghost);
    color: var(--primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 3px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
    width: 20px;
    height: 20px;
    min-width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item .nav-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-label {
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity var(--sidebar-transition), transform var(--sidebar-transition);
    pointer-events: none;
}

.sidebar.expanded .nav-label {
    opacity: 1;
    transform: translateX(0);
}

/* Tooltip saat sidebar collapsed */
.nav-item[data-tooltip]:not(.sidebar.expanded .nav-item):hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(var(--sidebar-w-collapsed) + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--card-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 4px 10px;
    border-radius: var(--r-btn);
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 999;
    box-shadow: var(--shadow-md);
}

/* Footer sidebar (user info + logout) */
.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--r-inp);
    overflow: hidden;
    white-space: nowrap;
}

.user-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}

.user-info {
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity var(--sidebar-transition), transform var(--sidebar-transition);
    pointer-events: none;
}

.sidebar.expanded .user-info {
    opacity: 1;
    transform: translateX(0);
}

.user-name  { font-size: 13px; font-weight: 600; }
.user-role  { font-size: 11px; color: var(--text-sec); }

/* Tombol toggle sidebar */
.sidebar-toggle {
    position: fixed;
    top: 16px;
    left: calc(var(--sidebar-w-collapsed) + 8px);
    width: 28px;
    height: 28px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: calc(var(--z-sidebar) + 1);
    transition: left var(--sidebar-transition), background var(--t);
    box-shadow: var(--shadow-sm);
}

.sidebar-toggle:hover { background: var(--card-2); }

.sidebar-toggle svg {
    width: 14px;
    height: 14px;
    stroke: var(--text-sec);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform var(--sidebar-transition);
}

.sidebar.expanded ~ .sidebar-toggle,
body.sidebar-open .sidebar-toggle {
    left: calc(var(--sidebar-w-expanded) + 8px);
}

body.sidebar-open .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* ── Content Area ─────────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w-collapsed);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--sidebar-transition);
}

body.sidebar-open .main-content {
    margin-left: var(--sidebar-w-expanded);
}

/* Header halaman */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Status pills di header */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--r-chip);
    font-size: 12px;
    font-weight: 600;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-sec);
}

.status-pill .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-pill.ok     { color: var(--success); border-color: rgba(34,197,94,0.25); background: var(--success-bg); }
.status-pill.warn   { color: var(--warning); border-color: rgba(245,158,11,0.25); background: var(--warning-bg); }
.status-pill.error  { color: var(--error);   border-color: rgba(239,68,68,0.25);  background: var(--error-bg); }

/* Content wrapper */
.page-body {
    flex: 1;
    padding: 24px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── 4. Cards ─────────────────────────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: 24px;
    transition: border-color var(--t);
}

.card:hover { border-color: var(--border-hover); }

.card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.2px;
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-sec);
    margin-bottom: 20px;
}

/* Card grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* Stat card */
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.stat-icon.purple { background: var(--primary-ghost); color: var(--primary); }
.stat-icon.green  { background: var(--success-bg);    color: var(--success); }
.stat-icon.orange { background: var(--warning-bg);    color: var(--warning); }
.stat-icon.red    { background: var(--error-bg);       color: var(--error); }

.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.stat-label { font-size: 13px; color: var(--text-sec); margin-top: 2px; }

/* ── 5. Formulir ──────────────────────────────────────────── */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sec);
    margin-bottom: 8px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-inp);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color var(--t), box-shadow var(--t);
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ghost);
}

.form-input::placeholder { color: var(--text-muted); }

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A8A9A' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Toggle switch custom */
.toggle-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-wrap input[type="checkbox"] {
    display: none;
}

.toggle-track {
    width: 40px;
    height: 22px;
    background: var(--border);
    border-radius: 11px;
    position: relative;
    transition: background var(--t);
    flex-shrink: 0;
}

.toggle-wrap input:checked ~ .toggle-track {
    background: var(--primary);
}

.toggle-track::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: left var(--t);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.toggle-wrap input:checked ~ .toggle-track::after {
    left: 21px;
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
}

/* ── 6. Tombol ────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 20px;
    border-radius: var(--r-btn);
    border: none;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--t);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-dim); text-decoration: none; }

.btn-secondary {
    background: var(--card-2);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-hover); background: var(--card); text-decoration: none; }

.btn-ghost {
    background: transparent;
    color: var(--text-sec);
    border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.85; text-decoration: none; }

.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { opacity: 0.85; text-decoration: none; }

.btn-warning { background: var(--warning); color: #000; }
.btn-warning:hover { opacity: 0.85; text-decoration: none; }

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 13px 28px;
    font-size: 15px;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--r-btn);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-sec);
    cursor: pointer;
    transition: all var(--t);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover { border-color: var(--border-hover); color: var(--text); }
.btn-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── 7. Upload Zone ───────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--r-card);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background: var(--surface);
}

.upload-zone:hover {
    border-color: var(--primary);
    background: var(--primary-ghost);
}

.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-ghost);
    animation: pulseBorder 0.8s ease infinite alternate;
}

@keyframes pulseBorder {
    from { border-color: var(--primary); box-shadow: 0 0 0 0 var(--primary-ghost); }
    to   { border-color: #a78bfa;        box-shadow: 0 0 0 8px transparent; }
}

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.upload-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: var(--primary-ghost);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.upload-icon svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.upload-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.upload-hint {
    font-size: 13px;
    color: var(--text-sec);
}

.upload-formats {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 14px;
    flex-wrap: wrap;
}

/* ── 8. Progress Bar ──────────────────────────────────────── */
.progress-wrap {
    margin-top: 12px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 13px;
}

.progress-filename {
    font-weight: 500;
    color: var(--text);
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-pct { color: var(--text-sec); }

.progress-bar-track {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--primary), #a78bfa);
    transition: width 0.3s ease;
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0%   { background-position: 200% center; }
    100% { background-position: -200% center; }
}

.progress-bar-fill.done {
    background: var(--success);
    animation: none;
}

.progress-bar-fill.error {
    background: var(--error);
    animation: none;
}

/* List file yang diupload */
.file-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-inp);
    padding: 12px 14px;
}

.file-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.file-type-badge {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.file-type-badge.image { background: var(--primary-ghost); color: var(--primary); }
.file-type-badge.video { background: var(--warning-bg);    color: var(--warning); }

.file-item-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item-size {
    font-size: 12px;
    color: var(--text-sec);
    white-space: nowrap;
}

.file-remove {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--t), background var(--t);
}

.file-remove:hover { color: var(--error); background: var(--error-bg); }

.file-remove svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
}

/* ── 9. Before/After Slider ───────────────────────────────── */
.slider-wrap {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-radius: var(--r-card);
    overflow: hidden;
    user-select: none;
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: col-resize;
}

.slider-img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
}

.slider-before,
.slider-after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.slider-before {
    z-index: 1;
}

.slider-after {
    z-index: 2;
    /* Clip kiri dari handle position */
    clip-path: inset(0 50% 0 0);
    transition: clip-path 0s; /* Update langsung saat drag */
}

/* Label BEFORE / AFTER */
.slider-label {
    position: absolute;
    top: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    padding: 3px 10px;
    border-radius: var(--r-chip);
    z-index: 5;
    pointer-events: none;
}

.slider-label.before {
    left: 12px;
    background: rgba(0,0,0,0.6);
    color: #fff;
}

.slider-label.after {
    right: 12px;
    background: var(--primary);
    color: #fff;
}

/* Handle garis tengah */
.slider-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: #fff;
    z-index: 10;
    transform: translateX(-50%);
    pointer-events: none;
}

.slider-handle::before,
.slider-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 36px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-handle::before {
    top: calc(50% - 18px);
}

/* Ikon panah di dalam handle */
.slider-arrows {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 11;
    pointer-events: none;
    color: var(--primary);
    font-size: 18px;
    font-weight: 700;
}

.slider-container {
    max-width: 640px;
    margin: 0 auto;
}

.slider-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* ── 10. Toast Notifications ──────────────────────────────── */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 340px;
    width: 100%;
    pointer-events: none;
}

.toast {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-inp);
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    animation: slideInToast 0.25s ease;
    pointer-events: all;
    position: relative;
    overflow: hidden;
}

@keyframes slideInToast {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}

.toast.fade-out {
    animation: slideOutToast 0.25s ease forwards;
}

@keyframes slideOutToast {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(110%); }
}

.toast-icon {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    margin-top: 1px;
}

.toast.success .toast-icon { background: var(--success-bg); color: var(--success); }
.toast.error   .toast-icon { background: var(--error-bg);   color: var(--error); }
.toast.warning .toast-icon { background: var(--warning-bg); color: var(--warning); }
.toast.info    .toast-icon { background: var(--info-bg);    color: var(--info); }

.toast-body { flex: 1; }
.toast-title { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.toast-msg   { font-size: 13px; color: var(--text-sec); line-height: 1.4; }

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
    font-size: 16px;
    transition: color var(--t);
    flex-shrink: 0;
}
.toast-close:hover { color: var(--text); }

/* Progress bar bawah toast (auto dismiss) */
.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: currentColor;
    opacity: 0.3;
    animation: toastProgress 3s linear forwards;
}
.toast.success::after { color: var(--success); }
.toast.error::after   { color: var(--error); animation-duration: 5s; }
.toast.info::after    { color: var(--info); }
.toast.warning::after { color: var(--warning); }

@keyframes toastProgress {
    from { width: 100%; }
    to   { width: 0%; }
}

/* ── 11. Loading Spinner ──────────────────────────────────── */
.spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
.spinner.lg { width: 36px; height: 36px; border-width: 3px; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(var(--bg-rgb, 15,15,19), 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    border-radius: inherit;
    z-index: 20;
    backdrop-filter: blur(2px);
}

.loading-overlay .spinner { --primary: #a78bfa; }
.loading-text { font-size: 13px; color: var(--text-sec); }

/* ── 12. Modal ────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeInOverlay 0.15s ease;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-overlay.hidden { display: none; }

.modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: 28px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    animation: scaleInModal 0.15s ease;
}

@keyframes scaleInModal {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal-body {
    color: var(--text-sec);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ── 13. Tabel History ────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--r-card);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead {
    background: var(--surface);
}

thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-sec);
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--t);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface); }

tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    color: var(--text);
}

/* Kolom nama file — potong jika panjang */
.td-filename {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── 14. Badge & Chip ─────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--r-chip);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.badge-success  { background: var(--success-bg); color: var(--success); }
.badge-error    { background: var(--error-bg);    color: var(--error); }
.badge-warning  { background: var(--warning-bg);  color: var(--warning); }
.badge-info     { background: var(--info-bg);      color: var(--info); }
.badge-primary  { background: var(--primary-ghost); color: var(--primary); }
.badge-neutral  { background: var(--border); color: var(--text-sec); }

/* ── 15. Filter Bar ───────────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
}

.filter-bar .form-select,
.filter-bar .form-input {
    width: auto;
    min-width: 140px;
}

/* ── 16. Pagination ───────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-sec);
}

.pagination-btns {
    display: flex;
    gap: 4px;
}

.page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--r-btn);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-sec);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t);
}

.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── 17. Level Selector ───────────────────────────────────── */
.level-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.level-option {
    position: relative;
}

.level-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.level-card {
    border: 1.5px solid var(--border);
    border-radius: var(--r-inp);
    padding: 14px 12px;
    cursor: pointer;
    text-align: center;
    transition: all var(--t);
    background: var(--surface);
}

.level-card:hover {
    border-color: var(--primary);
    background: var(--primary-ghost);
}

.level-option input:checked ~ .level-card {
    border-color: var(--primary);
    background: var(--primary-ghost);
    box-shadow: 0 0 0 2px var(--primary-ghost);
}

.level-icon {
    font-size: 22px;
    margin-bottom: 6px;
}

.level-name {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
}

.level-desc {
    font-size: 11px;
    color: var(--text-sec);
    line-height: 1.4;
}

/* ── 18. Empty State ──────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}

/* Ilustrasi CSS-only — lingkaran dengan ikon */
.empty-illustration {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.empty-illustration::before {
    content: '';
    width: 36px;
    height: 36px;
    background: var(--border);
    border-radius: 8px;
    display: block;
}

.empty-illustration::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--text-muted);
    border-radius: 50%;
    bottom: 10px;
    right: 8px;
}

.empty-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}

.empty-desc {
    font-size: 14px;
    color: var(--text-sec);
    max-width: 300px;
    margin: 0 auto;
}

/* ── 19. Settings ─────────────────────────────────────────── */
.settings-section {
    margin-bottom: 28px;
}

.settings-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-sec);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    gap: 16px;
}

.settings-row:last-child { border-bottom: none; }

.settings-row-info .settings-row-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.settings-row-info .settings-row-desc {
    font-size: 12px;
    color: var(--text-sec);
}

/* ── 20. Login Page ───────────────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: 36px 32px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .logo-icon {
    display: inline-flex;
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    border-radius: 13px;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.login-logo .logo-icon svg {
    width: 26px;
    height: 26px;
    stroke: #fff;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.login-logo h1 { font-size: 20px; font-weight: 700; }
.login-logo p  { font-size: 13px; color: var(--text-sec); margin-top: 3px; }

/* ── 21. Theme Toggle Button ──────────────────────────────── */
.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sec);
    transition: all var(--t);
}

.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

.theme-toggle svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── 22. Banner warning ───────────────────────────────────── */
.banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--r-inp);
    font-size: 13px;
    margin-bottom: 16px;
}

.banner svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    flex-shrink: 0;
    margin-top: 1px;
}

.banner-warning { background: var(--warning-bg); border: 1px solid rgba(245,158,11,0.3); color: #fcd34d; }
.banner-error   { background: var(--error-bg);   border: 1px solid rgba(239,68,68,0.3);  color: #fca5a5; }
.banner-info    { background: var(--info-bg);    border: 1px solid rgba(56,189,248,0.3); color: #7dd3fc; }
.banner-success { background: var(--success-bg); border: 1px solid rgba(34,197,94,0.3);  color: #86efac; }

/* ── 23. Mode selector tabs ───────────────────────────────── */
.tab-bar {
    display: flex;
    gap: 2px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-inp);
    padding: 4px;
    margin-bottom: 20px;
    width: fit-content;
}

.tab-btn {
    padding: 7px 18px;
    border-radius: calc(var(--r-inp) - 2px);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sec);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all var(--t);
    white-space: nowrap;
}

.tab-btn.active {
    background: var(--card);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

/* ── 24. Result Panel ─────────────────────────────────────── */
.result-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: 20px;
    margin-top: 20px;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.result-stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-inp);
    padding: 12px;
}

.result-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-sec);
    margin-bottom: 4px;
}

.result-stat-value {
    font-size: 16px;
    font-weight: 700;
}

.result-stat-value.green  { color: var(--success); }
.result-stat-value.orange { color: var(--warning); }

/* ── 25. Utilitas ─────────────────────────────────────────── */
.d-flex     { display: flex; }
.d-grid     { display: grid; }
.d-none     { display: none !important; }
.d-block    { display: block; }
.gap-8      { gap: 8px; }
.gap-12     { gap: 12px; }
.gap-16     { gap: 16px; }
.gap-20     { gap: 20px; }
.mt-8       { margin-top: 8px; }
.mt-12      { margin-top: 12px; }
.mt-16      { margin-top: 16px; }
.mt-20      { margin-top: 20px; }
.mt-24      { margin-top: 24px; }
.mb-8       { margin-bottom: 8px; }
.mb-12      { margin-bottom: 12px; }
.mb-16      { margin-bottom: 16px; }
.mb-20      { margin-bottom: 20px; }
.mb-24      { margin-bottom: 24px; }
.text-sec   { color: var(--text-sec); }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 13px; }
.text-xs    { font-size: 12px; }
.fw-600     { font-weight: 600; }
.fw-700     { font-weight: 700; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.w-full     { width: 100%; }
.flex-1     { flex: 1; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.divider    { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── 26. Responsif Mobile ─────────────────────────────────── */
@media (max-width: 768px) {
    /* Sidebar jadi bottom navigation di mobile */
    .sidebar {
        width: 100% !important;
        height: 60px;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border);
        overflow: visible;
    }

    .sidebar-logo { display: none; }
    .sidebar-footer { display: none; }
    .sidebar-nav {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-around;
        padding: 8px 4px;
        overflow: visible;
    }

    .nav-item {
        flex-direction: column;
        gap: 4px;
        padding: 6px 10px;
        font-size: 10px;
        min-width: 56px;
        text-align: center;
        margin-bottom: 0;
    }

    .nav-item::before { display: none; }

    .nav-label {
        opacity: 1;
        transform: none;
        font-size: 10px;
        pointer-events: auto;
    }

    .main-content {
        margin-left: 0;
        margin-bottom: 60px;
    }

    body.sidebar-open .main-content {
        margin-left: 0;
    }

    .sidebar-toggle { display: none; }

    /* Header */
    .page-header { padding: 12px 16px; }
    .page-title  { font-size: 15px; }

    /* Content */
    .page-body { padding: 16px; }

    /* Form */
    .form-row { grid-template-columns: 1fr; }

    /* Level selector */
    .level-selector { grid-template-columns: 1fr; }

    /* Upload zone */
    .upload-zone { padding: 32px 16px; }

    /* Filter bar */
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar .form-select,
    .filter-bar .form-input { width: 100%; }

    /* Modal */
    .modal { padding: 20px 16px; }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions .btn { width: 100%; }

    /* Pagination */
    .pagination { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .stat-card { padding: 14px; }
    .card { padding: 16px; }
    .result-stats { grid-template-columns: 1fr 1fr; }
    .toast-container { right: 8px; left: 8px; max-width: none; }
}

/* ── Video Compare Player ─────────────────────────────────────────── */
.video-compare-wrap {
    margin-top: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    overflow: hidden;
}

.video-compare-labels {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid var(--border);
}

.vcl {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.vcl-before { color: var(--text-sec); }
.vcl-after  { color: var(--primary); }

.video-compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.video-compare-grid .video-card:first-child {
    border-right: 2px solid var(--primary);
}

.video-card {
    position: relative;
    background: #000;
    overflow: hidden;
}

.video-card video {
    width: 100%;
    display: block;
    max-height: 260px;
    object-fit: contain;
}

.video-card-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 4px;
    pointer-events: none;
}

.video-card-badge.before {
    background: rgba(0,0,0,0.7);
    color: var(--text-sec);
    border: 1px solid rgba(255,255,255,0.15);
}

.video-card-badge.after {
    background: rgba(108,99,255,0.85);
    color: #fff;
}

.video-sync-bar {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(0,0,0,0.15);
    border-top: 1px solid var(--border);
    justify-content: center;
}

@media (max-width: 600px) {
    .video-compare-grid { grid-template-columns: 1fr; }
    .video-compare-grid .video-card:first-child { border-right: none; border-bottom: 2px solid var(--primary); }
}