/* === Polices Metronomi === */
@font-face {
    font-family: "Basis Grotesque Pro";
    src: url("fonts/Basis Grotesque Pro/BasisGrotesquePro-Light.ttf") format("truetype");
    font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Basis Grotesque Pro";
    src: url("fonts/Basis Grotesque Pro/BasisGrotesquePro-Regular.ttf") format("truetype");
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Basis Grotesque Pro";
    src: url("fonts/Basis Grotesque Pro/BasisGrotesquePro-Medium.ttf") format("truetype");
    font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Basis Grotesque Pro";
    src: url("fonts/Basis Grotesque Pro/BasisGrotesquePro-Bold.ttf") format("truetype");
    font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Bauziet-wide";
    src: url("fonts/BAUZIET-WIDE/Bauziet Wide Light.ttf") format("truetype");
    font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Bauziet-wide";
    src: url("fonts/BAUZIET-WIDE/Bauziet Wide Regular.ttf") format("truetype");
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Bauziet-wide";
    src: url("fonts/BAUZIET-WIDE/Bauziet Wide SemiBold.ttf") format("truetype");
    font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Bauziet-wide";
    src: url("fonts/BAUZIET-WIDE/Bauziet Wide Bold.ttf") format("truetype");
    font-weight: 700; font-style: normal; font-display: swap;
}

/* === Variables Metronomi === */
:root {
    --yellow:       #FBEB33;
    --yellow-hover: #f5e01f;
    --yellow-dim:   rgba(251, 235, 51, 0.12);
    --ink:          #0d1b1e;
    --forest:       #132125;
    --forest-light: #1a2e33;
    --mist:         #EFEFEF;
    --mist-dim:     rgba(239, 239, 239, 0.5);
    --mist-muted:   rgba(239, 239, 239, 0.35);
    --border:       rgba(239, 239, 239, 0.12);
    --border-hover: rgba(251, 235, 51, 0.35);

    --font-body:    "Basis Grotesque Pro", system-ui, sans-serif;
    --font-display: "Bauziet-wide", "Basis Grotesque Pro", system-ui, sans-serif;

    --radius: 0px;
    --radius-sm: 0px;
    --shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: var(--font-body);
    background: var(--ink);
    color: var(--mist);
    min-height: 100vh;
    line-height: 1.6;
    font-weight: 300;
    letter-spacing: 0.02em;
}
a { color: var(--yellow); text-decoration: none; }
a:hover { color: var(--yellow-hover); }

/* === Layout === */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    min-height: 100vh;
    background: var(--forest);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 24px 22px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.sidebar-logo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sidebar-logo-brand {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1rem;
    color: var(--mist);
    letter-spacing: 0.04em;
    line-height: 1;
}
.sidebar-logo-sub {
    font-size: 0.7rem;
    color: var(--yellow);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-weight: 400;
}

/* Logo icon — M stylisé en jaune */
.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.sidebar nav { flex: 1; padding: 8px 0; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--mist-muted);
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    border-left: 2px solid transparent;
    transition: all 0.15s;
    text-decoration: none;
    text-transform: uppercase;
}
.sidebar nav a:hover,
.sidebar nav a.active {
    color: var(--yellow);
    background: var(--yellow-dim);
    border-left-color: var(--yellow);
}
.sidebar nav a svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
}
.sidebar-footer a {
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mist-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: color 0.15s;
}
.sidebar-footer a:hover { color: var(--yellow); }

.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 40px;
    min-width: 0;
}

/* === Page header === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}
.page-header h1 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--mist);
    letter-spacing: 0.02em;
    line-height: 1.2;
}

/* === Stats cards === */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1px;
    margin-bottom: 32px;
    background: var(--border);
    border: 1px solid var(--border);
}
.stat-card {
    background: var(--forest);
    padding: 24px;
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: transparent;
    transition: background 0.2s;
}
.stat-card.accent::after { background: var(--yellow); }
.stat-card.green::after  { background: #0fcb8f; }
.stat-card.blue::after   { background: #4cc9f0; }

.stat-card .stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--mist-muted);
    margin-bottom: 10px;
    font-weight: 400;
}
.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 300;
    color: var(--mist);
    line-height: 1;
}
.stat-card.accent .stat-value { color: var(--yellow); }
.stat-card.green .stat-value  { color: #0fcb8f; }
.stat-card.blue .stat-value   { color: #4cc9f0; }

/* === Table === */
.table-card {
    background: var(--forest);
    border: 1px solid var(--border);
    overflow: hidden;
}
.table-card table { width: 100%; border-collapse: collapse; }
.table-card th {
    background: var(--forest-light);
    padding: 12px 20px;
    text-align: left;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--mist-muted);
    border-bottom: 1px solid var(--border);
    font-weight: 400;
}
.table-card td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    vertical-align: middle;
    font-weight: 300;
}
.table-card tr:last-child td { border-bottom: none; }
.table-card tr:hover td { background: rgba(251, 235, 51, 0.03); }

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 0.68rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.badge-active   { background: rgba(15,203,143,0.1); color: #0fcb8f; border: 1px solid rgba(15,203,143,0.3); }
.badge-inactive { background: rgba(239,239,239,0.05); color: var(--mist-muted); border: 1px solid var(--border); }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border: none;
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    border-radius: 0;
}
.btn-primary {
    background: var(--yellow);
    color: var(--ink);
    border: 2px solid var(--yellow);
}
.btn-primary:hover {
    background: var(--yellow-hover);
    border-color: var(--yellow-hover);
    color: var(--ink);
    text-decoration: none;
}
.btn-ghost {
    background: transparent;
    color: var(--mist-dim);
    border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--yellow); color: var(--yellow); background: var(--yellow-dim); }
