/* =====================================================================
   LinkMania — surcouche de modernisation UI (back-office)
   Chargée APRÈS sb-admin-2 + style.css : n'ajoute que des raffinements
   visuels (couleurs, typographie, ombres, arrondis, espacements), sans
   toucher à la structure des pages.
   ===================================================================== */

:root {
    --lm-primary: #4f46e5;         /* indigo moderne */
    --lm-primary-dark: #4338ca;
    --lm-primary-soft: #eef2ff;
    --lm-accent: #06b6d4;
    --lm-ink: #1e2333;
    --lm-muted: #6b7280;
    --lm-bg: #f5f6fb;
    --lm-card: #ffffff;
    --lm-line: #e9ebf3;
    --lm-radius: 14px;
    --lm-radius-sm: 10px;
    --lm-shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
    --lm-shadow-sm: 0 1px 2px rgba(16,24,40,.06);
    --lm-success: #16a34a;
    --lm-danger: #e11d48;
    --lm-warning: #d97706;
}

/* ---------- Base ---------- */
body {
    background-color: var(--lm-bg);
    color: var(--lm-ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.005em;
}
#content-wrapper { background-color: var(--lm-bg); }
a { color: var(--lm-primary); }
a:hover { color: var(--lm-primary-dark); }
.text-primary { color: var(--lm-primary) !important; }
.text-gray-800 { color: var(--lm-ink) !important; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5 { letter-spacing: -0.02em; }

/* ---------- Cartes ---------- */
.card {
    border: 1px solid var(--lm-line);
    border-radius: var(--lm-radius);
    box-shadow: var(--lm-shadow);
    overflow: hidden;
}
.card .card-header {
    background-color: #fff;
    border-bottom: 1px solid var(--lm-line);
    padding: 1rem 1.25rem;
}
.card .card-header h6, .card .card-header .m-0 { font-weight: 700; letter-spacing: -0.01em; }
.shadow, .shadow-sm { box-shadow: var(--lm-shadow) !important; }
.border-left-primary { border-left-color: var(--lm-primary) !important; }
.border-left-success { border-left-color: var(--lm-success) !important; }
.border-left-info    { border-left-color: var(--lm-accent) !important; }
.border-left-warning { border-left-color: var(--lm-warning) !important; }

/* Cartes statistiques (dashboard) */
.text-xs { letter-spacing: .04em; }

/* ---------- Boutons ---------- */
.btn {
    border-radius: var(--lm-radius-sm);
    font-weight: 600;
    letter-spacing: -0.01em;
    padding: .5rem 1rem;
    transition: transform .06s ease, box-shadow .15s ease, background-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary, .btn-primary:focus {
    background-color: var(--lm-primary);
    border-color: var(--lm-primary);
    box-shadow: 0 1px 2px rgba(79,70,229,.25);
}
.btn-primary:hover { background-color: var(--lm-primary-dark); border-color: var(--lm-primary-dark); }
.btn-outline-primary { color: var(--lm-primary); border-color: var(--lm-primary); }
.btn-outline-primary:hover { background-color: var(--lm-primary); border-color: var(--lm-primary); }
.btn-success { background-color: var(--lm-success); border-color: var(--lm-success); }
.btn-danger  { background-color: var(--lm-danger);  border-color: var(--lm-danger); }
.btn-warning { background-color: var(--lm-warning); border-color: var(--lm-warning); color:#fff; }
.btn-circle { border-radius: 50%; }

/* ---------- Sidebar ---------- */
.sidebar.bg-gradient-primary,
.bg-gradient-primary {
    background-color: #1e1b3a !important;
    background-image: linear-gradient(180deg, #2a2560 0%, #16132b 100%) !important;
}
.sidebar { box-shadow: 2px 0 16px rgba(16,24,40,.06); overflow-x: hidden; }
.sidebar-brand { padding: 1.35rem 1rem !important; letter-spacing: -0.02em; }
.sidebar-brand-icon i { color: #a5b4fc; }
.sidebar-brand-text { font-weight: 800; }
.sidebar-heading {
    color: rgba(255,255,255,.42) !important;
    letter-spacing: .12em;
    font-weight: 700;
    font-size: .68rem;
    padding: .5rem 1.4rem .25rem;
}
.sidebar hr.sidebar-divider {
    border-top-color: rgba(255,255,255,.08);
    margin: .5rem 1.1rem;
}

/* Couleurs/état communs aux deux modes */
.sidebar .nav-item .nav-link { color: rgba(255,255,255,.74); font-weight: 600; }
.sidebar .nav-item .nav-link i { color: rgba(255,255,255,.82); }
.sidebar .nav-item .nav-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.sidebar .nav-item.active > .nav-link,
.sidebar .nav-item .nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(129,140,248,.28), rgba(129,140,248,.14));
    box-shadow: inset 3px 0 0 #a5b4fc;
}
.sidebar .nav-item .nav-link .badge { background: #6366f1; }

/* ===== Mode DÉPLOYÉ : pills arrondies, icônes alignées ===== */
.sidebar:not(.toggled) .nav-item .nav-link {
    display: flex;
    align-items: center;
    /* SB Admin 2 force width:14rem -> le pill débordait à droite. On le
       laisse s'adapter à la largeur de la sidebar, marges comprises. */
    width: auto;
    border-radius: 10px;
    margin: 2px 12px;
    padding: .62rem .85rem;
    line-height: 1.15;
    text-align: left;
}
.sidebar:not(.toggled) .nav-item .nav-link i {
    width: 1.35rem;
    margin-right: .7rem;
    text-align: center;
    font-size: .95rem;
}
.sidebar:not(.toggled) .nav-item .nav-link span { flex: 1; }
/* le chevron des sous-menus repoussé à droite proprement */
.sidebar:not(.toggled) .nav-item .nav-link[data-toggle="collapse"]::after {
    margin-left: auto;
    opacity: .6;
}

/* ===== Mode RÉDUIT : rail d'icônes seules, épuré (aucun texte qui déborde) ===== */
.sidebar.toggled .nav-item .nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: .75rem 0;
    margin: 3px 12px;
    border-radius: 12px;
}
.sidebar.toggled .nav-item .nav-link i { font-size: 1.15rem; margin: 0; }
.sidebar.toggled .nav-item .nav-link span { display: none; }
.sidebar.toggled .sidebar-heading { display: none; }
.sidebar.toggled .nav-item .nav-link[data-toggle="collapse"]::after { display: none; }
.sidebar.toggled hr.sidebar-divider { margin: .4rem .9rem; }

/* Sous-menus déroulants */
.sidebar .collapse-inner, .sidebar .collapsing .collapse-inner {
    border-radius: 12px;
    box-shadow: var(--lm-shadow);
    padding: .35rem;
}
.sidebar .collapse-inner .collapse-item { border-radius: 8px; font-weight: 600; color: #4b5563; }
.sidebar .collapse-inner .collapse-item:hover { background: var(--lm-primary-soft); color: var(--lm-primary-dark); }

/* Bouton de repli (le petit rond en bas) */
#sidebarToggle {
    background: rgba(255,255,255,.10);
    transition: background .15s ease;
}
#sidebarToggle:hover { background: rgba(255,255,255,.2); }
#sidebarToggle::after { color: rgba(255,255,255,.8); }

/* ---------- Topbar ---------- */
.topbar {
    height: 4.2rem;
    box-shadow: none !important;
    border-bottom: 1px solid var(--lm-line);
    background: #fff;
}
.topbar .nav-item .nav-link { color: var(--lm-muted); }
.topbar .dropdown-menu { border: 1px solid var(--lm-line); border-radius: 12px; box-shadow: var(--lm-shadow); }

/* ---------- Formulaires ---------- */
.form-control, .custom-select, .form-select {
    border-radius: var(--lm-radius-sm);
    border-color: var(--lm-line);
    color: var(--lm-ink);
    padding: .55rem .8rem;
    height: auto;
}
.form-control:focus, .custom-select:focus, .form-select:focus {
    border-color: var(--lm-primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}
label { font-weight: 600; color: #374151; }
.input-group-text { border-radius: var(--lm-radius-sm); border-color: var(--lm-line); background: #f9fafb; }

/* ---------- Tables ---------- */
.table { color: var(--lm-ink); }
.table thead th {
    border-bottom: 1px solid var(--lm-line);
    border-top: 0;
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .06em;
    color: var(--lm-muted);
    font-weight: 700;
}
.table td, .table th { border-top: 1px solid var(--lm-line); vertical-align: middle; }
.table-bordered, .table-bordered td, .table-bordered th { border-color: var(--lm-line); }
.table-hover tbody tr:hover { background-color: var(--lm-primary-soft); }

/* ---------- Badges / pills ---------- */
.badge { border-radius: 999px; font-weight: 600; padding: .35em .7em; }
.badge-primary { background-color: var(--lm-primary); }

/* ---------- Alertes ---------- */
.alert { border: 0; border-radius: var(--lm-radius-sm); }
.alert-success { background: #e7f6ed; color: #14532d; }
.alert-danger  { background: #fdeaee; color: #7f1d1d; }
.alert-warning { background: #fdf2e2; color: #7c4a03; }
.alert-info    { background: #e6f6fb; color: #0e4f5c; }

/* ---------- Pagination ---------- */
.page-item.active .page-link { background-color: var(--lm-primary); border-color: var(--lm-primary); }
.page-link { color: var(--lm-primary); border-radius: 8px; margin: 0 2px; border-color: var(--lm-line); }

/* ---------- Dropdowns ---------- */
.dropdown-menu { border-radius: 12px; border: 1px solid var(--lm-line); box-shadow: var(--lm-shadow); }
.dropdown-item:active, .dropdown-item.active { background-color: var(--lm-primary); }

/* ---------- Lien discret « Signaler ce site » ---------- */
.report-link {
    text-decoration: none;
    font-size: .78rem;
    opacity: .7;
    transition: opacity .15s ease, color .15s ease;
}
.report-link:hover { opacity: 1; color: var(--lm-danger) !important; text-decoration: none; }

/* ---------- Modales (Bootstrap) ---------- */
.modal-content {
    border: 0;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(16,24,40,.22);
    overflow: hidden;
}
.modal-header {
    border-bottom: 1px solid var(--lm-line);
    padding: 1.1rem 1.35rem;
    background: #fff;
}
.modal-header .modal-title { font-weight: 700; letter-spacing: -0.01em; color: var(--lm-ink); }
.modal-body { padding: 1.35rem; }
.modal-footer { border-top: 1px solid var(--lm-line); padding: 1rem 1.35rem; }
.modal-backdrop.show { opacity: .45; }

/* ---------- SweetAlert2 ---------- */
.swal2-popup { border-radius: 16px; padding: 1.6rem; }
.swal2-title { font-weight: 700; letter-spacing: -0.01em; color: var(--lm-ink); }
.swal2-html-container { color: var(--lm-muted); }
.swal2-styled.swal2-confirm {
    background-color: var(--lm-primary) !important;
    border-radius: var(--lm-radius-sm) !important;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(79,70,229,.25) !important;
}
.swal2-styled.swal2-cancel {
    background-color: #eef0f5 !important;
    color: #374151 !important;
    border-radius: var(--lm-radius-sm) !important;
    font-weight: 600;
}
.swal2-textarea, .swal2-input, .swal2-select {
    border-radius: var(--lm-radius-sm) !important;
    border: 1px solid var(--lm-line) !important;
    box-shadow: none !important;
}
.swal2-textarea:focus, .swal2-input:focus {
    border-color: var(--lm-primary) !important;
    box-shadow: 0 0 0 3px rgba(79,70,229,.15) !important;
}

/* ---------- Scrollbar discrète ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d7dae6; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #c2c6d8; }
