/* CDN Révolte RP : même identité que le panel (noir bleuté, rouge RP, Barlow). */
@font-face { font-family: 'Barlow'; src: url('/assets/Barlow-Medium.ttf') format('truetype'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/assets/Barlow-SemiBold.ttf') format('truetype'); font-weight: 600 800; font-display: swap; }

:root {
    --bg: #020617;
    --bg-glow: #0b1430;
    --card: #0b1223;
    --card-raised: #111a2e;
    --border: #1c2740;
    --border-strong: #2b3a57;
    --text: #e6ebf4;
    --muted: #8793aa;
    --accent: #d81206;
    --accent-hover: #f0281b;
    --accent-soft: rgba(216, 18, 6, 0.14);
    --success: #34d399;
    --radius: 14px;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(46, 70, 140, 0.18), transparent 60%),
        radial-gradient(900px 500px at 110% 0%, rgba(216, 18, 6, 0.08), transparent 55%),
        var(--bg);
    background-attachment: fixed;
}
h1, h2 { font-weight: 700; letter-spacing: 0.01em; margin: 0; line-height: 1.2; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.2rem; }
a { color: inherit; }
code { background: var(--card-raised); border: 1px solid var(--border); padding: 0.1em 0.4em; border-radius: 6px; }
.muted { color: var(--muted); font-weight: 500; }
.accent { color: var(--accent); }

/* --- Barre du haut --- */
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 10px clamp(16px, 4vw, 40px);
    background: rgba(2, 6, 23, 0.82);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    box-shadow: inset 0 -2px 0 var(--accent-soft);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-size: 1.15rem; letter-spacing: 0.04em; text-transform: uppercase; }
.brand strong { color: var(--accent); }
.topbar nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topbar nav a, .topbar nav .link {
    padding: 8px 12px; border-radius: 10px; text-decoration: none; color: var(--muted);
    font: inherit; font-weight: 600; background: none; border: 0; cursor: pointer;
}
.topbar nav a:hover, .topbar nav .link:hover { color: var(--text); background: var(--card-raised); }
.topbar nav a.active { color: var(--text); background: var(--accent-soft); }
.topbar nav form { margin: 0; }

