/* ============================================================
   SercomPro — Design System
   Police : Inter (Google Fonts)
   Thème : Sombre par défaut
   ============================================================ */

/* --- Variables CSS --- */
:root {
    --police: 'Inter', system-ui, -apple-system, sans-serif;
    --bg-primaire: #f5f7f9;
    --bg-carte: #ffffff;
    --bg-input: #ffffff;
    --bordure: #e2e8f0;
    --bordure-focus: #007EFE;
    
    --texte-primaire: #111827;
    --texte-secondaire: #4b5563;
    --texte-muted: #6b7280;
    
    --sidebar-bg: #19324A;
    --sidebar-texte: #ffffff;
    --sidebar-lien: #ffffff;
    --sidebar-lien-hover: #ffffff;
    --header-bg: #ffffff;
    
    --accent: #007EFE;
    --accent-hover: #0056b3;
    --accent-bg: rgba(0, 126, 254, 0.1);
    
    --succes: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    --sidebar-w: 260px;
    --sidebar-w-reduit: 72px;
    --header-h: auto;
    --rayon: 12px;
    --rayon-sm: 8px;
    --ombre: 0 4px 20px rgba(0,0,0,0.03);
    --ombre-sm: 0 2px 8px rgba(0,0,0,0.02);
    --transition: 0.2s ease;

    /* Couleurs statuts prospect */
    --statut-a-contacter: #FF1D8D;
    --statut-a-relancer: #F0AD4E;
    --statut-rdv: #28A745;
    --statut-email: #6C757D;
    --statut-interet-fort: #1E7E34;
    --statut-interet-moyen: #4DCC55;
    --statut-interet-faible: #9BC53D;
    --statut-non-interesse: #DC3545;
    --statut-plus-interesse: #5BC0DE;
    --statut-client: #A4243B;
    --statut-cloture: #7F00FF;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--police);
    background: var(--bg-primaire);
    color: var(--texte-primaire);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* --- Layout Principal --- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: none;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: width 0.3s ease, transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}
.sidebar::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}
.sidebar-logo {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.sidebar-logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
}
.sidebar-logo .logo-icone {
    display: none; /* Masqué selon le design souhaité où le logo est texte/image simple */
}
.sidebar-nav { flex: 1; padding: 16px 0 16px 12px; }
.sidebar-section { margin-bottom: 8px; }
.sidebar-section-titre {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    padding: 8px 12px 4px;
    font-weight: 600;
}
.sidebar-lien {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-radius: var(--rayon-sm);
    color: var(--sidebar-lien);
    font-size: 1rem;
    font-weight: 600;
    transition: all var(--transition);
    position: relative;
    margin-bottom: 2px;
    margin-right: 12px;
}
.sidebar-lien:hover {
    background: rgba(255,255,255,0.1);
    color: var(--sidebar-lien-hover);
}
.sidebar-lien.actif {
    background: var(--accent);
    color: #ffffff;
    margin-right: 0;
    border-radius: var(--rayon-sm) 0 0 var(--rayon-sm);
}
.sidebar-lien.actif::before {
    display: none;
}
.sidebar-lien i {
    font-size: 1.25rem;
    flex-shrink: 0;
    opacity: 0.8;
    color: inherit;
}
.sidebar-lien.actif i { opacity: 1; color: #ffffff; }

.sidebar-sous-menu {
    padding-left: 20px;
}
.sidebar-sous-menu .sidebar-lien {
    font-size: 0.85rem;
    padding: 8px 12px;
}

.sidebar-profil {
    padding: 16px;
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--sidebar-lien);
    font-size: 0.8rem;
}
.sidebar-profil-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 0.9rem;
    flex-shrink: 0;
}
.sidebar-profil-info {
    overflow: hidden;
}
.sidebar-profil-nom {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--sidebar-texte);
}
.sidebar-profil-role {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
}

/* --- Contenu Principal --- */
.contenu-principal {
    flex: 1;
    margin-left: var(--sidebar-w);
    transition: margin-left 0.3s ease;
    min-width: 0;
}

/* --- Header --- */
.header-top {
    height: var(--header-h);
    background: var(--header-bg);
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-titre {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--texte-primaire);
    letter-spacing: -0.5px;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}
.btn-menu-mobile {
    display: none;
    background: none;
    border: none;
    color: var(--texte-primaire);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
}

