/* ==========================================================================
   CE CRM — Feuille de style principale
   Complète Bootstrap 5.3, RGAA accessible, responsive
   ========================================================================== */

/* ── Variables ─────────────────────────────────────────── */
:root {
    --crm-sidebar-width: 0px; /* Pas de sidebar fixe, navbar top */
    --crm-navbar-height: 56px;
    --crm-primary: #0d6efd;
    --crm-bg: #f8f9fc;
    --crm-border: #dee2e6;
    --crm-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* ── Layout global ─────────────────────────────────────── */
body.crm-body {
    background-color: var(--crm-bg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: .9rem;
    color: #212529;
}

.crm-navbar {
    background: #fff;
    border-bottom: 1px solid var(--crm-border);
    box-shadow: var(--crm-shadow);
    min-height: var(--crm-navbar-height);
}

.crm-main {
    min-height: calc(100vh - var(--crm-navbar-height) - 40px);
    padding-bottom: 50px;
}

.crm-footer {
    background: #fff;
    border-top: 1px solid var(--crm-border);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1020;
}

/* ── RGAA — Lien d'évitement ───────────────────────────── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--crm-primary);
    color: #fff;
    padding: .5rem 1rem;
    z-index: 9999;
    text-decoration: none;
    border-radius: 0 0 .25rem 0;
}
.skip-link:focus {
    top: 0;
}

/* ── Avatars ───────────────────────────────────────────── */
.avatar-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--crm-primary), #6610f2);
    color: #fff;
    font-weight: 600;
    font-size: .85rem;
    flex-shrink: 0;
    user-select: none;
}
.avatar-circle.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: .7rem;
}
.avatar-circle.avatar-xl {
    width: 72px;
    height: 72px;
    font-size: 1.5rem;
}

/* ── KPI Cards ─────────────────────────────────────────── */
.kpi-card {
    transition: transform .15s, box-shadow .15s;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.12) !important;
}
.kpi-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── Canaux de contact (icônes dans les tableaux) ──────── */
.channel-icon {
    font-size: 1rem;
    line-height: 1;
    transition: transform .15s;
}
.channel-icon:hover {
    transform: scale(1.2);
}

/* ── Timeline (fiche contact) ──────────────────────────── */
.timeline {
    position: relative;
}
.timeline-item {
    position: relative;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 28px;
    bottom: 0;
    width: 2px;
    background: var(--crm-border);
}
.timeline-item:last-child::before {
    display: none;
}
.timeline-icon {
    flex-shrink: 0;
    z-index: 1;
}

/* ── Kanban ────────────────────────────────────────────── */
.kanban-board::-webkit-scrollbar { height: 6px; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--crm-border); border-radius: 3px; }

.kanban-card {
    cursor: grab;
    transition: box-shadow .15s, transform .1s;
    border-radius: .5rem !important;
}
.kanban-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.12) !important;
}
.kanban-card-ghost {
    opacity: .4;
    background: #e9ecef;
}
.kanban-card.sortable-chosen {
    cursor: grabbing;
    transform: rotate(1deg);
    box-shadow: 0 8px 20px rgba(0,0,0,.15) !important;
}

.kanban-col-header {
    font-size: .85rem;
}

/* ── Taille de texte utilitaire ────────────────────────── */
.xsmall { font-size: .75rem; }

/* ── Bouton extra-small ─────────────────────────────────── */
.btn-xs {
    padding: .15rem .4rem;
    font-size: .75rem;
    line-height: 1.4;
    border-radius: .2rem;
}

/* ── Boutons de suppression (modal confirm) ─────────────── */
.btn-delete, .btn-tag-delete { cursor: pointer; }

/* ── Auth page ─────────────────────────────────────────── */
body.auth-body {
    background: linear-gradient(135deg, #0d6efd22, #6610f222), var(--crm-bg);
}

/* ── Breadcrumb compact ─────────────────────────────────── */
.breadcrumb-sm {
    font-size: .8rem;
    margin-bottom: 0;
    background: none;
    padding: 0;
}

/* ── Focus visible (RGAA) ──────────────────────────────── */
:focus-visible {
    outline: 3px solid #fd7e14;
    outline-offset: 2px;
}
.btn:focus-visible,
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 3px rgba(253,126,20,.35);
}

/* ── Navigation mobile (bottom bar) ───────────────────── */
.crm-mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: #fff;
    border-top: 1px solid var(--crm-border);
    box-shadow: 0 -2px 8px rgba(0,0,0,.08);
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 60px;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.crm-mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 1;
    text-decoration: none;
    color: #6c757d;
    font-size: .65rem;
    padding: 4px 0;
    border: none;
    background: none;
    cursor: pointer;
    transition: color .15s;
}
.crm-mobile-nav-item i {
    font-size: 1.15rem;
}
.crm-mobile-nav-item.active,
.crm-mobile-nav-item:hover {
    color: var(--crm-primary);
}
.crm-mobile-nav-item.active span {
    font-weight: 600;
}

/* Bouton central FAB (+) */
.crm-mobile-nav-fab {
    flex: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--crm-primary);
    color: #fff !important;
    margin-top: -18px;
    box-shadow: 0 2px 8px rgba(13,110,253,.35);
    display: flex;
    align-items: center;
    justify-content: center;
}
.crm-mobile-nav-fab i {
    font-size: 1.3rem;
}
.crm-mobile-nav-fab span {
    display: none;
}
.crm-mobile-nav-fab:hover {
    color: #fff !important;
    background: #0b5ed7;
}

/* Padding bottom du contenu principal en mobile pour la bottom nav */
@media (max-width: 991.98px) {
    .crm-main {
        padding-bottom: 80px;
    }
}

/* ── Responsive tables ─────────────────────────────────── */
@media (max-width: 576px) {
    .table-responsive table td,
    .table-responsive table th {
        padding-left: .5rem;
        padding-right: .5rem;
    }
}

/* ── Couleur des badges de statut (assure contraste RGAA) ─ */
.bg-warning { color: #000 !important; }
.bg-info    { color: #000 !important; }

/* ── Contraste RGAA — liens, texte muted et boutons ────── */
a { color: #0b5ed7; }
a:hover { color: #084298; }
.text-muted { color: #495057 !important; }
.btn-outline-secondary {
    color: #495057;
    border-color: #6c757d;
}
.btn-outline-secondary:hover {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}
.crm-footer .btn-link.text-muted { color: #495057 !important; }
.crm-footer .btn-link.text-muted:hover { color: #212529 !important; }

/* ── Bannière cookies ─────────────────────────────────── */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #1e293b;
    box-shadow: 0 -2px 10px rgba(0,0,0,.2);
}

/* ── Landing — Hero ───────────────────────────────────── */
.landing-hero {
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    padding: 3rem 0;
}

/* ── Landing — Feature cards ──────────────────────────── */
.feature-card {
    transition: transform .2s, box-shadow .2s;
    border-radius: .75rem !important;
}
.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,.12) !important;
}
.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(13,110,253,.1);
    margin: 0 auto;
}

/* ── Landing — CTA section ────────────────────────────── */
.cta-section {
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    color: #fff;
}
