/* Ez Licence — thème sombre aligné sur EZShow */

:root {
    --bg: #0f1420;
    --bg-elevated: #161c2b;
    --bg-input: #1a2033;
    --bg-hover: #1f2740;

    --border: #2a3145;
    --border-strong: #3a4463;

    --text: #e6ebf5;
    --text-muted: #8a94ab;
    --text-dim: #5c667f;

    --primary: #2f6feb;
    --primary-hover: #4a83f0;
    --primary-dark: #234fb0;

    --ok: #35c26a;
    --ok-bg: rgba(53, 194, 106, 0.12);
    --off: #6b7684;
    --off-bg: rgba(107, 118, 132, 0.15);
    --warn: #f0a020;
    --danger: #ef5555;
    --danger-bg: rgba(239, 85, 85, 0.12);

    --super: #9775ff;
    --admin: #2f6feb;

    --radius: 6px;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ---------- Topbar ---------- */
.topbar {
    background: #0a0f1a;
    border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 32px; height: 56px; }
.brand { color: var(--text); font-weight: 600; font-size: 16px; }
.brand:hover { text-decoration: none; color: var(--text); }
.brand-mark {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 4px;
}
.nav { display: flex; gap: 20px; flex: 1; }
.nav a, .nav-placeholder { color: var(--text-muted); font-size: 14px; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav-placeholder { color: var(--text-dim); cursor: not-allowed; }
.userbox { display: flex; align-items: center; gap: 12px; }
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-super { background: var(--super); color: #fff; }
.badge-admin { background: var(--admin); color: #fff; }
.user { color: var(--text-muted); font-size: 13px; }
.btn-link { color: var(--text-muted); font-size: 13px; }
.btn-link:hover { color: var(--text); text-decoration: none; }

/* ---------- Main ---------- */
.main { padding: 32px 24px 64px; min-height: calc(100vh - 56px - 60px); }

.page-header { margin-bottom: 24px; }
.page-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
}
.page-header h1 { margin: 0 0 4px; font-size: 24px; font-weight: 600; color: var(--text); }
.page-header .subtitle { margin: 0; color: var(--text-muted); font-size: 13px; }
.actions { display: flex; gap: 8px; }
.breadcrumb { margin-bottom: 8px; font-size: 13px; }
.breadcrumb a { color: var(--text-muted); }

/* ---------- Panels ---------- */
.panel {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 20px;
}
.panel h2 {
    margin: 0 0 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Stats ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.stat-label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; margin-bottom: 12px; color: var(--text); }
.stat-link { font-size: 13px; }
.stat-link-muted { color: var(--text-dim); }

/* ---------- Table ---------- */
.table-wrap {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.table thead th {
    background: #12182a;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom-color: var(--border-strong);
}
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr:last-child td { border-bottom: none; }
.row-actions { white-space: nowrap; }

/* ---------- Definition lists ---------- */
.dl {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 16px;
    margin: 0;
    font-size: 13px;
}
.dl dt { color: var(--text-muted); }
.dl dd { margin: 0; word-break: break-word; color: var(--text); }
.dl-inline { grid-template-columns: auto 1fr auto 1fr auto 1fr auto 1fr; }
@media (max-width: 700px) { .dl-inline { grid-template-columns: 140px 1fr; } }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
}
.btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    text-decoration: none;
    color: var(--text);
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn-block { display: block; width: 100%; padding: 12px 14px; font-size: 14px; font-weight: 600; }

/* ---------- Pills ---------- */
.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.pill-ok  { background: var(--ok-bg);  color: var(--ok); }
.pill-off { background: var(--off-bg); color: var(--off); }

/* ---------- Utilities ---------- */
.mono { font-family: "SF Mono", Menlo, Consolas, monospace; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
code {
    background: var(--bg-input);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    color: var(--text);
    border: 1px solid var(--border);
}

/* ---------- Empty state ---------- */
.empty {
    background: var(--bg-elevated);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}
.empty-page { padding: 80px 40px; }
.empty-code {
    font-size: 64px;
    font-weight: 700;
    color: var(--text-dim);
    line-height: 1;
    margin-bottom: 16px;
}

/* ---------- Todo list ---------- */
.todo { padding-left: 18px; margin: 0; color: var(--text); }
.todo li { margin-bottom: 6px; }

/* ---------- Footer ---------- */
.footer {
    padding: 20px 24px;
    color: var(--text-dim);
    font-size: 12px;
    text-align: center;
    border-top: 1px solid var(--border);
    background: #0a0f1a;
}

/* ---------- Login page (aligné sur EZShow) ---------- */
.page-login {
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-wrap {
    width: 100%;
    max-width: 400px;
    padding: 24px;
}
.login-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 36px 32px;
    box-shadow: var(--shadow);
}
.login-title {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 600;
    text-align: center;
    color: var(--text);
}
.login-subtitle {
    margin: 0 0 24px;
    font-size: 13px;
    text-align: center;
    color: var(--text-muted);
}

/* ---------- Forms ---------- */
.form .field { margin-bottom: 16px; }
.form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.form input[type="text"],
.form input[type="password"],
.form input[type="email"] {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--bg-input);
    color: var(--text);
    font-family: inherit;
}
.form input::placeholder { color: var(--text-dim); }
.form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47, 111, 235, 0.2);
}
.form-actions { margin-top: 24px; }

/* ---------- Alerts ---------- */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
}
.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 85, 85, 0.25);
}