/* --- Zone de contenu --- */
.page-contenu {
    padding: 16px 32px 32px 32px;
    max-width: 1400px;
}

/* --- Cartes --- */
.carte {
    background: var(--bg-carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    padding: 24px;
    box-shadow: var(--ombre);
    transition: transform var(--transition), box-shadow var(--transition);
}
.carte:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}
.carte-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.carte-titre {
    font-size: 1rem;
    color: var(--texte-primaire);
    font-weight: 600;
}
.carte-valeur {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--texte-primaire);
    margin: 8px 0;
}
.carte-icone {
    width: 48px; height: 48px;
    border-radius: var(--rayon-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    color: var(--accent);
    background: var(--accent-bg);
}

/* Grille de cartes statistiques */
.grille-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

/* --- Boutons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--rayon-sm);
    font-family: var(--police);
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}
.btn-primaire {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 126, 254, 0.2);
}
.btn-primaire:hover {
    background: var(--accent-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 126, 254, 0.3);
}
.btn-secondaire {
    background: #ffffff;
    color: var(--texte-primaire);
    border: 1px solid var(--bordure);
    box-shadow: var(--ombre-sm);
}
.btn-secondaire:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}
.btn-danger {
    background: #fee2e2;
    color: #ef4444;
}
.btn-danger:hover {
    background: #fecaca;
    color: #dc2626;
}
.btn-warning {
    background: #fef3c7;
    color: #d97706;
}
.btn-warning:hover {
    background: #fde68a;
}
.btn-succes {
    background: #d1fae5;
    color: #059669;
}
.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}
.btn-icone {
    padding: 8px;
    border-radius: var(--rayon-sm);
    background: transparent;
    border: none;
    color: var(--texte-secondaire);
    cursor: pointer;
    transition: all var(--transition);
}
.btn-icone:hover {
    color: var(--accent);
    background: rgba(0,0,0,0.05);
}

/* --- Formulaires --- */
.form-groupe {
    margin-bottom: 20px;
}
.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--texte-secondaire);
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon-sm);
    color: var(--texte-primaire);
    font-family: var(--police);
    font-size: 0.9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--bordure-focus);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-control::placeholder {
    color: var(--texte-muted);
}
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
textarea.form-control {
    resize: vertical;
    min-height: 100px;
}
.form-grille {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0 24px;
}
.form-erreur {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 4px;
}
.champ-mot-de-passe {
    position: relative;
}
.champ-mot-de-passe .btn-oeil {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--texte-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 1.1rem;
}

/* --- Tableaux --- */
.tableau-conteneur {
    background: var(--bg-carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    overflow: hidden;
    overflow-x: auto;
    box-shadow: var(--ombre);
}
.tableau-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--bordure);
    flex-wrap: nowrap;
    gap: 12px;
}
.barre-filtres {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 20px !important;
    width: 100% !important;
}
.filtre-groupe {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex: 1;
}
.filtre-groupe label {
    white-space: nowrap !important;
    margin-bottom: 0 !important;
    display: inline-block !important;
    width: auto !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    color: var(--texte-secondaire) !important;
}
.filtre-groupe .form-control {
    flex: 1 !important;
    width: auto !important;
    height: 38px !important;
}
.barre-filtres .btn-actions {
    display: flex !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
}
.page-stats-recap {
    margin-bottom: 24px;
    color: var(--texte-muted);
    font-size: 0.95rem;
    font-weight: 500;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}
.tableau-recherche {
    max-width: 300px;
}
.tableau {
    width: 100%;
    border-collapse: collapse;
}
.tableau th {
    padding: 16px 20px;
    text-align: left;
    font-size: 0.85rem;
    color: var(--texte-muted);
    font-weight: 500;
    background: transparent;
    border-bottom: 2px solid #f3f4f6;
    white-space: nowrap;
}
.tableau td {
    padding: 16px 20px;
    font-size: 0.9rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
    color: var(--texte-primaire);
}
.tableau tr:last-child td {
    border-bottom: none;
}
.tableau tr:hover td {
    background: #f9fafb;
}
.tableau-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-top: 1px solid var(--bordure);
    font-size: 0.85rem;
    color: var(--texte-secondaire);
}

