/* =============================================================
   MA PHARMACIE — MAD & ANOMALIES — Feuille de styles centralisée
   Reprend les tokens et composants de l'app Planning Pharma (même
   pharmacie) pour une cohérence visuelle entre les deux outils internes.
   ============================================================= */

:root {
    --app-primary:              #f33939;
    --app-font-size:             16px;
    --app-primary-color:         var(--app-primary);
    --app-primary-light-color:   color-mix(in srgb, var(--app-primary-color) 10%, white);
    --app-primary-text-color:    #212121;
    --app-secondary-text-color:  #a0a0a0;
    --app-border-light-color:    #dee2e6;

    /* Palette de mise en avant pour les stat-cards (widgets) : chaque
       widget d'une même page prend une couleur différente, dans l'ordre. */
    --widget-accent-1: #0EA5E9;
    --widget-accent-2: #F59E0B;
    --widget-accent-3: #10B981;
    --widget-accent-4: #EF4444;

    --app-border-radius-sm:      0.4rem;
    --app-border-radius-md:      0.6rem;
    --app-border-radius-lg:      0.9rem;
    --app-border-radius-pill:    999px;

    --navbar-height: 56px;

    --bs-border-radius:    var(--app-border-radius-lg);
    --bs-border-radius-sm: var(--app-border-radius-sm);
    --bs-border-radius-lg: var(--app-border-radius-md);
    --bs-border-radius-xl: var(--app-border-radius-lg);

    --bs-btn-disabled-opacity: 0.55;
}

html {
    font-size: var(--app-font-size);
}

body {
    background-color: #f8f9fa;
}

.text-primary {
    color: var(--app-primary) !important;
}
.bg-primary {
    background-color: var(--app-primary) !important;
    color: white !important;
}
.btn-primary {
    background-color: var(--app-primary-light-color) !important;
    border-color: var(--app-primary) !important;
    color: var(--app-primary) !important;
}
.btn-primary:hover {
    background-color: white !important;
}
.btn-outline-primary {
    color: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
}
.btn-outline-primary:hover {
    background-color: var(--app-primary-light-color) !important;
    color: var(--app-primary) !important;
}
.border-primary {
    border-color: var(--app-primary) !important;
}
.form-check-input:checked {
    background-color: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
}


/* ---------------------------------------------------------------
   Navigation persistante (même esprit "façon Skello" que Planning
   Pharma : navbar claire, lien actif souligné plutôt qu'un aplat).
   --------------------------------------------------------------- */
.app-navbar {
    min-height: var(--navbar-height);
    background-color: #fff;
    border-bottom: 1px solid var(--app-border-light-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    z-index: 1040;
}
.app-navbar .navbar-brand {
    color: var(--app-primary-text-color);
}
.app-navbar .nav-link {
    color: #495057;
    font-weight: 500;
    padding-top: 0.85rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid transparent;
}
.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus {
    color: var(--app-primary-color);
}
.app-navbar .nav-link.disabled {
    color: #adb5bd !important;
    cursor: default;
}
.badge-bientot-nav {
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.1em 0.45em;
    border-radius: var(--app-border-radius-pill);
    background: #e9ecef;
    color: #adb5bd;
    vertical-align: middle;
    margin-left: 0.2rem;
}
.app-navbar .nav-link.active {
    color: var(--app-primary-color);
    font-weight: 700;
    border-bottom-color: var(--app-primary-color);
}
.app-navbar .dropdown-item.active {
    background-color: var(--app-primary-light-color);
    color: var(--app-primary-color);
    font-weight: 600;
}
.app-navbar .navbar-toggler {
    border-color: var(--app-border-light-color);
}
/* titre de page */

.page-title {
    font-weight: 700 !important;
    margin-bottom: 0.75rem !important;
    white-space: nowrap !important;
    color: var(--app-primary-text-color);
}


/* Carte de contenu standard (remplace l'ancien .card-custom sombre) */
.page-card,
.card-custom {
    background: #ffffff;
    border: 0 !important;
    border-radius: var(--app-border-radius-lg);
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.06);
}

.stat-card {
    border-left: 5px solid var(--app-primary-color) !important;
}

.stat-card-accent-1, .stat-card-accent-2, .stat-card-accent-3,
.stat-card-accent-4 {
    border-left-color: var(--widget-accent) !important;
}
.stat-card-accent-1 { --widget-accent: var(--widget-accent-1); }
.stat-card-accent-2 { --widget-accent: var(--widget-accent-2); }
.stat-card-accent-3 { --widget-accent: var(--widget-accent-3); }
.stat-card-accent-4 { --widget-accent: var(--widget-accent-4); }

.stat-card-value,
.stat-card-icon {
    color: var(--widget-accent);
}

