/* ==========================================================
   CompressHub v3 — Design System
   Tokens dark/light + Layout sidebar + Composants
   ========================================================== */

/* ---------- GOOGLE FONT ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
    
/* ---------- TOKENS DARK (défaut) ---------- */
:root {
    --bg-page:     #0a0a12;
    --bg-surface:  #111120;
    --bg-card:     #161628;
    --bg-input:    #1e1e35;
    --bg-hover:    #222238;

    --border:        rgba(255,255,255,0.07);
    --border-focus:  rgba(99,102,241,0.5);
    --border-accent: rgba(99,102,241,0.25);

    --text-1: #f0f0ff;
    --text-2: #9494b8;
    --text-3: #505070;

    --accent:    #6366f1;
    --accent-lt: #818cf8;
    --accent-gd: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);

    --success: #10b981;
    --warning: #f59e0b;
    --error:   #ef4444;

    --shadow-sm:   0 1px 4px rgba(0,0,0,0.6);
    --shadow-md:   0 4px 20px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 24px rgba(99,102,241,0.2);

    --sidebar-w:  240px;
    --topbar-h:   60px;
    --radius:     12px;
    --radius-sm:  8px;
    --radius-xs:  6px;
    --transition: 0.2s ease;
}

/* ---------- TOKENS LIGHT ---------- */
[data-theme="light"] {
    --bg-page:    #f4f4f9;
    --bg-surface: #ffffff;
    --bg-card:    #ffffff;
    --bg-input:   #f0f0f8;
    --bg-hover:   #ebebf8;

    --border:        rgba(0,0,0,0.08);
    --border-focus:  rgba(99,102,241,0.5);
    --border-accent: rgba(99,102,241,0.3);

    --text-1: #0f0f2e;
    --text-2: #5a5a8a;
    --text-3: #a0a0c0;

    /* accent-lt plus sombre pour rester lisible sur fond clair */
    --accent-lt: #4f46e5;

    --shadow-sm:   0 1px 4px rgba(0,0,0,0.08);
    --shadow-md:   0 4px 20px rgba(0,0,0,0.1);
    --shadow-glow: 0 0 24px rgba(99,102,241,0.12);
}

/* ==========================================================
   RESET & BASE
   ========================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-page);
    color: var(--text-1);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background var(--transition), color var(--transition);
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* Smooth theme transition on key elements */
.sidebar, .topbar, .card, .form-ctrl, select, input,
.alert, .prog-box, .result-box, .sb-usage {
    transition:
        background var(--transition),
        border-color var(--transition),
        color var(--transition),
        box-shadow var(--transition);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ==========================================================
   LAYOUT — .app / .sidebar / .main / .topbar / .page
   ========================================================== */

.app {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 200;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-md);
        transition: transform var(--transition), background var(--transition), border-color var(--transition);
    }
    .sidebar.open { transform: translateX(0); }
}

/* Overlay mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    backdrop-filter: blur(2px);
}

@media (max-width: 768px) {
    .sidebar-overlay.show { display: block; }
}

/* Logo */
.sb-logo {
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sb-logo-mark {
    width: 36px;
    height: 36px;
    background: var(--accent-gd);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.sb-logo-text strong {
    display: block;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.4px;
    color: var(--text-1);
}

.sb-logo-text span {
    font-size: 10px;
    color: var(--text-3);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.sb-plan {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: rgba(99,102,241,0.12);
    color: var(--accent-lt);
    border: 1px solid rgba(99,102,241,0.2);
    white-space: nowrap;
}

/* Nav */
.sb-nav {
    flex: 1;
    padding: 12px 10px;
}

.sb-section {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-3);
    padding: 10px 8px 4px;
}

.sb-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-xs);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.sb-item .sbi-icon {
    width: 18px;
    text-align: center;
    font-size: 13px;
    flex-shrink: 0;
}

.sb-item:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

.sb-item.active {
    background: rgba(99,102,241,0.1);
    color: var(--accent-lt);
    border-color: rgba(99,102,241,0.18);
}

.sb-item.active .sbi-icon { color: var(--accent); }

/* Usage widget */
.sb-usage {
    margin: 0 10px 10px;
    background: rgba(99,102,241,0.06);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius);
    padding: 12px 13px;
}

