/* ============================================================
   TransitPro — app.css
   Thème salle de contrôle : navy profond + accents ambre
   Police : DM Mono (chiffres) + DM Sans (texte)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

/* ── Variables globales ────────────────────────────────────── */
:root {
    /* Couleurs primaires */
    --tp-navy-950:  #060d1a;
    --tp-navy-900:  #0d1b2e;
    --tp-navy-800:  #132440;
    --tp-navy-700:  #1b3158;
    --tp-navy-600:  #1e3a6e;
    --tp-navy-500:  #254d8f;

    /* Accents ambre */
    --tp-amber-400: #fbbf24;
    --tp-amber-500: #f59e0b;
    --tp-amber-600: #d97706;

    /* Accents statut */
    --tp-green:  #22c55e;
    --tp-red:    #ef4444;
    --tp-orange: #f97316;
    --tp-blue:   #3b82f6;

    /* Texte */
    --tp-text-primary:   #e2e8f0;
    --tp-text-secondary: #94a3b8;
    --tp-text-muted:     #475569;

    /* Bordures */
    --tp-border:       rgba(255,255,255,0.07);
    --tp-border-light: rgba(255,255,255,0.12);

    /* Typographie */
    --tp-font-body: 'DM Sans', system-ui, sans-serif;
    --tp-font-mono: 'DM Mono', 'Fira Code', monospace;
}

[data-theme="light"] {
    --tp-navy-950:  #f4f7fb;
    --tp-navy-900:  #ffffff;
    --tp-navy-800:  #edf2f7;
    --tp-navy-700:  #d7e0ec;
    --tp-navy-600:  #b7c5d8;
    --tp-navy-500:  #8ea4bf;

    --tp-text-primary:   #102033;
    --tp-text-secondary: #42556f;
    --tp-text-muted:     #708399;

    --tp-border:       rgba(16,32,51,0.10);
    --tp-border-light: rgba(16,32,51,0.16);
}

/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--tp-navy-950);
    color: var(--tp-text-primary);
    font-family: var(--tp-font-body);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── Layout principal ─────────────────────────────────────── */
.tp-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.tp-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--tp-navy-950);
}

.tp-page-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--tp-navy-700) transparent;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.tp-sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--tp-navy-900);
    border-right: 1px solid var(--tp-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tp-sidebar-logo {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--tp-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tp-logo-mark {
    width: 32px;
    height: 32px;
    background: var(--tp-amber-500);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    color: var(--tp-navy-950);
    font-family: var(--tp-font-mono);
    flex-shrink: 0;
}

.tp-logo-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--tp-text-primary);
    letter-spacing: -0.01em;
}

.tp-logo-text span {
    color: var(--tp-amber-500);
}

.tp-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
}

.tp-nav-section {
    padding: 0 0.75rem;
    margin-bottom: 0.25rem;
}

.tp-nav-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--tp-text-muted);
    padding: 0.75rem 0.75rem 0.35rem;
}

.tp-nav-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    color: var(--tp-text-secondary);
    font-size: 13.5px;
    font-weight: 400;
    transition: all 0.15s;
    margin-bottom: 1px;
    border: 1px solid transparent;
}

.tp-nav-item:hover {
    background: var(--tp-navy-800);
    color: var(--tp-text-primary);
}

.tp-nav-item.active {
    background: rgba(245, 158, 11, 0.12);
    color: var(--tp-amber-400);
    border-color: rgba(245, 158, 11, 0.2);
    font-weight: 500;
}

.tp-nav-item .nav-icon {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    flex-shrink: 0;
}

.tp-nav-item.active .nav-icon { opacity: 1; }

.tp-nav-badge {
    margin-left: auto;
    background: var(--tp-red);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    font-family: var(--tp-font-mono);
}

/* ── Topbar ───────────────────────────────────────────────── */
.tp-topbar {
    height: 52px;
    min-height: 52px;
    background: var(--tp-navy-900);
    border-bottom: 1px solid var(--tp-border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
}

.tp-topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--tp-text-primary);
    flex: 1;
    letter-spacing: -0.01em;
}

.tp-topbar-clock {
    font-family: var(--tp-font-mono);
    font-size: 13px;
    color: var(--tp-text-secondary);
    letter-spacing: 0.05em;
}

.tp-topbar-tenant {
    font-size: 12px;
    color: var(--tp-text-muted);
    padding: 3px 10px;
    background: var(--tp-navy-800);
    border-radius: 4px;
    border: 1px solid var(--tp-border);
}

/* ── Cartes stat ──────────────────────────────────────────── */
.tp-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tp-stat-card {
    background: var(--tp-navy-900);
    border: 1px solid var(--tp-border);
    border-radius: 10px;
    padding: 1.125rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: border-color 0.2s;
    position: relative;
    overflow: hidden;
}

.tp-stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--tp-accent, transparent);
    opacity: 0.8;
}

.tp-stat-card:hover { border-color: var(--tp-border-light); }

.tp-stat-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tp-text-muted);
}

.tp-stat-value {
    font-family: var(--tp-font-mono);
    font-size: 28px;
    font-weight: 500;
    color: var(--tp-text-primary);
    line-height: 1;
    letter-spacing: -0.02em;
}