.stat-card-link {
    display: block;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card-link:hover,
.stat-card-link:focus {
    transform: translateY(-3px);
    box-shadow: 0 0.75rem 1.25rem rgba(0, 0, 0, 0.12);
}

/* Fait ressortir une carte imbriquée (ex : fiche d'amélioration dans une
   anomalie) sans casser card-custom, qui force border:0 sur .card. */
.card-encart {
    background-color: color-mix(in srgb, var(--app-primary-color) 5%, white) !important;
    border: 1px solid color-mix(in srgb, var(--app-primary-color) 10%, white) !important;
}

.cursor-pointer {
    cursor: pointer;
}

.app-footer {
    padding: 1rem 1rem 1.5rem;
    color: #adb5bd;
    font-size: 0.8rem;
    text-align: center;
}

/* ---------------------------------------------------------------
   Page d'accueil : sélecteur de modules (grandes tuiles), même
   composant que le widget de dashboard de Planning Pharma.
   --------------------------------------------------------------- */
.dashboard-grid-widget-lg {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.25rem;
}

.dashboard-widget-lg {
    display: block;
    text-align: left;
    padding: 1.5rem;
    background: white;
    border: 1px solid color-mix(in srgb, var(--app-primary-color) 30%, white);
    border-radius: var(--app-border-radius-lg);
    box-shadow: 0 0.15rem 0.35rem rgba(0, 0, 0, 0.04);
    text-decoration: none;
    color: inherit;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
    position: relative;
}
.dashboard-widget-lg:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.3rem 0.6rem rgba(0, 0, 0, 0.08);
    color: inherit;
}
.dashboard-widget-lg .icon {
    font-size: 28px;
    font-weight: 800;
    color: var(--app-primary-color);
    line-height: 1;
}
.dashboard-widget-lg .title {
    font-size: 1.05rem;
    color: var(--app-primary-text-color);
    margin-top: 0.75rem;
    font-weight: 700;
}
.dashboard-widget-lg .desc {
    font-size: 0.83rem;
    color: var(--app-secondary-text-color);
    margin-top: 0.3rem;
    font-weight: 400;
}

.dashboard-widget-lg.is-disabled {
    cursor: default;
    background: #f8f9fa;
    border-color: var(--app-border-light-color);
    box-shadow: none;
}
.dashboard-widget-lg.is-disabled:hover {
    transform: none;
    box-shadow: none;
}
.dashboard-widget-lg.is-disabled .icon {
    color: #adb5bd;
}
.dashboard-widget-lg.is-disabled .title {
    color: #adb5bd;
}
.dashboard-widget-lg .badge-bientot {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.25em 0.6em;
    border-radius: var(--app-border-radius-pill);
    background: #e9ecef;
    color: #6c757d;
}

/* ---------------------------------------------------------------
   1. TABLEAUX PARTAGÉS (.app-table-card / .app-table)
   Système unique pour tous les tableaux de données de l'appli (listes,
   récaps, pivots...), pour remplacer les CSS scopées par page qui
   divergeaient toutes légèrement (en-tête coloré ou non, survol ou non,
   rayon différent à chaque fois — voir l'audit qui a motivé ce chantier).


   Recette :
     <div class="app-table-card">
       <table class="app-table [is-zebra]">…</table>
     </div>
   Alignement/marges : utiliser les utilitaires Bootstrap existants
   (text-center, align-middle, mb-0) directement sur <table>, comme
   avant — .app-table ne gère que la "chrome" (en-tête, bordures,
   survol, rayon).
   --------------------------------------------------------------- */
.app-table-card {
    background: #fff;
    border-radius: var(--app-border-radius-lg);
    overflow: hidden;
    border: 1px solid var(--app-border-light-color);
    box-shadow: 0 0.15rem 0.4rem rgba(0, 0, 0, 0.05);
    padding: 1rem;
}

.title-card{
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--app-primary-color);
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--app-border-light-color);
}

table.app-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
}
/* ligne en-tete tableau: fond coloré loueur primaire light, texte auto, bordure inferieure (bordure du tableau
   déjà gérée par .app-table-card). */
table.app-table thead th {
    border: none;
    font-weight: 500;
    background: var(--app-primary-light-color);
    color: var(--app-primary-text-color);
    vertical-align: middle;
    padding: 0.0rem 0.9rem;
    border-bottom: solid 2px;
}
/* lignes du tableau: fond blanc, bordure fine entre les lignes, survol coloré primary color (7% de couleur sur blanc). */
table.app-table tbody td {
    border: none;
    border-top: 1px solid var(--app-border-light-color);
    vertical-align: middle;
    padding: 0.1rem 0.5rem; /* padding des lignes des tableaux*/
}

/* 1ere cellule d'une ligne des tableaux , généralement le nom de l'employé */
table.app-table tbody tr td:first-child {
    background:  color-mix(in srgb, var(--app-primary-color) 1%, white);
    width: 1%;
    white-space: nowrap;
    font-weight: 500 !important;
    text-align: left !important;
    border-right: 1px solid #f1f3f5 !important;
}
table.app-table tbody tr:hover td:first-child {
    background:  color-mix(in srgb, var(--app-primary-color) 5%, white);
}

table.app-table tbody tr:first-child td {
    border-top: none; /* pas de bordure sur la première ligne du tableau */
}

table.app-table tbody tr:hover td {
    background-color: color-mix(in srgb, var(--app-primary-color) 7%, white);
}

table.app-table tfoot td {
    border-top: 2px solid var(--app-border-light-color);
    background: var(--app-primary-light-color);
    font-weight: 600;
    color: var(--app-primary-color);
}

/* Modificateur : lignes zébrées, pour les tableaux denses où on veut
   pouvoir suivre une ligne des yeux sans le survol (remplace
   table-striped, incompatible avec le rendu propre à .app-table). */
table.app-table.is-zebra tbody tr:nth-child(even) td {
    background-color: color-mix(in srgb, var(--app-primary-color) 3%, white);
}
table.app-table.is-zebra tbody tr:nth-child(even):hover td {
    background-color: color-mix(in srgb, var(--app-primary-color) 6%, white);
}