.btn-danger { background: transparent; color: var(--mist-muted); border: 1px solid var(--border); }
.btn-danger:hover { border-color: #f87171; color: #f87171; background: rgba(248,113,113,0.08); }
.btn-sm { padding: 7px 14px; font-size: 0.7rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }

/* === Forms === */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--mist-muted);
    margin-bottom: 8px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: var(--forest-light);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 12px 16px;
    color: var(--mist);
    font-size: 0.9rem;
    font-family: var(--font-body);
    font-weight: 300;
    letter-spacing: 0.02em;
    transition: border-color 0.15s;
    -webkit-appearance: none;
}
.form-group input::placeholder { color: var(--mist-muted); }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--yellow);
    background: var(--forest);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.form-hint {
    font-size: 0.75rem;
    color: var(--mist-muted);
    margin-top: 5px;
    letter-spacing: 0.02em;
}
.form-hint code {
    font-family: monospace;
    background: rgba(251,235,51,0.1);
    color: var(--yellow);
    padding: 1px 5px;
}

/* === Card === */
.card {
    background: var(--forest);
    border: 1px solid var(--border);
    padding: 28px;
    margin-bottom: 24px;
}
.card-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--mist);
    letter-spacing: 0.04em;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

/* === Alerts === */
.alert {
    padding: 14px 18px;
    font-size: 0.85rem;
    margin-bottom: 18px;
    letter-spacing: 0.02em;
    border-left: 3px solid;
}
.alert-error   { background: rgba(248,113,113,0.08); color: #f87171; border-color: #f87171; }
.alert-success { background: rgba(15,203,143,0.08); color: #0fcb8f; border-color: #0fcb8f; }

/* === Login === */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--ink);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(251,235,51,0.06) 0%, transparent 70%);
    pointer-events: none;
}
.login-box {
    background: var(--forest);
    border: 1px solid var(--border);
    padding: 48px;
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow);
}
.login-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}
.login-logo-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.login-logo-brand {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.1rem;
    color: var(--mist);
    letter-spacing: 0.04em;
    line-height: 1;
}
.login-logo-sub {
    font-size: 0.65rem;
    color: var(--yellow);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}
.login-box h1 {
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--mist-muted);
    margin-bottom: 24px;
}

