/* ═══════════════════════════════════════════════════════════════
   style.css — CRM Showheel · Feuille de style commune
   Pages : login.php · index.php · admin.php
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
    --blue:          #496DA6;
    --blue-d:        #345488;
    --blue-pale:     #eff6ff;
    --navy:          #1a2332;
    --navy-light:    #22304a;
    --gray-bg:       #f0f2f5;
    --border:        #e5e7eb;
    --text:          #111827;
    --text-muted:    #6b7280;
    --sidebar-w:     240px;
    --sidebar-col-w: 62px;     /* largeur rétractée */
    --topbar-h:      57px;
    --radius-card:   6px;
    --radius-btn:    8px;
    --shadow-card:   0 1px 4px rgba(0,0,0,.08);
    --shadow-modal:  0 20px 60px rgba(0,0,0,.25);
    --transition:    .15s ease;
}

/* ── Reset global ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    font-family: 'Outfit', sans-serif;
    background: var(--gray-bg);
}
body {
    background: radial-gradient(circle at top right, #c4e7d3, #05fff3b8 50%), 
    radial-gradient(circle at bottom left, #1f3f9e, #d300ff 50%);
    
    min-height: 100vh;
}


/* ════════════════════════════════════════════════════════════
   SIDEBAR RÉTRACTABLE
   ════════════════════════════════════════════════════════════ */

#sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-w); height: 100vh;
    background: var(--navy);
    display: flex; flex-direction: column;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(0,0,0,.18);
    transition: width .22s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}