.sb-usage-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.sb-usage-lbl {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-3);
}

.sb-usage-val {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-lt);
}

.sb-usage-bar {
    height: 4px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 5px;
}

.sb-usage-fill {
    height: 100%;
    background: var(--accent-gd);
    border-radius: 99px;
}

.sb-usage-sub {
    font-size: 11px;
    color: var(--text-3);
}

/* User card */
.sb-user {
    margin: 0 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    cursor: pointer;
    transition: background 0.15s;
    border-radius: var(--radius-xs);
}

.sb-user:hover { background: var(--bg-hover); }

.sb-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-gd);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
}

.sb-user-name { font-size: 12px; font-weight: 600; color: var(--text-1); }
.sb-user-sub  { font-size: 10px; color: var(--text-3); }

/* ---- Topbar ---- */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    height: var(--topbar-h);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    z-index: 100;
    transition: left var(--transition), background var(--transition), border-color var(--transition);
}

@media (max-width: 768px) {
    .topbar { left: 0; padding: 0 14px; }
}

.topbar-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-2);
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.topbar-menu-btn:hover { background: var(--bg-hover); color: var(--text-1); }

@media (max-width: 768px) {
    .topbar-menu-btn { display: flex; }
}

.topbar-logo-mobile {
    display: none;
    font-size: 15px;
    font-weight: 800;
    color: var(--text-1);
}

@media (max-width: 768px) {
    .topbar-logo-mobile { display: block; }
}

.topbar-breadcrumb {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-1);
    display: flex;
    align-items: center;
    gap: 7px;
}

@media (max-width: 768px) {
    .topbar-breadcrumb { display: none; }
}

.tb-sep { color: var(--text-3); font-weight: 400; }
.tb-sub { color: var(--text-2); font-weight: 400; font-size: 13px; }

/* Theme toggle button */
.theme-toggle {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-1);
    border-color: var(--border-accent);
}

/* Upgrade button in topbar */
.btn-upgrade-top,
.topbar .btn-upgrade {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--accent-gd);
    color: white;
    border: none;
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 3px 16px rgba(99,102,241,0.3);
    transition: all 0.15s;
    white-space: nowrap;
    text-decoration: none;
}

.btn-upgrade-top:hover,
.topbar .btn-upgrade:hover { opacity: 0.9; transform: translateY(-1px); }

@media (max-width: 400px) {
    .btn-upgrade-top span,
    .topbar .btn-upgrade span { display: none; }
}

/* ---- Main content area ---- */
.main {
    margin-left: var(--sidebar-w);
    padding-top: var(--topbar-h);
    flex: 1;
    min-width: 0;
}

@media (max-width: 768px) {
    .main { margin-left: 0; }
}

/* Page wrapper */
.page {
    padding: 28px 28px 60px;
}

@media (max-width: 600px) {
    .page { padding: 20px 14px 48px; }
}

/* ==========================================================
   PAGE HEADER
   ========================================================== */
.page-hd {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.page-hd-left { flex: 1; }

.page-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: -0.4px;
}

.pt-icon {
    width: 34px;
    height: 34px;
    background: rgba(99,102,241,0.1);
    border: 1px solid rgba(99,102,241,0.18);
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 15px;
    flex-shrink: 0;
}

.page-desc { color: var(--text-2); font-size: 13px; margin-top: 4px; }

/* ==========================================================
   CARDS
   ========================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-1);
}

.card-title .ct-ic { color: var(--accent); font-size: 13px; }

/* Legacy card heading */
.card h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card h2 i { color: var(--accent); }

.card.info {
    background: rgba(99,102,241,0.04);
    border-color: rgba(99,102,241,0.15);
}

.card.info ol {
    margin-left: 20px;
    margin-bottom: 16px;
}

.card.info li {
    margin-bottom: 8px;
    color: var(--text-2);
    font-size: 13px;
}

.card.info strong { color: var(--accent-lt); }

