/* ── Reset & base ───────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f4f6f9;
    color: #2c3e50;
    min-height: 100vh;
}

/* ── Navbar ─────────────────────────────────────────────── */
.navbar {
    background: #2c3e50;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.nav-brand {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    text-decoration: none;
}

.nav-links a {
    color: #bdc3c7;
    text-decoration: none;
    margin-left: 1.5rem;
    font-size: 0.95rem;
}

.nav-links a:hover { color: #fff; }

/* ── Main content ───────────────────────────────────────── */
.main-content {
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.alert-error { background: #fdecea; color: #c0392b; border-left: 4px solid #e74c3c; }
.alert-success { background: #eafaf1; color: #1e8449; border-left: 4px solid #2ecc71; }

/* ── Login ──────────────────────────────────────────────── */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-box {
    background: #fff;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.login-box h1 { font-size: 1.8rem; margin-bottom: 0.25rem; }
.login-subtitle { color: #7f8c8d; margin-bottom: 2rem; font-size: 0.95rem; }

/* ── Formulaires ────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.4rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

/* ── Boutons ────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}

.btn:hover { opacity: 0.85; }
.btn-primary { background: #3498db; color: #fff; }
.btn-full { width: 100%; text-align: center; }

/* ── Page header ────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-header h2 { font-size: 1.5rem; }

/* ── Icons (Tabler) ─────────────────────────────────────────── */
@import url('https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@latest/tabler-icons.min.css');

/* ── Header actions ─────────────────────────────────────────── */
.header-actions { display: flex; gap: 8px; }

.btn-secondary {
    background: #fff;
    color: #2c3e50;
    border: 1px solid #ddd;
}

/* ── Tri ────────────────────────────────────────────────────── */
.tri-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    color: #7f8c8d;
    flex-wrap: wrap;
}

.tri-pill {
    padding: 3px 12px;
    border-radius: 20px;
    border: 1px solid #ddd;
    color: #555;
    text-decoration: none;
    font-size: 0.82rem;
    transition: all 0.2s;
}

.tri-pill:hover { border-color: #3498db; color: #3498db; }
.tri-pill.active { background: #2c3e50; color: #fff; border-color: #2c3e50; }

/* ── Liste des tâches ───────────────────────────────────────── */
.tache-liste { display: flex; flex-direction: column; gap: 8px; }

.tache-ligne {
    background: #fff;
    border: 1px solid #e8ecef;
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: box-shadow 0.2s;
}

.tache-ligne:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.tache-info { flex: 1; min-width: 0; }

.tache-titre {
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tache-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.badge-categorie {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 20px;
}

.meta-item {
    font-size: 0.78rem;
    color: #95a5a6;
    display: flex;
    align-items: center;
    gap: 3px;
}

.tache-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Statuts ────────────────────────────────────────────────── */
.statut-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.statut-a-faire { background: #eafaf1; color: #1e8449; }
.statut-en-cours { background: #fef9e7; color: #b7950b; }

/* ── Boutons icône ──────────────────────────────────────────── */
.btn-icone {
    background: none;
    border: none;
    cursor: pointer;
    color: #bdc3c7;
    font-size: 1.1rem;
    padding: 4px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s;
}

.btn-icone:hover { color: #2c3e50; }

/* ── Liste vide ─────────────────────────────────────────────── */
.liste-vide {
    text-align: center;
    padding: 3rem 1rem;
    color: #bdc3c7;
}

.liste-vide p { margin-top: 1rem; font-size: 0.95rem; }
.liste-vide a { color: #3498db; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.actif {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.modal-header h3 { font-size: 1.1rem; font-weight: 600; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.required { color: #e74c3c; }

@media (max-width: 480px) {
    .form-row { grid-template-columns: 1fr; }
    .header-actions .btn span { display: none; }
}

/* ── Detail layout ──────────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 720px) {
    .detail-grid { grid-template-columns: 1fr; }
}

.card {
    background: #fff;
    border: 1px solid #e8ecef;
    border-radius: 10px;
    padding: 1.25rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.card-header h3 { font-size: 1rem; font-weight: 600; }

/* ── Temps ──────────────────────────────────────────────────── */
.temps-resume {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.temps-bloc {
    flex: 1;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
}

.temps-label {
    display: block;
    font-size: 0.75rem;
    color: #7f8c8d;
    margin-bottom: 4px;
}

.temps-valeur {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e50;
}

/* ── Créneaux ───────────────────────────────────────────────── */
.creneaux-liste {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.creneau-ligne {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    padding: 6px 8px;
    background: #f8f9fa;
    border-radius: 6px;
}

.creneau-heure { color: #555; }
.creneau-duree { font-weight: 600; color: #2c3e50; }

/* ── Statut terminée ────────────────────────────────────────── */
.statut-terminee { background: #eaf0fb; color: #1a5276; }

/* ── Bouton danger ──────────────────────────────────────────── */
.btn-danger { background: #e74c3c; color: #fff; }

/* ── Catégories ─────────────────────────────────────────────── */
.table-cats {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table-cats th {
    text-align: left;
    padding: 8px 12px;
    color: #7f8c8d;
    font-size: 0.78rem;
    font-weight: 600;
    border-bottom: 1px solid #f0f0f0;
}

.table-cats td {
    padding: 10px 12px;
    border-bottom: 1px solid #f8f9fa;
    vertical-align: middle;
}

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

.couleur-dot {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
}

.cat-nom { font-weight: 500; }
.cat-nb { color: #7f8c8d; }

.couleur-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.preset-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.preset-dot:hover { border-color: #2c3e50; }

/* ── Récapitulatif ──────────────────────────────────────────── */
.recap-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #2c3e50;
}

.recap-titre { font-size: 1.2rem; font-weight: 600; }
.recap-total { font-size: 1rem; color: #2c3e50; }

.recap-liste { display: flex; flex-direction: column; gap: 1rem; }

.recap-tache {
    background: #fff;
    border: 1px solid #e8ecef;
    border-radius: 8px;
    overflow: hidden;
}

.recap-tache-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f8f9fa;
    border-bottom: 1px solid #e8ecef;
}

.recap-tache-titre { font-weight: 600; font-size: 0.95rem; }

.recap-creneaux {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.recap-creneaux tr { border-bottom: 1px solid #f0f0f0; }
.recap-creneaux tr:last-child { border-bottom: none; }
.recap-creneaux td { padding: 7px 14px; }

.cr-debut, .cr-fin { color: #555; width: 60px; }
.cr-sep { color: #bdc3c7; width: 20px; text-align: center; }
.cr-duree { text-align: right; font-weight: 500; color: #2c3e50; }

/* ── Print ──────────────────────────────────────────────────── */
.print-only { display: none; }

@media print {
    .no-print { display: none !important; }
    .print-only { display: block; }
    .navbar { display: none; }
    .main-content { margin: 0; padding: 0; max-width: 100%; }
    body { background: #fff; }
    .recap-tache { break-inside: avoid; border: 1px solid #ccc; }
}

/* ── Agenda ─────────────────────────────────────────────────── */
.agenda-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 720px) {
    .agenda-layout { grid-template-columns: 1fr; }
    .agenda-calendrier { display: none; }
}

/* Backlog */
.agenda-backlog {
    background: #fff;
    border: 1px solid #e8ecef;
    border-radius: 10px;
    overflow: hidden;
    position: sticky;
    top: 1rem;
}

.backlog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f8f9fa;
    border-bottom: 1px solid #e8ecef;
}

.backlog-header h3 { font-size: 0.9rem; font-weight: 600; }

.backlog-count {
    background: #2c3e50;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

.backlog-liste {
    padding: 8px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.backlog-vide {
    font-size: 0.8rem;
    color: #bdc3c7;
    text-align: center;
    padding: 1rem 0;
}

/* Tâche agenda */
.agenda-tache {
    background: #f0f4f8;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: grab;
    border: 1px solid #e0e6ed;
    transition: opacity 0.2s;
}

.agenda-tache:active { cursor: grabbing; opacity: 0.6; }
.agenda-tache-planifiee { background: #eaf4fb; border-color: #b8d9f0; }

.agenda-tache-titre {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.agenda-tache-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.agenda-tache-echeance {
    font-size: 0.7rem;
    color: #7f8c8d;
    flex-shrink: 0;
}

.btn-planifier, .btn-retirer {
    background: none;
    border: none;
    cursor: pointer;
    color: #bdc3c7;
    font-size: 0.85rem;
    padding: 0 2px;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.btn-planifier:hover { color: #3498db; }
.btn-retirer:hover { color: #e74c3c; }

/* Calendrier */
.agenda-calendrier {
    background: #fff;
    border: 1px solid #e8ecef;
    border-radius: 10px;
    overflow: hidden;
}

.agenda-cols-header {
    display: grid;
    grid-template-columns: 60px 1fr 1fr;
    background: #f8f9fa;
    border-bottom: 1px solid #e8ecef;
}

.agenda-periode-label {
    padding: 8px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #7f8c8d;
    border-left: 1px solid #e8ecef;
    text-align: center;
}

.agenda-ligne {
    display: grid;
    grid-template-columns: 60px 1fr 1fr;
    border-bottom: 1px solid #f0f0f0;
    min-height: 44px;
}

.agenda-ligne:last-child { border-bottom: none; }
.agenda-ligne.weekend { background: #fdfaf6; }

.agenda-jour-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    border-right: 1px solid #e8ecef;
}

.agenda-jour-nom {
    font-size: 0.65rem;
    color: #7f8c8d;
    text-transform: uppercase;
}

.agenda-jour-num {
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e50;
}

.weekend .agenda-jour-num { color: #95a5a6; }

.agenda-creneau {
    padding: 4px 6px;
    border-left: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-height: 44px;
}

.agenda-creneau.drag-over {
    background: #eaf4fb;
    border-color: #3498db;
}

/* ── Chrono actif dans la liste ─────────────────────────────── */
.tache-ligne.chrono-actif {
    border-left: 3px solid #e74c3c;
    background: #fff9f9;
}

.btn-chrono-actif {
    color: #e74c3c !important;
    animation: pulse 1.5s infinite;
}

.btn-chrono-has-time { color: #3498db !important; }

.temps-liste {
    font-size: 0.78rem;
    font-weight: 600;
    color: #7f8c8d;
    min-width: 36px;
    text-align: right;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── Statut dropdown ────────────────────────────────────────── */
.statut-dropdown {
    position: relative;
    display: inline-block;
}

.statut-btn {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.statut-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 50;
    min-width: 130px;
    overflow: hidden;
}

.statut-dropdown:focus-within .statut-menu {
    display: block;
}

.statut-option {
    display: block;
    width: 100%;
    padding: 8px 14px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    color: #2c3e50;
    transition: background 0.15s;
}

.statut-option:hover { background: #f4f6f9; }
.statut-option.active { font-weight: 600; }
.statut-option-terminee { color: #1a5276; }

/* ── Meta échéance ──────────────────────────────────────────── */
.meta-echeance { color: #e67e22 !important; }

/* ── Titre tâche cliquable ──────────────────────────────────── */
.titre-lien {
    color: inherit;
    text-decoration: none;
}
.titre-lien:hover {
    color: #3498db;
    text-decoration: underline;
}

/* ── Total estimé dans l'agenda ─────────────────────────────── */
.agenda-total-estime {
    font-size: 0.68rem;
    color: #7f8c8d;
    text-align: right;
    padding: 2px 2px 0;
    margin-top: auto;
    border-top: 1px dashed #e0e6ed;
}