/* --- Badges statut --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}
.badge::before {
    display: none;
}
.badge-a-contacter    { background: rgba(255,29,141,0.12); color: #FF1D8D; }
.badge-retard         { background: #fee2e2; color: #ef4444; }
.badge-imminent       { background: #fef3c7; color: #d97706; }
.badge-proche         { background: #ffedd5; color: #f97316; }

.ligne-retard         { background-color: #fef2f2 !important; }
.ligne-imminent       { background-color: #fffbeb !important; }

.texte-retard         { color: #ef4444 !important; font-weight: 600 !important; }
.texte-imminent       { color: #d97706 !important; font-weight: 600 !important; }
.texte-proche         { color: #f97316 !important; font-weight: 600 !important; }
.badge-a-relancer     { background: rgba(240,173,78,0.12); color: #F0AD4E; }
.badge-rdv            { background: rgba(40,167,69,0.12); color: #28A745; }
.badge-email          { background: rgba(108,117,125,0.12); color: #9ca3af; }
.badge-interet-fort   { background: rgba(30,126,52,0.12); color: #1E7E34; }
.badge-interet-moyen  { background: rgba(77,204,85,0.12); color: #4DCC55; }
.badge-interet-faible { background: rgba(155,197,61,0.12); color: #9BC53D; }
.badge-non-interesse  { background: rgba(220,53,69,0.12); color: #DC3545; }
.badge-plus-interesse { background: rgba(91,192,222,0.12); color: #5BC0DE; }
.badge-client         { background: rgba(164,36,59,0.12); color: #e85d75; }
.badge-cloture        { background: rgba(127,0,255,0.12); color: #a855f7; }

/* --- Alertes flash --- */
.alerte {
    padding: 14px 20px;
    border-radius: var(--rayon-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: glisserBas 0.3s ease;
}
.alerte-succes  { background: rgba(34,197,94,0.12); color: #4ade80; border-left: 3px solid var(--succes); }
.alerte-danger  { background: rgba(239,68,68,0.12); color: #f87171; border-left: 3px solid var(--danger); }
.alerte-warning { background: rgba(245,158,11,0.12); color: #fbbf24; border-left: 3px solid var(--warning); }
.alerte-info    { background: rgba(59,130,246,0.12); color: #60a5fa; border-left: 3px solid var(--info); }

@keyframes glisserBas {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fonduEntree 0.2s ease;
}
.modal-overlay.actif { display: flex; }
.modal {
    background: var(--bg-carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--ombre);
    animation: modalEntree 0.3s ease;
}
.modal-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--bordure);
}
.modal-titre { font-size: 1.1rem; font-weight: 700; }
.modal-fermer {
    background: none; border: none;
    color: var(--texte-muted); font-size: 1.5rem;
    cursor: pointer; padding: 4px; line-height: 1;
}
.modal-corps { padding: 24px; }
.modal-pied {
    display: flex; gap: 12px; justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--bordure);
}

@keyframes fonduEntree { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalEntree { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* --- Vide state --- */
.etat-vide {
    text-align: center;
    padding: 60px 24px;
    color: var(--texte-muted);
}
.etat-vide-icone {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.4;
}
.etat-vide-titre {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--texte-secondaire);
    margin-bottom: 8px;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.ouverte {
        transform: translateX(0);
    }
    .contenu-principal {
        margin-left: 0;
    }
    .btn-menu-mobile {
        display: block;
    }
}

@media (max-width: 768px) {
    .page-contenu { padding: 16px; }
    .grille-stats { grid-template-columns: 1fr 1fr; gap: 12px; }
    .form-grille { grid-template-columns: 1fr; }
    .tableau-conteneur { overflow-x: auto; }
    .header-top { padding: 0 16px; }
}

@media (max-width: 480px) {
    .grille-stats { grid-template-columns: 1fr; }
}

/* --- Modaux détails prospect --- */
.mb-20 { margin-bottom: 20px; }
.badge-statut-dynamique {
    padding: 6px 12px;
    font-weight: 700;
    border-radius: 6px;
    text-transform: uppercase;
    color: white;
}
.table-details-prospect {
    width: 100%;
    border: none;
    box-shadow: none;
}
.table-details-prospect td {
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}
.table-details-prospect .td-label {
    width: 35%;
    color: var(--texte-muted);
    font-weight: 500;
}
.table-details-prospect .td-valeur {
    font-weight: 600;
}
.table-details-prospect .td-valeur-normale {
    font-weight: 500;
}
.table-details-prospect .td-observation {
    color: #475569;
    font-style: italic;
    line-height: 1.5;
}