/* ==========================================================
   ALERTS
   ========================================================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 12px 15px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    border: 1px solid transparent;
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.alert > i,
.al-icon { flex-shrink: 0; font-size: 15px; margin-top: 1px; }

.al-body { flex: 1; }
.al-body strong { font-weight: 600; display: block; margin-bottom: 1px; }

.al-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid currentColor;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.15s;
}

.al-action:hover { opacity: 1; }

.alert-info    { background: rgba(99,102,241,0.07);  border-color: rgba(99,102,241,0.18);  color: var(--accent-lt); }
.alert-success { background: rgba(16,185,129,0.07);  border-color: rgba(16,185,129,0.18);  color: #6ee7b7; }
.alert-warning { background: rgba(245,158,11,0.07);  border-color: rgba(245,158,11,0.18);  color: #fcd34d; }
.alert-error   { background: rgba(239,68,68,0.07);   border-color: rgba(239,68,68,0.18);   color: #fca5a5; }

.alert-info    > i, .alert-info    .al-icon { color: var(--accent); }
.alert-success > i, .alert-success .al-icon { color: var(--success); }
.alert-warning > i, .alert-warning .al-icon { color: var(--warning); }
.alert-error   > i, .alert-error   .al-icon { color: var(--error); }

/* Legacy alert buttons */
.btn-upgrade,
.btn-upgrade-small {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(99,102,241,0.15);
    border: 1px solid rgba(99,102,241,0.3);
    border-radius: 99px;
    color: var(--accent-lt);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    margin-left: 6px;
}

.btn-upgrade:hover,
.btn-upgrade-small:hover { background: rgba(99,102,241,0.25); }

/* ==========================================================
   BADGES
   ========================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border: 1px solid transparent;
}

.badge-free       { background: rgba(148,163,184,0.08); color: #94a3b8; border-color: rgba(148,163,184,0.15); }
.badge-basic      { background: rgba(99,102,241,0.1);   color: #818cf8; border-color: rgba(99,102,241,0.2); }
.badge-pro        { background: rgba(168,85,247,0.1);   color: #c084fc; border-color: rgba(168,85,247,0.2); }
.badge-enterprise { background: rgba(245,158,11,0.1);   color: #fbbf24; border-color: rgba(245,158,11,0.2); }

/* ==========================================================
   FORMS
   ========================================================== */
.form-group {
    margin-bottom: 16px;
    position: relative;
}

/* Legacy label style */
.form-group label,
.form-lbl {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-2);
    margin-bottom: 7px;
}

/* Unified input/select style */
.form-ctrl,
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group select,
.form-group textarea,
.tool-form select,
.tool-form input[type="number"],
.tool-form textarea,
.dimension-group input,
select {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-1);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.form-ctrl:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.tool-form select:focus,
.tool-form input:focus,
.tool-form textarea:focus,
.dimension-group input:focus,
select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
    outline: none;
}

.form-group select,
.tool-form select,
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%239494b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    background-size: 18px;
    padding-right: 32px;
    cursor: pointer;
}

[data-theme="light"] select,
[data-theme="light"] .form-group select,
[data-theme="light"] .tool-form select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%235a5a8a' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
}

select option { background: var(--bg-input); color: var(--text-1); }

.form-group textarea,
.tool-form textarea {
    resize: vertical;
    min-height: 80px;
}

/* File input hidden */
input[type="file"] { display: none; }

/* File info (legacy dropzone) */
.file-info {
    background: var(--bg-input);
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 18px;
    text-align: center;
    color: var(--text-3);
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
    font-size: 13px;
}

.file-info:hover {
    border-color: rgba(99,102,241,0.4);
    color: var(--accent-lt);
    background: rgba(99,102,241,0.04);
}

.file-info.has-file {
    border-color: rgba(99,102,241,0.3);
    background: rgba(99,102,241,0.05);
    color: var(--accent-lt);
}

.file-info.drag-over {
    border-color: rgba(99,102,241,0.7);
    background: rgba(99,102,241,0.09);
    color: var(--accent-lt);
    transform: scale(1.01);
}