/* === QR Preview === */
.qr-preview-box {
    background: var(--mist);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    position: relative;
}
.qr-preview-box canvas,
.qr-preview-box img { display: block; }
.qr-placeholder {
    text-align: center;
    color: #aaa;
    font-size: 0.82rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* === Charts container === */
.chart-container { position: relative; height: 280px; }

/* === Action buttons group === */
.actions { display: flex; gap: 4px; align-items: center; }

/* === Copy field === */
.copy-field {
    display: flex;
    gap: 6px;
    align-items: center;
}
.copy-field input {
    flex: 1;
    background: var(--forest-light);
    border: 1px solid var(--border);
    padding: 7px 10px;
    color: var(--mist-muted);
    font-size: 0.78rem;
    font-family: var(--font-body);
    cursor: text;
    border-radius: 0;
    min-width: 0;
}

/* === Progress bar (top pays) === */
.progress-bar {
    background: var(--forest-light);
    height: 3px;
    margin-top: 5px;
}
.progress-bar-fill {
    background: var(--yellow);
    height: 3px;
    transition: width 0.4s ease;
}

/* === Select style === */
select.btn-ghost {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23FBEB33' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

/* === Déco trait jaune pour les sections === */
.section-line {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.section-line::before {
    content: '';
    display: block;
    width: 24px;
    height: 2px;
    background: var(--yellow);
    flex-shrink: 0;
}

/* === Tags === */
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px 3px 10px;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--tag-color, #FBEB33) 15%, transparent);
    color: var(--tag-color, #FBEB33);
    border: 1px solid color-mix(in srgb, var(--tag-color, #FBEB33) 35%, transparent);
    cursor: default;
    white-space: nowrap;
}
.tag-chip button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.6;
    padding: 0;
    display: flex;
}
.tag-chip button:hover { opacity: 1; }

.tag-chip-mini {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tag-color, #FBEB33);
    flex-shrink: 0;
    display: inline-block;
}

/* Tag filter (dashboard) */
.tag-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 16px;
}
.tag-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--mist-muted);
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-body);
}
.tag-filter-btn:hover { border-color: var(--yellow); color: var(--yellow); }
.tag-filter-btn.active {
    background: color-mix(in srgb, var(--tag-color, #FBEB33) 15%, transparent);
    border-color: var(--tag-color, #FBEB33);
    color: var(--tag-color, #FBEB33);
}
.tag-filter-btn .tag-count {
    font-size: 0.65rem;
    opacity: 0.7;
    background: rgba(255,255,255,0.1);
    padding: 1px 5px;
    border-radius: 10px;
}

/* TagPicker input */
.tag-picker { position: relative; }
.tag-chips-selected { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; min-height: 0; }
.tag-input-wrap { position: relative; }
.tag-input {
    width: 100%;
    background: var(--forest-light);
    border: 1px solid var(--border);
    padding: 9px 14px;
    color: var(--mist);
    font-size: 0.88rem;
    font-family: var(--font-body);
    font-weight: 300;
    letter-spacing: 0.02em;
    outline: none;
    transition: border-color 0.15s;
}
.tag-input:focus { border-color: var(--yellow); }
.tag-input::placeholder { color: var(--mist-muted); }

.tag-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0; right: 0;
    background: var(--forest);
    border: 1px solid var(--border);
    z-index: 100;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.tag-dropdown-item {
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--mist);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.1s;
    border-bottom: 1px solid var(--border);
}
.tag-dropdown-item:last-child { border-bottom: none; }
.tag-dropdown-item:hover { background: var(--yellow-dim); color: var(--yellow); }
.tag-dropdown-item.tag-create { color: var(--mist-muted); font-style: italic; }
.tag-dropdown-item.tag-create:hover { color: var(--yellow); }

/* Inline tag editor dans tableau */
.inline-tag-editor { position: relative; }
.inline-tag-editor .tag-picker { min-width: 260px; }

/* === Date inputs === */
input[type="date"] {
    color-scheme: dark;
}
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.6) sepia(1) saturate(5) hue-rotate(10deg);
    cursor: pointer;
    opacity: 0.7;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* === Responsive === */

/* Tablette large (1024px) */
@media (max-width: 1024px) {
    .sidebar { width: 200px; }
    .main-content { margin-left: 200px; padding: 28px; }
}

/* Tablette (768px) — sidebar en overlay */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        min-height: auto;
        position: relative;
        flex-direction: row;
        align-items: center;
        padding: 0;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .sidebar-logo { padding: 14px 16px; border-bottom: none; margin-bottom: 0; border-right: 1px solid var(--border); }
    .sidebar nav { display: flex; flex-direction: row; overflow-x: auto; }
    .sidebar nav a {
        padding: 14px 16px;
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
        font-size: 0.78rem;
    }
    .sidebar nav a:hover,
    .sidebar nav a.active {
        border-left: none;
        border-bottom-color: var(--yellow);
    }
    .sidebar-footer { padding: 12px 16px; border-top: none; border-left: 1px solid var(--border); margin-left: auto; }

    .app-layout { flex-direction: column; }
    .main-content { margin-left: 0; padding: 20px; }
    .form-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; gap: 14px; align-items: flex-start; }
    .stats-row { grid-template-columns: 1fr 1fr; }
}

/* Mobile (480px) */
@media (max-width: 480px) {
    .main-content { padding: 14px; }
    .stats-row { grid-template-columns: 1fr; gap: 0; }
    .stat-card { padding: 18px; }
    .stat-card .stat-value { font-size: 1.8rem; }
    .table-card th, .table-card td { padding: 10px 12px; font-size: 0.8rem; }
    .card { padding: 18px; }
    .login-box { padding: 28px 20px; }
    /* Masquer colonnes secondaires sur mobile */
    .table-card .hide-mobile { display: none; }
    /* Stats 2 col dates plage en colonne */
    #stats-filter-row { flex-direction: column !important; gap: 12px !important; }
}