.tp-stat-sub {
    font-size: 11.5px;
    color: var(--tp-text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tp-stat-sub.up   { color: var(--tp-green); }
.tp-stat-sub.down { color: var(--tp-red); }
.tp-stat-sub.warn { color: var(--tp-orange); }

/* ── Panneaux & sections ──────────────────────────────────── */
.tp-panel {
    background: var(--tp-navy-900);
    border: 1px solid var(--tp-border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.tp-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--tp-border);
    background: var(--tp-navy-900);
}

.tp-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--tp-text-primary);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tp-panel-title .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tp-amber-500);
}

.tp-panel-body { padding: 0; }

/* ── Table dispatches ─────────────────────────────────────── */
.tp-dispatch-table {
    width: 100%;
    border-collapse: collapse;
}

.tp-dispatch-table th {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--tp-text-muted);
    padding: 0.625rem 1.25rem;
    text-align: left;
    background: var(--tp-navy-950);
    border-bottom: 1px solid var(--tp-border);
}

.tp-dispatch-table td {
    padding: 0.75rem 1.25rem;
    font-size: 13px;
    color: var(--tp-text-secondary);
    border-bottom: 1px solid var(--tp-border);
    vertical-align: middle;
}

.tp-dispatch-table tr:last-child td { border-bottom: none; }

.tp-dispatch-table tbody tr {
    transition: background 0.1s;
    cursor: pointer;
}

.tp-dispatch-table tbody tr:hover {
    background: var(--tp-navy-800);
}

.tp-dispatch-table tbody tr:hover td { color: var(--tp-text-primary); }

.tp-dispatch-number {
    font-family: var(--tp-font-mono);
    font-size: 12px;
    color: var(--tp-amber-400);
    font-weight: 500;
}

.tp-dispatch-title {
    font-weight: 500;
    color: var(--tp-text-primary);
    font-size: 13px;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tp-dispatch-time {
    font-family: var(--tp-font-mono);
    font-size: 12px;
    letter-spacing: 0.03em;
}

/* ── Badges statut ────────────────────────────────────────── */
.tp-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.tp-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.tp-badge-assigned   { background: rgba(34,197,94,0.12);  color: #4ade80; }
.tp-badge-unassigned { background: rgba(249,115,22,0.12); color: #fb923c; }
.tp-badge-inprogress { background: rgba(59,130,246,0.12); color: #60a5fa; }
.tp-badge-completed  { background: rgba(148,163,184,0.1); color: #94a3b8; }
.tp-badge-cancelled  { background: rgba(239,68,68,0.1);   color: #f87171; }
.tp-badge-confirmed  { background: rgba(34,197,94,0.12);  color: #4ade80; }
.tp-badge-pending    { background: rgba(251,191,36,0.12); color: #fbbf24; }

/* ── Alertes ──────────────────────────────────────────────── */
.tp-alert-list { display: flex; flex-direction: column; }

.tp-alert-item {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--tp-border);
    transition: background 0.1s;
    cursor: pointer;
}

.tp-alert-item:last-child { border-bottom: none; }
.tp-alert-item:hover { background: var(--tp-navy-800); }

.tp-alert-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.tp-alert-icon.critical { background: rgba(239,68,68,0.15); color: #f87171; }
.tp-alert-icon.warning  { background: rgba(249,115,22,0.15); color: #fb923c; }
.tp-alert-icon.info     { background: rgba(59,130,246,0.15); color: #60a5fa; }

.tp-alert-content { flex: 1; min-width: 0; }

.tp-alert-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--tp-text-primary);
    margin-bottom: 2px;
}

.tp-alert-desc {
    font-size: 12px;
    color: var(--tp-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tp-alert-time {
    font-family: var(--tp-font-mono);
    font-size: 11px;
    color: var(--tp-text-muted);
    white-space: nowrap;
    padding-top: 2px;
}

/* ── Boutons ──────────────────────────────────────────────── */
.tp-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.875rem;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

.tp-btn-primary {
    background: var(--tp-amber-500);
    color: var(--tp-navy-950);
    border-color: var(--tp-amber-500);
}
.tp-btn-primary:hover { background: var(--tp-amber-400); }

.tp-btn-ghost {
    background: transparent;
    color: var(--tp-text-secondary);
    border-color: var(--tp-border-light);
}
.tp-btn-ghost:hover {
    background: var(--tp-navy-800);
    color: var(--tp-text-primary);
}

.tp-btn-danger {
    background: rgba(239,68,68,0.1);
    color: #f87171;
    border-color: rgba(239,68,68,0.2);
}
.tp-btn-danger:hover { background: rgba(239,68,68,0.2); }

/* ── Grille 2 colonnes ────────────────────────────────────── */
.tp-grid-2 {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1rem;
}

@media (max-width: 1200px) {
    .tp-grid-2 { grid-template-columns: 1fr; }
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--tp-navy-700);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--tp-navy-600); }

/* ── Utilitaires ──────────────────────────────────────────── */
.mono { font-family: var(--tp-font-mono); }
.text-muted { color: var(--tp-text-muted); }
.text-secondary { color: var(--tp-text-secondary); }
.text-amber { color: var(--tp-amber-400); }
.text-green { color: var(--tp-green); }
.text-red   { color: var(--tp-red); }
.text-orange { color: var(--tp-orange); }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.ml-auto { margin-left: auto; }