/* Format badges inside dropzone */
.fmt {
    display: inline-block;
    padding: 2px 7px;
    background: rgba(99,102,241,0.07);
    border: 1px solid rgba(99,102,241,0.15);
    border-radius: 99px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-lt);
}

/* Slider */
.slider-container {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 12px 0;
}

input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: linear-gradient(to right, var(--accent), #a855f7);
    border-radius: 99px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: 2px solid var(--accent);
    box-shadow: var(--shadow-sm);
}

input[type="range"]:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
}

#crfValue, #qualityValue {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-lt);
    min-width: 36px;
    text-align: center;
}

.hint {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-3);
    margin-top: 4px;
}

.hint .low  { color: var(--accent-lt); }
.hint .high { color: #a855f7; }

/* Dimension inputs */
.dimension-inputs {
    display: flex;
    gap: 14px;
    margin-top: 12px;
}

.dimension-group { flex: 1; }

.dimension-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-2);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dimension-group input::placeholder { color: var(--text-3); }

/* Plan limits info */
.plan-limits-info {
    background: rgba(99,102,241,0.05);
    padding: 10px 12px;
    border-radius: var(--radius-xs);
    margin-bottom: 16px;
    border: 1px solid rgba(99,102,241,0.15);
    font-size: 13px;
    color: var(--text-2);
}

.plan-limits-info strong { color: var(--accent-lt); }

/* ==========================================================
   BUTTONS
   ========================================================== */
.btn,
.btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

/* Primary / Submit */
.btn-primary,
.btn-submit {
    background: var(--accent-gd);
    color: white;
    width: 100%;
    padding: 13px;
    font-size: 14px;
    box-shadow: 0 3px 20px rgba(99,102,241,0.28);
    margin-top: 16px;
}

.btn-primary:hover,
.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 28px rgba(99,102,241,0.38);
}

.btn-primary:active,
.btn-submit:active { transform: translateY(0); box-shadow: none; }

.btn-primary:disabled,
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Ghost / secondary */
.btn-ghost,
.btn-secondary-action {
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border);
}

.btn-ghost:hover,
.btn-secondary-action:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

/* Success / download */
.btn-success,
.btn-download {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    width: 100%;
    padding: 12px;
    font-size: 14px;
    box-shadow: 0 3px 18px rgba(16,185,129,0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--radius-xs);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-success:hover,
.btn-download:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(16,185,129,0.35); }

/* Cancel */
.btn-cancel {
    width: 100%;
    padding: 11px;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: var(--radius-xs);
    color: #fca5a5;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s;
    font-family: inherit;
    font-size: 13px;
}

.btn-cancel:hover { background: rgba(239,68,68,0.14); }

/* Legacy .btn-secondary (result page) */
.btn-secondary {
    flex: 1;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-2);
    text-decoration: none;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s;
    cursor: pointer;
}

.btn-secondary:hover { background: var(--bg-hover); color: var(--text-1); }

/* ==========================================================
   PROGRESS BARS
   ========================================================== */

/* New classes */
.prog-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 14px;
}

.prog-hd {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.prog-lbl {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-1);
}

.prog-lbl .spin { color: var(--accent); animation: spin 1s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.prog-pct { font-size: 14px; font-weight: 800; color: var(--accent-lt); }

.prog-track {
    height: 6px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 12px;
}

.prog-fill {
    height: 100%;
    background: var(--accent-gd);
    border-radius: 99px;
    position: relative;
    overflow: hidden;
    transition: width 0.25s ease;
}

.prog-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 1.4s infinite;
}

@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.prog-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.ps {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 8px 4px;
    text-align: center;
}

.ps-val { font-size: 15px; font-weight: 700; color: var(--text-1); }
.ps-lbl { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 1px; }