/* ── Logo / en-tête sidebar ─────────────────────────────────── */
.sb-logo {
    display: block; align-items: center; gap: 10px;
    padding: 22px 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    position: relative;
}
.sb-logo-img{
    width: 100%;
    background: transparent ;
    display: block; 
}
.sb-logo-img img{max-width: 100%;}
.sb-logo-icon svg { width: 18px; color: #fff; }
.sb-logo-texts { display: block; float: right; }
.sb-logo-text { font-size: 17px; font-weight: 700; color: #fff; letter-spacing: -.3px; white-space: nowrap; }
.sb-logo-sub  { font-size: 10.5px; color: rgba(255,255,255,.4); white-space: nowrap; float: right;}

/* Bouton toggle (chevron) */
.sb-toggle {
    position: absolute; right: 0px; top: 0 ;
    width: 26px; height: 26px;
    background: rgba(255,255,255,.08); border: none; border-radius: 0 0 0 7px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,.5); transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}
.sb-toggle:hover { background: rgba(255,255,255,.15); color: #fff; }
.sb-toggle svg { width: 14px; transition: transform .22s cubic-bezier(.4,0,.2,1); }

/* ── Navigation ─────────────────────────────────────────────── */
.sb-nav { padding: 16px 10px; flex: 1; overflow-y: auto; overflow-x: hidden; }
.sb-section {
    font-size: 10px; font-weight: 600;
    color: rgba(255,255,255,.3); letter-spacing: .08em;
    text-transform: uppercase; padding: 10px 8px 6px;
    white-space: nowrap; overflow: hidden;
    transition: opacity var(--transition);
}
.sb-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 9px;
    font-size: 14px; font-weight: 500;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    margin-bottom: 2px;
    cursor: pointer; border: none; background: none;
    width: 100%; text-align: left;
    white-space: nowrap;
    overflow: hidden;
}
.sb-link:hover  { background: rgba(255,255,255,.08); color: #fff; }
.sb-link.active { background: var(--blue); color: #fff; }
.sb-link svg    { width: 18px; flex-shrink: 0; opacity: .8; transition: opacity var(--transition); }
.sb-link.active svg { opacity: 1; }
.sb-link-label  { transition: opacity var(--transition); }

/* ── Pied de sidebar (user) ─────────────────────────────────── */
.sb-user {
    padding: 14px 14px;
    border-top: 1px solid rgba(255,255,255,.07);
    display: flex; align-items: center; gap: 10px;
    flex-shrink: 0;
    overflow: hidden;
}
.sb-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--blue);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sb-user-info { overflow: hidden; }
.sb-user-name { font-size: 13.5px; font-weight: 600; color: #fff; white-space: nowrap; }
.sb-user-role { font-size: 11px; color: rgba(255,255,255,.4); white-space: nowrap; }
.sb-logout {
    margin-left: auto;
    color: rgba(255,255,255,.35); cursor: pointer;
    background: none; border: none; padding: 4px; border-radius: 6px;
    transition: color var(--transition); flex-shrink: 0;
}
.sb-logout:hover { color: #ef4444; }

/* ── Tooltip (visible quand sidebar rétractée) ──────────────── */
.sb-link { position: relative; }
.sb-tooltip {
    display: none;
    position: absolute; left: calc(var(--sidebar-col-w) + 4px); top: 50%;
    transform: translateY(-50%);
    background: var(--navy-light); color: #fff;
    font-size: 12.5px; font-weight: 600;
    padding: 5px 10px; border-radius: 7px;
    white-space: nowrap; pointer-events: none; z-index: 500;
    box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
.sb-tooltip::before {
    content: ''; position: absolute; left: -6px; top: 50%; transform: translateY(-50%);
    border: 6px solid transparent; border-right-color: var(--navy-light); border-left: 0;
}


/* ══ Mode RÉTRACTÉ ══════════════════════════════════════════════
   Ajoutez la classe .sidebar-collapsed sur <body>
   ══════════════════════════════════════════════════════════════ */
.sidebar-collapsed #sidebar { width: var(--sidebar-col-w); }

/* Chevron inversé */
.sidebar-collapsed .sb-toggle svg { transform: rotate(180deg); }

/* Masquer les textes */
.sidebar-collapsed .sb-logo-texts  { opacity: 0; pointer-events: none; width: 0; overflow: hidden; }
.sidebar-collapsed .sb-section     { opacity: 0; height: 0; padding: 0; overflow: hidden; }
.sidebar-collapsed .sb-link-label  { opacity: 0; width: 0; overflow: hidden; }
.sidebar-collapsed .sb-link        { justify-content: center; }
.sidebar-collapsed .sb-user-info   { opacity: 0; pointer-events: none; width: 0; overflow: hidden; }
.sidebar-collapsed .sb-logout      { margin-left: 0; }

/* Afficher les tooltips */
.sidebar-collapsed .sb-link:hover .sb-tooltip { display: block; }

/* Décaler le contenu principal */
#main { margin-left: var(--sidebar-w); transition: margin-left .22s cubic-bezier(.4,0,.2,1); }
.sidebar-collapsed #main { margin-left: var(--sidebar-col-w); }


/* ════════════════════════════════════════════════════════════
   TOPBAR
   ════════════════════════════════════════════════════════════ */
#topbar {
    background: #fff;
    padding: 0 28px;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 14px;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
    box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.topbar-title { font-size: 17px; font-weight: 700; color: var(--text); flex: 1; }
/* ════════════════════════════════════════════════════════════
   TOOLPBAR
   ════════════════════════════════════════════════════════════ */
#toolbar {
    background: #fff;
    padding: 0 28px;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 14px;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
    box-shadow: 0 1px 6px rgba(0,0,0,.05);
}


/* ════════════════════════════════════════════════════════════
   BOUTONS
   ════════════════════════════════════════════════════════════ */
.btn {
    padding: 8px 16px; border-radius: var(--radius-btn);
    font-size: 13.5px; font-weight: 600; font-family: 'Outfit', sans-serif;
    cursor: pointer; border: none;
    transition: background var(--transition), transform .1s;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--blue); color: #fff; }
.btn-primary:hover  { background: var(--blue-d); }
.btn-secondary { background: #f3f4f6; color: #374151; border: 1.5px solid var(--border); }
.btn-secondary:hover { background: #e9ebee; }
.btn-danger    { background: #fff0f0; color: #ef4444; border: 1.5px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-icon {
    width: 34px; height: 34px; padding: 0;
    background: #f3f4f6; color: var(--text-muted); border-radius: 8px;
    justify-content: center;
}
.btn-icon:hover { background: var(--border); }


/* ════════════════════════════════════════════════════════════
   FORMULAIRES
   ════════════════════════════════════════════════════════════ */
.form-control {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 9px; padding: 10px 12px;
    font-size: 14px; font-family: 'Outfit', sans-serif;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: #f9fafb; color: var(--text);
}
.form-control:focus {
    border-color: var(--blue);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(8,102,255,.10);
}
textarea.form-control { min-height: 90px; resize: vertical; }
select.form-control   { cursor: pointer; }

.form-label {
    display: block; font-size: 13px; font-weight: 600;
    color: #374151; margin-bottom: 6px;
}
.form-group { margin-bottom: 16px; }
.form-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.span2 { grid-column: 1 / -1; }

/* Champ de recherche topbar */
#search-input {
    border: 1.5px solid var(--border); border-radius: 9px;
    padding: 8px 14px; font-size: 14px; font-family: 'Outfit', sans-serif;
    outline: none; width: 220px;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: #f9fafb;
}
#search-input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(8,102,255,.10);
}


/* ════════════════════════════════════════════════════════════
   CARTES / SECTIONS
   ════════════════════════════════════════════════════════════ */
.page-content { padding: 24px 28px; }

.card {
    background: #fff; border-radius: var(--radius-card);
    border: 1.5px solid var(--border);
    overflow: hidden; margin-bottom: 24px;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text); }
.card-body  { padding: 20px; }

/* Stat card (admin) */
.stat-card {
    background: #fff; border-radius: 12px;
    border: 1.5px solid var(--border); padding: 18px 20px;
}
.stat-val { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-lbl { font-size: 13px; color: var(--text-muted); margin-top: 2px; }


/* ════════════════════════════════════════════════════════════
   TABLEAU (admin)
   ════════════════════════════════════════════════════════════ */
table { width: 100%; border-collapse: collapse; }
th {
    padding: 10px 14px; font-size: 12px; font-weight: 600;
    color: var(--text-muted); text-align: left;
    border-bottom: 1.5px solid #f0f0f0;
}
td {
    padding: 11px 14px; font-size: 13.5px; color: #374151;
    border-bottom: 1px solid #f7f7f7; vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }


/* ════════════════════════════════════════════════════════════
   BADGES
   ════════════════════════════════════════════════════════════ */
.badge {
    display: inline-flex; align-items: center;
    padding: 2px 9px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
}
.badge-admin    { background: #eff6ff; color: #2563eb; }
.badge-vendeur  { background: #f0fdf4; color: #16a34a; }
.badge-inactive { background: #fff7ed; color: #ea580c; }
.badge-status {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
}


/* ════════════════════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════════════════════ */
.modal-overlay, #modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 200;
    align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open, #modal-overlay.open { display: flex; }

.modal, #modal {
    background: #fff; border-radius: 18px;
    width: 100%; max-width: 520px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-modal);
    animation: modal-in .2s ease;
}
#modal { max-width: 580px; }

@keyframes modal-in {
    from { opacity: 0; transform: scale(.93) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 20px 24px 15px;
    border-bottom: 1px solid #f0f0f0;
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); flex: 1; }
.modal-close {
    width: 34px; height: 34px; border-radius: 8px;
    background: #f3f4f6; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: var(--text-muted);
    transition: background var(--transition); flex-shrink: 0;
}
.modal-close:hover { background: var(--border); }
.modal-body   { padding: 18px 24px 22px; }
.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid #f0f0f0;
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
}


/* ════════════════════════════════════════════════════════════
   TOAST
   ════════════════════════════════════════════════════════════ */
#toast-container {
    position: fixed; bottom: 24px; right: 24px;
    z-index: 999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
    background: var(--navy); color: #fff;
    padding: 12px 18px; border-radius: 10px;
    font-size: 13.5px; font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
    animation: toast-in .25s ease;
    max-width: 290px;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}
.toast.success { border-left: 4px solid #16a34a; }
.toast.error   { border-left: 4px solid #ef4444; }


/* ════════════════════════════════════════════════════════════
   KANBAN (index.php)
   ════════════════════════════════════════════════════════════ */
#main {
    min-height: 100vh;
    display: flex; flex-direction: column;
}

#kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    padding: 22px 24px;
    flex: 1;
}
.kanban-col {
    display: flex; flex-direction: column;
    border-radius: var(--radius-card);
    overflow: hidden;
    min-height: calc(100vh - 160px);
}
.col-header {
    padding: 13px 15px 11px;
    display: flex; align-items: center; gap: 8px;
}
.col-icon  { font-size: 13px; }
.col-title { font-size: 13.5px; font-weight: 700; flex: 1; }
.col-count {
    background: rgba(0,0,0,.08); border-radius: 20px;
    font-size: 12px; font-weight: 600; padding: 2px 8px;
}
.col-body {
    flex: 1; padding: 8px 10px 10px; overflow-y: auto;
}
.col-body.drag-over {
    background: rgba(8,102,255,.04);
    border: 2px dashed var(--blue); border-radius: 10px;
}

/* Lead cards */
.lead-card {
    background: #fff; border-radius: 11px;
    padding: 13px 13px 11px; margin-bottom: 9px;
    box-shadow: var(--shadow-card);
    cursor: pointer; transition: box-shadow var(--transition), transform .1s;
    position: relative; border: 1.5px solid transparent;
    user-select: none;
}
.drag-handle {
    position: absolute; top: 8px; right: 8px;
    cursor: grab; color: #d1d5db; font-size: 16px;
    line-height: 1; user-select: none; padding: 2px 4px;
    transition: color var(--transition);
    z-index: 10;
}
.drag-handle:active {
    cursor: grabbing;
}
.drag-handle:hover { color: #9ca3af; }
.lead-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.12);
    transform: translateY(-2px); border-color: #e0e0e0;
}
.lead-card.sortable-ghost   { opacity: .4; background: #e8f0fe; }
.lead-card.sortable-chosen  {
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    transform: rotate(1.5deg) scale(1.02); cursor: grabbing;
}
.card-name  { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.card-email { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta  { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-phone {
    font-size: 12px; color: #374151;
    background: #f3f4f6; border-radius: 6px; padding: 2px 7px;
}
.card-assigned { font-size: 11.5px; color: var(--text-muted); margin-left: auto; }

/* Rappel */
.reminder-badge {
    position: absolute; top: 9px; right: 30px;
    font-size: 13px; line-height: 1;
    animation: bell-shake .5s ease infinite alternate;
}
@keyframes bell-shake {
    from { transform: rotate(-8deg); }
    to   { transform: rotate(8deg); }
}

/* Pastille catégorie sur la carte */
.card-cat-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px; border-radius: 20px; border: 1px solid;
    font-size: 11.5px; font-weight: 600; margin-bottom: 6px;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-cat-badge > span {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}

/* Boutons filtre catégorie dans la topbar */
.cat-filter-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 11px; border-radius: 20px; border: 1.5px solid #e5e7eb;
    background: #fff; font-size: 12.5px; font-weight: 600; font-family: 'Outfit', sans-serif;
    cursor: pointer; color: #374151;
    transition: border-color .15s, background .15s, color .15s;
    white-space: nowrap;
}
.cat-filter-btn:hover {
    border-color: var(--cat-color);
    color: var(--cat-color);
    background: color-mix(in srgb, var(--cat-color) 8%, #fff);
}
.cat-filter-btn.active {
    background: color-mix(in srgb, var(--cat-color) 15%, #fff);
    border-color: var(--cat-color);
    color: var(--cat-color);
}
.cat-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

/* Bouton ajout rapide */
.add-card-btn {
    width: 100%; padding: 9px;
    background: none; border: 1.5px dashed #d1d5db;
    border-radius: 10px; color: #9ca3af;
    font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all var(--transition);
    font-family: 'Outfit', sans-serif;
}
.add-card-btn:hover {
    border-color: var(--blue); color: var(--blue); background: var(--blue-pale);
}

/* Activité (log dans modal) */
.activity-list { margin-top: 6px; }
.activity-item {
    padding: 8px 0; border-bottom: 1px solid #f3f4f6;
    font-size: 12.5px; color: var(--text-muted);
    display: flex; gap: 8px;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--blue); margin-top: 4px; flex-shrink: 0;
}
/* Container du Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px; width: 14px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider { background-color: #0866FF; }
input:checked + .slider:before { transform: translateX(18px); }

/* ════════════════════════════════════════════════════════════
   PAGE LOGIN
   ════════════════════════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--gray-bg);
}
.login-card {
    background: #fff; border-radius: 16px;
    box-shadow: 0 4px 40px rgba(0,0,0,.10);
    padding: 46px 40px 38px;
    width: 100%; max-width: 420px;
}
.logo-mark {
    width: 52px; height: 52px;
    background: var(--blue); border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
}
.logo-mark svg { width: 28px; color: #fff; }
.login-title {
    text-align: center; font-size: 22px; font-weight: 700;
    color: var(--text); margin-bottom: 4px;
}
.login-sub {
    text-align: center; font-size: 14px; color: var(--text-muted);
    margin-bottom: 26px;
}

/* Champs login (légèrement différents du form-control standard) */
.login-card input[type=text],
.login-card input[type=password] {
    width: 100%; border: 1.5px solid #dde0e6; border-radius: 10px;
    padding: 12px 14px; font-size: 15px; font-family: 'Outfit', sans-serif;
    outline: none; background: #f8f9fb; color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.login-card input[type=text]:focus,
.login-card input[type=password]:focus {
    border-color: var(--blue); background: #fff;
    box-shadow: 0 0 0 3px rgba(8,102,255,.12);
}
.login-card label {
    font-size: 13.5px; font-weight: 500; color: #374151;
    display: block; margin-bottom: 6px;
}
.login-field { margin-bottom: 16px; }
.remember-row { margin-top: 14px; }
.remember-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 13.5px; color: #6b7280; cursor: pointer;
    user-select: none; font-weight: 400;
}
.remember-label input[type="checkbox"] {
    width: 16px; height: 16px; cursor: pointer;
    accent-color: var(--blue); flex-shrink: 0;
}
.btn-login {
    width: 100%; background: var(--blue); color: #fff;
    border: none; border-radius: 10px; padding: 13px;
    font-size: 15px; font-weight: 600; font-family: 'Outfit', sans-serif;
    cursor: pointer; margin-top: 22px;
    transition: background var(--transition), transform .1s;
}
.btn-login:hover  { background: var(--blue-d); }
.btn-login:active { transform: scale(.98); }

.alert-error {
    background: #fff0f0; border: 1.5px solid #fccfcf;
    color: #b91c1c; border-radius: 10px;
    padding: 12px 14px; font-size: 14px; margin-bottom: 18px;
}
.login-footer {
    text-align: center; font-size: 12.5px; color: #9ca3af; margin-top: 22px;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — Remplace entièrement l'ancien bloc @media
   Coller à la fin de style.css (supprimer les anciens @media)
   ════════════════════════════════════════════════════════════ */

/* ── Bouton hamburger (visible mobile uniquement) ─────────── */
#sidebar-toggle-mobile {
    display: none;
    background: none; border: none;
    cursor: pointer; padding: 6px;
    color: var(--text); border-radius: 8px;
    transition: background var(--transition);
}
#sidebar-toggle-mobile:hover { background: #f3f4f6; }
#sidebar-toggle-mobile svg   { width: 22px; display: block; }

/* ── Overlay derrière la sidebar mobile ───────────────────── */
#sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99;
}
#sidebar-backdrop.open { display: block; }


/* ════ TABLETTE (≤ 900px) ═══════════════════════════════════ */
@media (max-width: 1024px) {

    /* Sidebar rétractée par défaut */
    #sidebar { width: var(--sidebar-col-w); }
    #main    { margin-left: var(--sidebar-col-w); }
    .sb-toggle svg { transform: rotate(180deg); }

    /* Kanban 2 colonnes */
    #kanban-board { grid-template-columns: repeat(2, 1fr); }

    /* Topbar : cacher le compteur de résumé calendrier */
    .cal-header > span:last-child { display: none; }
}


/* ════ MOBILE (≤ 600px) ══════════════════════════════════════ */
@media (max-width: 600px) {

    /* ── SIDEBAR : drawer ─────────────────────────────────── */

    /* Toutes variantes de body class → sidebar cachée à gauche */
    #sidebar,
    .sidebar-collapsed #sidebar {
        width: var(--sidebar-w) !important;
        transform: translateX(-100%);
        transition: transform .25s cubic-bezier(.4,0,.2,1);
        z-index: 200;
    }

    /* Ouverture drawer (avec ou sans .sidebar-collapsed) */
    body.sidebar-open #sidebar,
    body.sidebar-open.sidebar-collapsed #sidebar {
        transform: translateX(0) !important;
    }
    body.sidebar-open #sidebar-backdrop {
        display: block;
    }

    /* Annuler tout margin-left quelle que soit la classe */
    #main,
    .sidebar-collapsed #main {
        margin-left: 0 !important;
    }

    /* ── TOPBAR : hamburger visible ───────────────────────── */
    #topbar { padding: 0 12px; gap: 8px; }
    #sidebar-toggle-mobile { display: flex; }
    .topbar-title { font-size: 14px; }

    /* Cacher "Synchroniser" sur mobile, garder "Nouvel événement" */
    #topbar .btn-secondary:first-of-type { display: none; }

    /* ── KANBAN : vue liste ───────────────────────────────── */
    #kanban-board {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 12px 10px;
    }

    .kanban-col {
        min-height: unset;
        border-radius: 0;
        overflow: visible;
        margin-bottom: 20px;
    }

    .col-header {
        position: sticky;
        top: var(--topbar-h);
        z-index: 10;
        border-radius: 10px;
        margin: 6px 0 2px;
        cursor: pointer;
        box-shadow: 0 1px 4px rgba(0,0,0,.08);
    }

    .lead-card {
        border-radius: 8px;
        padding: 10px 12px 9px;
        margin-bottom: 6px;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    .lead-card:hover { transform: none; }
    .lead-card > *:not(.drag-handle) { pointer-events: none; }

    .card-name  { font-size: 13.5px; margin-bottom: 1px; }
    .card-email { font-size: 11px; margin-bottom: 0; }
    .card-meta  { gap: 4px; }
    .card-phone { font-size: 11px; padding: 1px 5px; }
    .card-assigned { font-size: 10.5px; }

    .add-card-btn { margin-bottom: 10px; }

    /* ── PAGE CONTENT ─────────────────────────────────────── */
    .page-content { padding: 12px 10px; }
    .form-grid    { grid-template-columns: 1fr; }

    .card { overflow-x: auto; }
    table { min-width: 520px; }

    /* ── CALENDRIER ───────────────────────────────────────── */
    .cal-wrap { padding: 12px 10px; }

    .cal-header {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 12px;
    }
    .cal-nav { width: 100%; justify-content: center; }
    .cal-month-title { font-size: 16px; min-width: 160px; }
    .cal-today-btn { font-size: 12px; padding: 5px 10px; }

    .cal-grid { border-radius: 10px; }

    .cal-dow { font-size: 9px; padding: 7px 0; letter-spacing: 0; }

    .cal-day { min-height: 52px; padding: 5px 3px 3px; cursor: pointer; }

    .cal-day-num { font-size: 11px; width: 20px; height: 20px; margin-bottom: 2px; }
    .cal-day.is-today .cal-day-num { width: 20px; height: 20px; font-size: 11px; }

    /* Pills : pastille colorée uniquement */
    .cal-pill {
        font-size: 0; padding: 0;
        width: 8px; height: 8px;
        border-radius: 50%; margin-bottom: 2px;
        display: inline-block; vertical-align: middle;
    }
    .cal-pill-dot { display: none; }

    .cal-pill.ev-blue     { background: #1d4ed8; }
    .cal-pill.ev-green    { background: #15803d; }
    .cal-pill.ev-orange   { background: #c2410c; }
    .cal-pill.ev-purple   { background: #7c3aed; }
    .cal-pill.ev-red      { background: #b91c1c; }
    .cal-pill.ev-gray     { background: #374151; }
    .cal-pill.ev-reminder { background: #b45309; }

    .cal-more { font-size: 9px; padding: 1px 2px; }

    .cal-legend {
        display: grid; grid-template-columns: 1fr 1fr;
        gap: 6px 14px; margin-top: 10px;
    }
    .legend-item { font-size: 11.5px; }

    /* Modals : bottom sheet */
    .modal-overlay, #modal-overlay { align-items: flex-end; padding: 0; }
    .modal, #modal, .modal.day-modal, .modal.ev-modal {
        border-radius: 18px 18px 0 0;
        max-width: 100%; max-height: 85vh;
    }

    /* ── TOAST ────────────────────────────────────────────── */
    #toast-container { bottom: 12px; right: 10px; left: 10px; }
    .toast { max-width: 100%; }

    /* ── Recherche topbar ─────────────────────────────────── */
    #search-input { width: 130px; font-size: 13px; }

    /* ── Filtre catégories ────────────────────────────────── */
    #filter-categories { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
    .cat-filter-btn { font-size: 11.5px; padding: 4px 9px; }
}