/* ══════════════════════════════════════════
   ESMA Tâches — Design system (orange & noir)
   ══════════════════════════════════════════ */

:root {
    --brand: #FB7E10;
    --brand-dark: #d9660a;
    --primary-gradient: linear-gradient(135deg, #FB7E10 0%, #FF9E40 100%);
    --secondary-gradient: linear-gradient(135deg, #333333 0%, #000000 100%);

    --bg-main: #f7f7f8;
    --sidebar-bg: #111111;
    --card-bg: #ffffff;

    --text-primary: #1e293b;
    --text-secondary: #64748b;

    --sidebar-width: 260px;
    --navbar-height: 68px;
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* Bootstrap : la couleur primaire devient l'orange de la marque */
    --bs-primary: #FB7E10;
    --bs-primary-rgb: 251, 126, 16;
    --bs-link-color: #d9660a;
    --bs-link-color-rgb: 217, 102, 10;
    --bs-link-hover-color: #b45309;
}

/* ── Global ── */
body {
    font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* ── Layout ── */
.wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1040;
    transition: var(--transition-smooth);
}
.sidebar-header {
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    background: rgba(255,255,255,0.03);
}
.brand-icon {
    width: 38px; height: 38px; border-radius: 10px;
    background: var(--primary-gradient); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.logo-text {
    font-weight: 700; font-size: 1.2rem; letter-spacing: -0.5px;
    background: var(--primary-gradient);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar-menu { flex-grow: 1; overflow-y: auto; padding: 1.25rem 0.75rem; }
.menu-label {
    display: block; text-transform: uppercase; font-weight: 700; font-size: 0.65rem;
    letter-spacing: 1px; color: rgba(255,255,255,0.35); padding: 0 1rem; margin-bottom: 0.4rem;
}
.sidebar .nav-link {
    color: rgba(255,255,255,0.72);
    padding: 0.7rem 1rem;
    margin: 0.15rem 0;
    border-radius: 12px;
    display: flex; align-items: center; gap: 12px;
    font-weight: 500;
    transition: var(--transition-smooth);
}
.sidebar .nav-link i { font-size: 1.1rem; }
.sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,0.08); }
.sidebar .nav-link.active {
    background: var(--primary-gradient); color: #fff;
    box-shadow: 0 8px 18px rgba(251, 126, 16, 0.3);
}
.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-backdrop { display: none; }

.main-content { flex-grow: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: var(--navbar-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 0 1.5rem;
    position: sticky; top: 0; z-index: 1020;
}
.page-content { padding: 1.5rem; flex-grow: 1; }
.app-footer {
    text-align: center; color: var(--text-secondary); font-size: 0.8rem;
    padding: 1rem; border-top: 1px solid rgba(0,0,0,0.05);
}

.search-box .input-group-text { background: #fff; border-right: 0; border-radius: 20px 0 0 20px; color: var(--text-secondary); }
.search-box .form-control { border-left: 0; border-radius: 0 20px 20px 0; padding: 0.4rem 0.8rem; min-width: 220px; }
.icon-btn { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; }

/* ── Notifications ── */
.notif-menu { width: 360px; max-width: 92vw; overflow: hidden; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 0.7rem 1rem; white-space: normal; border-bottom: 1px solid rgba(0,0,0,0.04); }
.notif-item.unread { background: rgba(251,126,16,0.07); }
.notif-icon { font-size: 1.1rem; color: var(--brand); margin-top: 2px; }
.notif-msg { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-count { font-size: 0.6rem; }

/* ── Cartes ── */
.card {
    background: var(--card-bg);
    border: 1px solid rgba(0,0,0,0.04);
    border-radius: 18px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.04);
}
.card-header { border-bottom: 1px solid rgba(0,0,0,0.05); border-radius: 18px 18px 0 0 !important; }
.card-hover { transition: var(--transition-smooth); }
.card-hover:hover { transform: translateY(-4px); box-shadow: 0 16px 36px rgba(0,0,0,0.08); }

.stat-card { padding: 1.4rem; overflow: hidden; position: relative; }
.stat-card::after {
    content: ''; position: absolute; top: -50%; right: -40%;
    width: 200px; height: 200px; background: var(--primary-gradient); opacity: 0.04; border-radius: 50%;
}
.stat-icon-wrapper {
    width: 52px; height: 52px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 0.9rem; font-size: 1.35rem; color: #fff;
}
a.stat-link { color: inherit; text-decoration: none; }

/* ── Avatars ── */
.avatar {
    width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8rem;
    background: rgba(251,126,16,0.12); color: var(--brand-dark);
}
.avatar-sm { width: 28px; height: 28px; font-size: 0.7rem; border-radius: 8px; }
.avatar-lg { width: 44px; height: 44px; font-size: 1rem; border-radius: 12px; }
.avatar-light { background: #fff; color: var(--brand); width: 38px; height: 38px; }

/* ── Tableaux ── */
.table { margin-bottom: 0; }
.table thead th {
    background: rgba(0,0,0,0.025);
    font-weight: 600; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.8px;
    color: var(--text-secondary);
    padding: 0.85rem 1rem; border: none; white-space: nowrap;
}
.table tbody td { padding: 0.85rem 1rem; vertical-align: middle; border-bottom: 1px solid rgba(0,0,0,0.04); }
tr.task-late td:first-child { box-shadow: inset 4px 0 0 #dc3545; }
tr.task-done .task-title { text-decoration: line-through; color: var(--text-secondary) !important; }

.status-select { min-width: 130px; font-size: 0.8rem; border-radius: 20px; padding: 0.25rem 2rem 0.25rem 0.75rem; }

/* ── Boutons & champs ── */
.btn-primary {
    background: var(--primary-gradient) !important;
    border: none !important;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 8px 18px rgba(251, 126, 16, 0.22);
}
.btn-primary:hover, .btn-primary:focus { filter: brightness(1.05); box-shadow: 0 12px 24px rgba(251, 126, 16, 0.3); }
.btn-primary:disabled { opacity: .65; }
.btn-outline-primary { border-color: var(--brand) !important; color: var(--brand) !important; }
.btn-outline-primary:hover { background-color: var(--brand) !important; color: #fff !important; }
.btn-link { color: var(--brand-dark); }

.form-control, .form-select { border-radius: 12px; border-color: rgba(0,0,0,0.12); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(251, 126, 16, 0.12); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-range::-webkit-slider-thumb { background: var(--brand); }
.form-range::-moz-range-thumb { background: var(--brand); }

/* ── Couleurs ── */
.text-primary { color: var(--brand) !important; }
.bg-primary { background-color: var(--brand) !important; }
.progress-bar.bg-primary { background: var(--primary-gradient) !important; }
.badge { padding: 0.45em 0.85em; border-radius: 100px; font-weight: 600; }
.bg-warning { color: #3b2a00 !important; }

/* ── Commentaires & fichiers ── */
.comment { scroll-margin-top: 90px; }
.comment-body { background: #f8fafc; border-radius: 4px 14px 14px 14px; padding: 0.7rem 0.9rem; }
.comment.mine .comment-body { background: rgba(251,126,16,0.08); }
.mention { color: var(--brand-dark); font-weight: 600; }
.file-item { border: 1px solid rgba(0,0,0,0.07); border-radius: 12px; padding: 0.6rem 0.75rem; }
.file-item:hover { background: #fafafa; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 0.9rem 1.2rem; border-left: 2px solid rgba(0,0,0,0.07); }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.timeline li:last-child { padding-bottom: 0; }

/* ── Divers ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-secondary); }
.empty-state i { font-size: 3rem; opacity: .3; display: block; margin-bottom: .75rem; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.filter-chip { border-radius: 20px; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn 0.35s ease both; }

/* ── Responsive ── */
@media (max-width: 991.98px) {
    .sidebar { position: fixed; left: calc(-1 * var(--sidebar-width)); top: 0; }
    .sidebar.show { left: 0; box-shadow: 10px 0 40px rgba(0,0,0,0.3); }
    .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1030; }
    .topbar { padding: 0 0.75rem; }
    .page-content { padding: 1rem; }
}

/* ── Authentification ── */
.auth-wrapper {
    min-height: 100vh;
    background: #111 url('../img/login-bg.jpg') no-repeat center center fixed;
    background-size: cover;
    position: relative;
    padding: 1.5rem 0;
}
.auth-wrapper::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.35) 100%);
}
.auth-wrapper > * { position: relative; z-index: 1; }
.auth-wrapper .card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.4);
    border-radius: 24px;
}
.auth-flash { position: fixed !important; top: 1.5rem; right: 1.5rem; z-index: 9999 !important; min-width: 320px; max-width: 90vw; }

/* ── Impression ── */
@media print {
    .sidebar, .topbar, .app-footer, .no-print, .sidebar-backdrop { display: none !important; }
    .page-content { padding: 0; }
    body { background: #fff; }
    .card { box-shadow: none; border: 0; }
}

/* ── Kanban ── */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 1rem; overflow-x: auto; padding-bottom: .5rem; align-items: start; }
.kanban-col { background: #efeff1; border-radius: 16px; padding: .75rem; min-height: 200px; }
.kanban-col-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: .9rem; padding: .25rem .35rem .75rem; }
.kanban-list { min-height: 120px; display: flex; flex-direction: column; gap: .6rem; border-radius: 12px; transition: background .15s; }
.kanban-list.drop-target { background: rgba(251,126,16,0.10); outline: 2px dashed rgba(251,126,16,0.5); outline-offset: 2px; }
.kanban-card { background: #fff; border-radius: 12px; padding: .75rem .85rem; box-shadow: 0 2px 6px rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.04); cursor: grab; transition: box-shadow .15s, transform .15s, opacity .15s; }
.kanban-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,0.08); }
.kanban-card.dragging { opacity: .45; transform: rotate(2deg); }
.kanban-card.saving { opacity: .6; }
.kanban-card.locked { cursor: default; }
.kanban-card.is-late { border-left: 4px solid #dc3545; }
.kanban-col[data-status="done"] .kanban-title { text-decoration: line-through; color: var(--text-secondary); }
.kanban-title { font-weight: 600; color: var(--text-primary); text-decoration: none; line-height: 1.3; }
.kanban-title:hover { color: var(--brand-dark); }
.kanban-card .badge { font-size: .65rem; padding: .35em .7em; }
.kanban-empty { text-align: center; color: #9ca3af; font-size: .85rem; padding: 1.5rem 0; border: 2px dashed #dcdce0; border-radius: 12px; }
@media (max-width: 991.98px) { .kanban { grid-template-columns: repeat(4, 80vw); scroll-snap-type: x mandatory; } .kanban-col { scroll-snap-align: start; } }
