/* ============================================================
   style.css — Gestion Projet
   Design : industriel-utilitaire · dark sidebar · typographie Syne + DM Sans
   ============================================================ */

/* ── Variables ─────────────────────────────────────────── */
:root {
    --bg:           #f4f3f0;
    --bg-card:      #ffffff;
    --sidebar-bg:   #111118;
    --sidebar-w:    220px;

    --text:         #1a1a2e;
    --text-muted:   #6b7280;
    --text-light:   #9ca3af;

    --accent:       #5b47e0;
    --accent-light: #ede9fe;
    --success:      #22c55e;
    --warning:      #f59e0b;
    --danger:       #ef4444;
    --danger-light: #fef2f2;

    --border:       #e5e4e0;
    --radius:       10px;
    --shadow:       0 1px 3px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.05);

    --font-display: 'Syne', sans-serif;
    --font-body:    'DM Sans', sans-serif;
    --font-mono:    'DM Mono', monospace;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    padding: 1.5rem 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.logo-icon { font-size: 1.4rem; color: var(--accent); }
.logo-text  { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; color: #fff; letter-spacing: .05em; }

.sidebar-nav { flex: 1; padding: 1rem 0; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    color: rgba(255,255,255,.45);
    font-size: .875rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all .15s;
}
.nav-item:hover  { color: rgba(255,255,255,.85); background: rgba(255,255,255,.05); }
.nav-item.active { color: #fff; border-left-color: var(--accent); background: rgba(91,71,224,.15); }
.nav-icon  { font-size: 1rem; width: 20px; text-align: center; }
.nav-label { font-family: var(--font-body); }

.sidebar-footer {
    padding: 1rem 1.25rem 0;
    border-top: 1px solid rgba(255,255,255,.07);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.user-badge  { display: flex; align-items: center; gap: 0.6rem; flex: 1; overflow: hidden; }
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: .75rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.user-info   { display: flex; flex-direction: column; overflow: hidden; }
.user-name   { color: rgba(255,255,255,.85); font-size: .8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role   { color: rgba(255,255,255,.35); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
.btn-logout  { color: rgba(255,255,255,.3); font-size: 1.1rem; transition: color .15s; cursor: pointer; }
.btn-logout:hover { color: var(--danger); }

/* ── Main ──────────────────────────────────────────────── */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 2rem 2.5rem;
    min-height: 100vh;
}

/* ── Page header ───────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}
.page-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -.02em;
}
.page-sub { color: var(--text-muted); font-size: .875rem; margin-top: .2rem; }
.header-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }

.alertes-badge {
    display: flex; align-items: center; gap: .4rem;
    background: var(--danger-light); color: var(--danger);
    font-size: .8rem; font-weight: 600;
    padding: .3rem .75rem; border-radius: 20px;
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── Alertes ───────────────────────────────────────────── */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    font-size: .875rem;
    margin-bottom: .75rem;
    border-left: 4px solid;
}
.alert-danger  { background: var(--danger-light); border-color: var(--danger); color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #92400e; }
.alert-info    { background: var(--accent-light); border-color: var(--accent); color: #3730a3; }

/* ── KPIs ──────────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.kpi-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: .4rem; }
.kpi-value { font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--text); line-height: 1; }
.kpi-unit  { font-size: 1rem; font-weight: 400; color: var(--text-muted); }
.kpi-danger { color: var(--danger) !important; }
.kpi-sub   { font-size: .8rem; color: var(--text-muted); margin-top: .3rem; }

.kpi-bar   { height: 5px; background: var(--border); border-radius: 3px; margin: .6rem 0 .3rem; overflow: hidden; }
.kpi-bar-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s; }
.kpi-bar-fill.over { background: var(--danger); }

/* ── Dashboard grid ────────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.card-full   { grid-column: 1 / -1; }
.card-danger { border-color: #fca5a5; background: var(--danger-light); }

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.card-title  { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; }
.card-link   { font-size: .8rem; color: var(--accent); font-weight: 600; }
.card-link:hover { text-decoration: underline; }

.empty-state { color: var(--text-muted); font-size: .875rem; text-align: center; padding: 1.5rem 0; }

/* ── Tâches ────────────────────────────────────────────── */
.tache-list { display: flex; flex-direction: column; gap: .5rem; }
.tache-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: .75rem 1rem;
    border-radius: 8px;
    background: var(--bg);
    border-left: 3px solid var(--border);
    gap: 1rem;
}
.tache-item.statut-en_retard { border-left-color: var(--danger); background: #fff5f5; }
.tache-item.statut-en_cours  { border-left-color: var(--warning); }
.tache-item.statut-todo      { border-left-color: #60a5fa; }

.tache-info  { display: flex; align-items: center; gap: .75rem; flex: 1; min-width: 0; }
.tache-statut-dot {
    width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
    background: var(--text-light);
}
.statut-en_cours  .tache-statut-dot { background: var(--warning); }
.statut-todo      .tache-statut-dot { background: #60a5fa; }
.statut-en_retard .tache-statut-dot { background: var(--danger); }

.tache-titre { font-size: .875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tache-meta  { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.tache-actions { display: flex; gap: .4rem; flex-shrink: 0; }

/* ── Équipe récap ──────────────────────────────────────── */
.equipe-list  { display: flex; flex-direction: column; gap: .75rem; }
.equipe-row   { display: flex; align-items: center; gap: .75rem; }
.equipe-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent-light); color: var(--accent);
    font-size: .7rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.equipe-info  { flex: 1; }
.equipe-nom   { font-size: .8rem; font-weight: 600; margin-bottom: .3rem; }
.equipe-bar   { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.equipe-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .4s; }
.equipe-bar-fill.over { background: var(--danger); }
.equipe-heures { font-family: var(--font-mono); font-size: .8rem; font-weight: 500; text-align: right; min-width: 80px; }
.equipe-quota  { color: var(--text-muted); }

/* ── Projets ───────────────────────────────────────────── */
.projets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.projet-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}
.projet-card.projet-retard { border-color: #fca5a5; background: #fff5f5; }
.projet-nom   { font-weight: 700; font-size: .9rem; margin-bottom: .4rem; }
.projet-dates { font-size: .75rem; color: var(--text-muted); margin-bottom: .75rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.projet-progress { height: 5px; background: var(--border); border-radius: 3px; margin-bottom: .5rem; overflow: hidden; }
.projet-progress-bar { height: 100%; background: var(--success); border-radius: 3px; transition: width .4s; }
.projet-stats { display: flex; justify-content: space-between; font-size: .75rem; color: var(--text-muted); }

/* ── Table ─────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
.table th, .table td { padding: .65rem .9rem; text-align: left; font-size: .85rem; border-bottom: 1px solid var(--border); }
.table th { font-weight: 700; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.table tbody tr:hover { background: var(--bg); }

.responsable-badge {
    display: inline-flex; align-items: center;
    background: var(--accent-light); color: var(--accent);
    font-size: .75rem; font-weight: 600;
    padding: .2rem .6rem; border-radius: 20px;
}

/* ── Tags ──────────────────────────────────────────────── */
.tag { display: inline-block; padding: .15rem .5rem; border-radius: 4px; font-size: .72rem; font-weight: 700; }
.tag-danger  { background: #fef2f2; color: var(--danger); }
.tag-warning { background: #fffbeb; color: var(--warning); }
.tag-success { background: #f0fdf4; color: var(--success); }
.tag-purple  { background: #f5f3ff; color: #7c3aed; }
.tag-blue    { background: #e0f2fe; color: #0891b2; }
.tag-gray    { background: #f3f4f6; color: #6b7280; }

/* Ligne inactive */
.row-inactive { opacity: .5; }

/* ── Boutons ───────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .55rem 1.1rem;
    border-radius: 7px;
    font-size: .875rem; font-weight: 600;
    cursor: pointer; border: none;
    transition: all .15s; white-space: nowrap;
}
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: #4a38c7; }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover  { background: #16a34a; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover   { background: #dc2626; }
.btn-outline  { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover  { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: .3rem .7rem; font-size: .78rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Formulaires ───────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: .4rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.form-group input,
.form-group select,
.form-group textarea,
.select-input {
    width: 100%;
    padding: .6rem .9rem;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    font-family: var(--font-body);
    font-size: .9rem;
    background: var(--bg-card);
    color: var(--text);
    transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.select-input:focus { outline: none; border-color: var(--accent); }

/* ── Login page ────────────────────────────────────────── */
.page-login { display: flex; align-items: center; justify-content: center; background: var(--sidebar-bg); }
.page-login .main { margin: 0; padding: 0; display: flex; align-items: center; justify-content: center; }
.login-wrapper { width: 100%; display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2.5rem;
    width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-card h1 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; margin-bottom: .25rem; }
.login-card h2 { font-size: 1rem; color: var(--text-muted); margin-bottom: 2rem; font-weight: 400; }

/* ── Gantt page ────────────────────────────────────────── */
.gantt-legende {
    display: flex; gap: 1.25rem; flex-wrap: wrap;
    margin-bottom: 1rem;
    font-size: .8rem; color: var(--text-muted);
}
.leg-item { display: flex; align-items: center; gap: .4rem; }
.leg-dot  { width: 10px; height: 10px; border-radius: 2px; }
.leg-arrow { font-size: 1rem; }

/* ── Couleurs texte ────────────────────────────────────── */
.text-danger  { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-muted   { color: var(--text-muted) !important; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1024px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    :root { --sidebar-w: 60px; }
    .nav-label, .logo-text, .user-info { display: none; }
    .main { padding: 1.25rem; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
}