/* Legacy progress (upload + compress) */
.upload-progress-container,
.progress-container {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.upload-progress-container h3,
.progress-container h3 {
    color: var(--accent-lt);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
}

.progress-bar-container {
    position: relative;
    height: 20px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: var(--accent-gd);
    border-radius: 99px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    animation: shimmer 1.4s infinite;
}

.progress-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 11px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.upload-details,
.compress-details {
    margin-top: 10px;
    padding: 8px 10px;
    background: var(--bg-card);
    border-radius: var(--radius-xs);
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.5;
}

/* ==========================================================
   RESULT CARD (legacy)
   ========================================================== */
.result-box {
    background: rgba(16,185,129,0.05);
    border: 1px solid rgba(16,185,129,0.18);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 14px;
}

.res-hd {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.res-icon {
    width: 34px;
    height: 34px;
    background: rgba(16,185,129,0.12);
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
    font-size: 16px;
    flex-shrink: 0;
}

.res-title { font-size: 14px; font-weight: 600; color: var(--text-1); }
.res-sub   { font-size: 12px; color: var(--success); }

.res-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
    margin-bottom: 14px;
}

@media (max-width: 400px) { .res-metrics { grid-template-columns: 1fr 1fr; } }

.rm {
    background: var(--bg-input);
    border-radius: var(--radius-xs);
    padding: 9px 6px;
    text-align: center;
}

.rm-val { font-size: 14px; font-weight: 700; color: var(--text-1); }
.rm-val.green { color: var(--success); }
.rm-lbl { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 2px; }

/* Legacy result-info */
.result-info {
    margin: 20px 0;
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.info-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.info-row:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

.info-row.highlight {
    background: rgba(99,102,241,0.06);
    padding: 10px;
    border-radius: var(--radius-xs);
    border: none;
    margin: 12px 0;
}

.label { flex: 0 0 180px; color: var(--text-2); font-weight: 600; }
.value { flex: 1; color: var(--text-1); }
.size  { margin-left: 10px; color: var(--accent-lt); font-weight: 700; }

.actions { display: flex; gap: 14px; margin: 20px 0; }

/* ==========================================================
   TOOL CARDS (editing page)
   ========================================================== */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.tool-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.18s;
    position: relative;
    overflow: hidden;
}

.tool-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tool-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-card h3 i { color: var(--accent); }

.tool-card p {
    color: var(--text-2);
    margin-bottom: 16px;
    line-height: 1.5;
    font-size: 13px;
}

/* Tool form */
.tool-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tool-form .form-group { margin-bottom: 0; }

/* Locked overlay */
.tool-locked { position: relative; opacity: 0.6; pointer-events: none; }

.locked-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.3);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--warning);
    z-index: 10;
    backdrop-filter: blur(2px);
    font-size: 13px;
}

.locked-overlay i { margin-right: 6px; }

/* Tools preview (video.php) */
.tools-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin: 16px 0;
}

.tool-preview {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 16px;
    border: 1px solid var(--border);
    transition: all 0.18s;
}

.tool-preview:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-accent);
}

.tool-preview h3 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-preview h3 i { color: var(--accent); }

.tool-preview ul { list-style: none; margin-left: 0; }

.tool-preview li {
    margin-bottom: 6px;
    color: var(--text-2);
    font-size: 12px;
    padding-left: 14px;
    position: relative;
}

.tool-preview li::before {
    content: "•";
    color: var(--accent);
    position: absolute;
    left: 0;
}

/* ==========================================================
   PROGRESS OVERLAY MODAL (editing.php)
   ========================================================== */
.progress-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.progress-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius);
    padding: 32px;
    width: 90%;
    max-width: 480px;
    box-shadow: var(--shadow-md);
    animation: modal-appear 0.25s ease;
}

@keyframes modal-appear {
    from { opacity: 0; transform: scale(0.93); }
    to   { opacity: 1; transform: scale(1); }
}

.progress-modal h3 {
    color: var(--accent-lt);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
}

.progress-modal .progress-bar-container {
    height: 20px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 14px;
    position: relative;
}

.progress-modal .progress-bar {
    height: 100%;
    background: var(--accent-gd);
    border-radius: 99px;
}

.progress-details {
    text-align: center;
    color: var(--text-2);
    margin-bottom: 20px;
    min-height: 20px;
    font-size: 12px;
}

/* ==========================================================
   LOG OUTPUT
   ========================================================== */