/* --- Mise en page --- */
.page { max-width: 1100px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 60px; display: grid; gap: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.card {
    background: linear-gradient(180deg, var(--card-raised), var(--card));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.narrow { max-width: 480px; }
.empty { text-align: center; padding: 40px 20px; }
.empty p { margin: 8px 0 0; }

/* --- Connexion --- */
.auth { min-height: 100vh; display: grid; place-content: center; gap: 14px; padding: 24px 16px; }
.auth-card { width: min(420px, calc(100vw - 32px)); text-align: center; }
.auth-card .stack { text-align: left; margin-top: 18px; }
.auth-logo { width: 140px; height: auto; filter: drop-shadow(0 8px 24px rgba(216, 18, 6, 0.25)); }
.auth-card h1 { margin-top: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.error-code { font-size: 3.5rem; font-weight: 800; color: var(--accent); margin: 0; }

/* --- Formulaires --- */
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 0.95rem; }
label.inline { display: flex; align-items: center; gap: 10px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
input:not([type=checkbox]), select {
    width: 100%; padding: 10px 12px; font: inherit; font-weight: 500; color: var(--text);
    background: var(--bg); border: 1px solid var(--border-strong); border-radius: 10px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 14px; align-items: end; margin-top: 14px; }
@media (max-width: 760px) { .grid-form { grid-template-columns: 1fr; } }

/* --- Boutons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-small { padding: 6px 11px; font-size: 0.88rem; border-radius: 8px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--muted); background: var(--card-raised); }
.btn-ghost.copied { border-color: var(--success); color: var(--success); }
/* Suppression : en contour, pour ne pas la confondre avec l'action principale, rouge pleine */
.btn-danger { background: transparent; color: #ff6b61; border-color: rgba(216, 18, 6, 0.55); }
.btn-danger:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }

/* --- Messages --- */
.flash { padding: 12px 16px; border-radius: 10px; border: 1px solid; font-weight: 600; }
.flash-success { border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.08); color: #a7f3d0; }
.flash-error { border-color: rgba(216, 18, 6, 0.5); background: var(--accent-soft); color: #fecaca; }
.auth .flash { width: min(420px, calc(100vw - 32px)); }

/* --- Nouveau pack --- */
.new-pack { position: relative; }
.new-pack summary { list-style: none; }
.new-pack summary::-webkit-details-marker { display: none; }
.new-pack-form { position: absolute; right: 0; top: calc(100% + 8px); width: min(340px, calc(100vw - 32px)); display: grid; gap: 12px; z-index: 5; }

/* --- Envoi --- */
.upload-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.upload-head select { width: auto; min-width: 220px; max-width: 100%; }
.dropzone {
    display: grid; place-items: center; gap: 6px; text-align: center; cursor: pointer;
    padding: 34px 16px; border: 2px dashed var(--border-strong); border-radius: 12px;
    background: rgba(2, 6, 23, 0.5); font-weight: 500;
    transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-icon { font-size: 2rem; line-height: 1; color: var(--accent); }
.queue { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.queue:empty { display: none; }
.queue-item { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.queue-row { display: flex; justify-content: space-between; gap: 12px; font-size: 0.92rem; }
.queue-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.queue-info { flex-shrink: 0; }
.progress { height: 6px; margin-top: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width 0.2s; }
.queue-item.done .progress span { background: var(--success); }
.queue-item.failed { border-color: rgba(216, 18, 6, 0.5); }
.queue-item.failed .queue-info { color: #ff8a80; }

/* --- Packs --- */
.pack { scroll-margin-top: 80px; }
.pack-head { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center; margin-bottom: 14px; }
.pack-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pack-meta { grid-column: 1; margin: 0; font-size: 0.92rem; }
.pack-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.pack-actions form { margin: 0; }
.pack-empty { margin: 0; }
@media (max-width: 760px) {
    .pack-head { grid-template-columns: 1fr; }
    .pack-actions { grid-column: 1; grid-row: auto; justify-content: flex-start; margin-top: 8px; }
}
.tag {
    display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 0.8rem; font-weight: 700;
    letter-spacing: 0.04em; color: #ffb4ad; background: var(--accent-soft); border: 1px solid rgba(216, 18, 6, 0.45);
}
.inline-edit summary { list-style: none; }
.inline-edit summary::-webkit-details-marker { display: none; }
.inline-edit[open] summary { display: none; }
.inline-form { display: flex; gap: 6px; }
.inline-form input { width: 180px; padding: 6px 10px; }

/* --- Tableau des fichiers --- */
.files { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.files th { text-align: left; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 0 10px 8px; }
.files td { padding: 10px; border-top: 1px solid var(--border); vertical-align: middle; }
.files tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
.col-check { width: 36px; }
.col-name { max-width: 0; width: 100%; }
.col-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.col-size { white-space: nowrap; text-align: right; }
.col-date { white-space: nowrap; font-size: 0.82rem; line-height: 1.35; }
.col-actions { white-space: nowrap; text-align: right; }
.col-actions .btn + .btn { margin-left: 6px; }
.files-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.files-form { margin: 0; overflow-x: auto; }
@media (max-width: 760px) {
    .col-date, .files th.col-date { display: none; }
    .col-actions .btn:first-child { padding: 6px 8px; }
}

/* --- Suivi des mises à jour --- */
:root { --st-todo: #f5a524; --st-done: #34d399; --st-skip: #64748b; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px;
    font: inherit; font-weight: 600; color: var(--muted); cursor: pointer;
    background: var(--card); border: 1px solid var(--border);
}
.filter span { color: var(--text); font-variant-numeric: tabular-nums; }
.filter:hover { border-color: var(--border-strong); color: var(--text); }
.filter.active { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-todo { background: var(--st-todo); }
.dot-done { background: var(--st-done); }
.dot-skip { background: var(--st-skip); }

.pack-progress { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; margin-top: 10px; font-size: 0.9rem; }
.progress-track { flex: 1; max-width: 360px; height: 8px; display: flex; background: rgba(245, 165, 36, 0.22); border-radius: 99px; overflow: hidden; }
.seg { height: 100%; transition: width 0.25s; }
.seg-done { background: var(--st-done); }
.seg-skip { background: var(--st-skip); }
.progress-text { color: var(--muted); }
.progress-text strong { color: var(--st-todo); font-weight: 700; }
.progress-text .all-done { color: var(--st-done); }

.col-status { width: 1%; white-space: nowrap; }
.status-select {
    width: auto; padding: 5px 28px 5px 10px; font-size: 0.85rem; font-weight: 700; border-radius: 99px;
    appearance: none; cursor: pointer;
    background: var(--bg) no-repeat right 10px center / 10px
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238793aa' stroke-width='1.5'/%3E%3C/svg%3E");
}
.status-select:disabled { opacity: 0.6; cursor: wait; }
tr[data-status="todo"] .status-select { color: var(--st-todo); border-color: rgba(245, 165, 36, 0.5); }
tr[data-status="done"] .status-select { color: var(--st-done); border-color: rgba(52, 211, 153, 0.5); }
tr[data-status="skip"] .status-select { color: #94a3b8; border-color: var(--border-strong); }
tr[data-status="done"] .col-name span::before { content: '✓ '; color: var(--st-done); }
tr[data-status="skip"] .col-name span { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(135, 147, 170, 0.6); }

.bulk { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bulk-label { font-size: 0.88rem; }
.btn-status-done, .btn-status-todo, .btn-status-skip { background: transparent; border-color: var(--border-strong); }
.btn-status-done { color: var(--st-done); }
.btn-status-todo { color: var(--st-todo); }
.btn-status-skip { color: #94a3b8; }
.btn-status-done:hover:not(:disabled) { border-color: var(--st-done); background: rgba(52, 211, 153, 0.08); }
.btn-status-todo:hover:not(:disabled) { border-color: var(--st-todo); background: rgba(245, 165, 36, 0.08); }
.btn-status-skip:hover:not(:disabled) { border-color: var(--st-skip); background: rgba(100, 116, 139, 0.12); }
.filter-empty { margin: 8px 0 0; }
.bulk .btn-danger { margin-left: 6px; }
@media (max-width: 760px) {
    .col-size, .files th.col-size { display: none; }
    .bulk-label { display: none; }
}