/* ---------- Filter bar ---------- */
.filter-bar {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 20px;
}
.filter-row {
    display: grid;
    gap: 12px;
    align-items: end;
}
.filter-row + .filter-row {
    margin-top: 12px;
}
/* Ligne 1 : Recherche (large) + Pays + Type + Pistes */
.filter-row-primary {
    grid-template-columns: 2fr 1fr 1fr 1.3fr;
}
/* Ligne 2 : Statut + Distributeur + Abonnement (superadmin) */
.filter-row-secondary {
    grid-template-columns: 1fr 1.5fr 2fr;
}
/* Sans distributeur (admin non-superadmin) : 2 colonnes seulement */
.filter-row-secondary.no-distributor {
    grid-template-columns: 1fr 2fr;
}
@media (max-width: 1100px) {
    .filter-row-primary { grid-template-columns: repeat(3, 1fr); }
    .filter-row-secondary,
    .filter-row-secondary.no-distributor { grid-template-columns: repeat(2, 1fr); }
    .filter-field-grow { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
    .filter-row-primary,
    .filter-row-secondary,
    .filter-row-secondary.no-distributor { grid-template-columns: repeat(2, 1fr); }
    .filter-field-grow { grid-column: 1 / -1; }
    .filter-field-lanes { grid-column: 1 / -1; }
}
.filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.filter-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.filter-field input[type="text"],
.filter-field input[type="number"],
.filter-field select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    background: var(--bg-input);
    color: var(--text);
    font-family: inherit;
    min-width: 0;
}
.filter-field select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3e%3cpath fill='none' stroke='%238a94ab' stroke-width='1.5' d='M1 1l4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
    cursor: pointer;
}
.filter-field input::placeholder { color: var(--text-dim); }
.filter-field input:focus,
.filter-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47, 111, 235, 0.2);
}
.filter-range {
    display: flex;
    align-items: center;
    gap: 6px;
}
.filter-range input {
    flex: 1;
    min-width: 0;
}
.filter-range-sep {
    color: var(--text-dim);
    font-size: 13px;
    flex-shrink: 0;
}
.filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

/* Colonne numérique alignée à droite */
.col-num { text-align: right; }
.table thead th.col-num { text-align: right; }

/* Colonne pays : drapeau + code */
.col-country { white-space: nowrap; }
.flag {
    display: inline-block;
    width: 20px;
    height: auto;
    vertical-align: middle;
    margin-right: 6px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Petit cadenas dans les labels quand un filtre est verrouillé */
.lock-icon {
    font-size: 10px;
    opacity: 0.6;
    margin-left: 2px;
    cursor: help;
}

/* Select désactivé */
.filter-field select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Colonne "Expire le" — mise en évidence des dates critiques */
.col-expire { white-space: nowrap; }
.expire-past  { color: var(--danger); font-weight: 600; }
.expire-soon  { color: var(--warn);   font-weight: 600; }