.log-section {
    margin-top: 24px;
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.log-section h3 {
    color: var(--accent-lt);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
}

.log-output {
    max-height: 280px;
    overflow-y: auto;
    background: var(--bg-page);
    border-radius: var(--radius-xs);
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.5;
    border: 1px solid var(--border);
}

.log-output pre { margin: 0; white-space: pre-wrap; word-break: break-word; }

/* ==========================================================
   UPGRADE BOX
   ========================================================== */
.upgrade-box {
    background: rgba(99,102,241,0.06);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 20px;
    text-align: center;
}

.upgrade-box h3 {
    color: var(--accent-lt);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
}

.upgrade-box p {
    color: var(--text-2);
    margin-bottom: 16px;
    font-size: 13px;
}

.upgrade-box .btn-upgrade { margin-left: 0; }

/* ==========================================================
   DISABLED STATES
   ========================================================== */
input:disabled, select:disabled, textarea:disabled, button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ==========================================================
   COPYRIGHT
   ========================================================== */
.copyright {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 40px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 768px) {
    .tools-grid { grid-template-columns: 1fr; }
    .dimension-inputs { flex-direction: column; }
    .actions { flex-direction: column; }
    .info-row { flex-direction: column; align-items: flex-start; }
    .label { flex: none; margin-bottom: 4px; }
    .size { margin-left: 0; margin-top: 4px; }
    .res-metrics { grid-template-columns: 1fr 1fr; }
    .progress-modal { padding: 22px; margin: 16px; }
    .tools-preview { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .form-group label { font-size: 10px; }
    .tool-card { padding: 16px; }
}

/* Touch targets */
@media (hover: none) and (pointer: coarse) {
    .btn-submit, .btn-primary, .file-info { min-height: 44px; }
    input[type="range"]::-webkit-slider-thumb { width: 24px; height: 24px; }
}

/* ==========================================================
   NOTIFICATION (app.js)
   ========================================================== */
.notification-container {
    position: fixed;
    top: calc(var(--topbar-h) + 12px);
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.notification {
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: white;
    box-shadow: var(--shadow-md);
    pointer-events: all;
    animation: slideInDown 0.3s ease-out;
    max-width: 300px;
}

.notification-success { background: var(--success); }
.notification-error   { background: var(--error); }
.notification-warning { background: var(--warning); color: #000; }
.notification-info    { background: var(--accent); }

/* ==========================================================
   LIGHT MODE OVERRIDES
   Couleurs hardcodées pour dark qui deviennent illisibles sur fond clair
   ========================================================== */

/* Alertes — texte lisible sur fond blanc */
[data-theme="light"] .alert-info    { color: #3730a3; }
[data-theme="light"] .alert-success { color: #065f46; }
[data-theme="light"] .alert-warning { color: #92400e; }
[data-theme="light"] .alert-error   { color: #991b1b; }

/* Icônes d'alertes en light mode */
[data-theme="light"] .alert-info    > i,
[data-theme="light"] .alert-info    .al-icon { color: #4f46e5; }
[data-theme="light"] .alert-success > i,
[data-theme="light"] .alert-success .al-icon { color: #059669; }
[data-theme="light"] .alert-warning > i,
[data-theme="light"] .alert-warning .al-icon { color: #d97706; }
[data-theme="light"] .alert-error   > i,
[data-theme="light"] .alert-error   .al-icon { color: #dc2626; }

/* Badges — couleurs lisibles sur fond clair */
[data-theme="light"] .badge-free       { color: #64748b; }
[data-theme="light"] .badge-basic      { color: #4338ca; }
[data-theme="light"] .badge-pro        { color: #7c3aed; }
[data-theme="light"] .badge-enterprise { color: #b45309; }

/* Bouton annuler */
[data-theme="light"] .btn-cancel { color: #dc2626; border-color: rgba(239,68,68,0.4); }

/* Hint high (gradient label) */
[data-theme="light"] .hint .high { color: #7c3aed; }

/* Slider thumb */
[data-theme="light"] input[type="range"]::-webkit-slider-thumb { background: #ffffff; border-color: var(--accent); }

/* Card en light mode */
[data-theme="light"] .card { box-shadow: 0 1px 8px rgba(0,0,0,0.06); }
