/* Habillage visuel façon CRM d'entreprise, au-dessus de Bootstrap 5.
   On ne touche pas aux composants Bootstrap : on redéfinit leurs
   variables CSS (--bs-*) pour que tout (btn-primary, bg-primary...)
   suive automatiquement la même palette. */

:root {
    --bs-primary: #6c7fe0;
    --bs-primary-rgb: 108, 127, 224;
    --bs-primary-text-emphasis: #4c5cc4;
    --bs-body-bg: #eef1f7;
    --bs-body-color: #3a3f51;
    --bs-border-color: #e3e6ef;
    --bs-secondary-color: #7d879e;

    /* Prélevées sur MAIL_LOGO-original.png */
    --logo-bleu: #1670f0;
    --logo-cyan: #3fbdf2;
}

body {
    background-color: var(--bs-body-bg);
}

/* Menu latéral */
.app-sidebar {
    background-color: #ffffff;
    border-right: 1px solid var(--bs-border-color);
}

.app-brand-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    flex-shrink: 0;
}

.app-brand-text small {
    font-size: .72rem;
    line-height: 1;
}

/* Non limité à la sidebar : réutilisé tel quel sur la page de connexion */
.app-logo {
    color: var(--logo-bleu);
    font-weight: 700;
    font-style: italic;
    font-size: 1.4rem;
    letter-spacing: .02em;
}

/* Le dégradé du logo repris sur le mot « CRUD » */
@supports (background-clip: text) or (-webkit-background-clip: text) {
    .app-logo {
        background-image: linear-gradient(100deg, var(--logo-bleu), var(--logo-cyan) 135%);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }
}

.app-brand .app-logo {
    font-size: 1.15rem;
    line-height: 1.1;
}

/* Alertes : palette adoucie + filet d'accent, via les variables Bootstrap */
.alert {
    --bs-alert-border: 1px solid var(--bs-alert-border-color);
    border-radius: .625rem;
    border-left-width: 3px;
    padding: .8rem .95rem;
    font-size: .875rem;
    line-height: 1.5;
}

.alert-danger {
    --bs-alert-bg: #fdf4f5;
    --bs-alert-border-color: #f0d7dc;
    --bs-alert-color: #9d3b4d;
    border-left-color: #d9758a;
}

.alert-success {
    --bs-alert-bg: #f2faf5;
    --bs-alert-border-color: #cee8da;
    --bs-alert-color: #1f6b4a;
    border-left-color: #57ab84;
}

/* Notre padding raccourci écrase celui de Bootstrap : on rend sa place au bouton */
.alert-dismissible {
    padding-right: 2.5rem;
}

.alert-dismissible .btn-close {
    padding: .9rem .8rem;
}

.alert-icone {
    flex-shrink: 0;
    margin-top: .1rem;
    opacity: .75;
}

.alert-titre {
    font-weight: 600;
}

.alert-liste {
    list-style: none;
    margin: .35rem 0 0;
    padding: 0;
}

.alert-liste li {
    position: relative;
    padding-left: .85rem;
    color: var(--bs-body-color);
}

.alert-liste li + li {
    margin-top: .25rem;
}

.alert-liste li::before {
    content: "";
    position: absolute;
    left: 0;
    top: .5rem;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: currentColor;
    opacity: .45;
}

.app-sidebar .nav-section-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--bs-secondary-color);
    font-weight: 600;
}

.app-sidebar .nav-link {
    color: #5c6273;
    border-radius: .375rem;
    font-size: .9rem;
    padding: .5rem .65rem;
}

.app-sidebar .nav-link i {
    color: #a3a8b8;
}

.app-sidebar .nav-link:hover {
    background-color: #f4f5fa;
}

.app-sidebar .nav-link.active {
    background-color: #eef0fc;
    color: var(--bs-primary-text-emphasis);
    font-weight: 600;
}

.app-sidebar .nav-link.active i {
    color: var(--bs-primary-text-emphasis);
}

/* Tableaux : Bootstrap calque --bs-table-bg sur --bs-body-bg (même souci que .card) */
.table {
    --bs-table-bg: #ffffff;
}

.table thead th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--bs-secondary-color);
    font-weight: 600;
    border-bottom-width: 1px;
}

/* Cartes plus sobres, sans ombre marquée. Fond blanc explicite : Bootstrap calque
   --bs-card-bg sur --bs-body-bg, qu'on a mis en gris clair pour la page. */
.card {
    --bs-card-bg: #ffffff;
    box-shadow: none;
}

/* Champs de formulaire : même souci que .card/.table, plus une bordure trop
   proche du gris de fond pour être visible. Fond blanc + bordure plus marquée. */
.form-control,
.form-select {
    background-color: #ffffff;
    border-color: #c7cce0;
}

/* Actions de tableau en icônes seules (Modifier / Supprimer) */
.btn-icon {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: .375rem;
    background-color: transparent;
    color: var(--bs-primary);
}

.btn-icon:hover,
.btn-icon:focus {
    background-color: #eef0fc;
    color: var(--bs-primary-text-emphasis);
}

/* Barre de navigation du haut : recherche + icônes en gris neutre */
.app-topbar .app-search-input {
    width: 200px;
    border-radius: 999px;
}

.app-topbar .btn-icon {
    color: #6c7280;
}

.app-topbar .btn-icon:hover,
.app-topbar .btn-icon:focus {
    background-color: #f4f5fa;
    color: #3a3f51;
}

.app-topbar-divider {
    width: 1px;
    height: 1.5rem;
    background-color: var(--bs-border-color);
}

/* Bascule Connexion / Inscription (page d'authentification) */
#onglet-connexion,
#onglet-inscription {
    color: var(--bs-secondary-color);
    background-color: transparent;
    border: none;
}

#onglet-connexion.active,
#onglet-inscription.active {
    background-color: #ffffff;
    color: var(--bs-body-color);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}

/* Champ mot de passe : le bouton « afficher / masquer » se pose dans le champ,
   sans bordure ni fond, pour ne pas alourdir le formulaire (page Mon profil) */
.champ-mdp {
    position: relative;
}

.champ-mdp .form-control {
    padding-right: 2.5rem;
}

/* Sinon l'icône rouge de validation Bootstrap se superpose à l'œil */
.champ-mdp .form-control.is-invalid {
    background-image: none;
}

.champ-mdp .bascule-mdp {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background-color: transparent;
    color: #a3a8b8;
    border-radius: 0 .375rem .375rem 0;
    transition: color .15s ease-in-out;
}

.champ-mdp .bascule-mdp:hover {
    color: var(--bs-body-color);
}

.champ-mdp .bascule-mdp:focus-visible {
    color: var(--bs-body-color);
    outline: 2px solid var(--bs-primary);
    outline-offset: -2px;
}

/* Pastille du nombre d'articles, sur l'icône panier de la barre du haut.
   Alignée sur le haut de l'icône (et non centrée sur son coin, sinon elle
   dépasse au-dessus d'une barre aussi basse).
   Sélecteur en deux parties : Bootstrap applique « .btn .badge » aux badges
   posés dans un bouton, et une classe seule ne ferait pas le poids. */
.app-topbar .badge-panier {
    position: absolute;
    top: 0;
    left: 100%;
    transform: translateX(-70%);
    font-size: .65rem;
    line-height: 1;
    padding: .25rem .35rem;
}

/* Champ « combien j'en veux » de la liste des produits */
.quantite-panier {
    width: 2.75rem;
    padding: .15rem .25rem;
    font-size: .8rem;
    text-align: center;
    appearance: textfield;
}

/* Les flèches natives élargiraient le champ */
.quantite-panier::-webkit-inner-spin-button,
.quantite-panier::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Boutons − et + encadrant le champ quantité */
.btn-pas {
    width: 1.4rem;
    height: 1.6rem;
    padding: 0;
    border: 1px solid var(--bs-border-color);
    border-radius: .25rem;
    background-color: #ffffff;
    color: #6c7280;
    font-size: .8rem;
    line-height: 1;
}

.btn-pas:hover:not(:disabled) {
    background-color: #f4f5fa;
    color: var(--bs-body-color);
}

.btn-pas:disabled {
    opacity: .4;
}

/* Lignes de la liste des produits : le clic ouvre la fiche détaillée */
.ligne-produit {
    cursor: pointer;
}

/* Fiche détaillée d'un produit */
.fiche-produit {
    border: 0;
    border-radius: .75rem;
    overflow: hidden;
    box-shadow: 0 1.5rem 3rem rgba(58, 63, 81, .2);
}

.fiche-produit-fermer {
    position: absolute;
    top: .75rem;
    right: .75rem;
    z-index: 2;
    padding: .6rem;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, .85);
}

/* Le visuel occupe toute la hauteur de la colonne de gauche */
.fiche-produit-visuel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(160deg, #f7f8fc, #e6ebf7);
}

.fiche-produit-visuel img {
    max-height: 15rem;
    object-fit: contain;
    filter: drop-shadow(0 .75rem 1.25rem rgba(58, 63, 81, .18));
}

/* Même traitement que les en-têtes de tableau, pour les intitulés de la fiche */
.fiche-produit-etiquette {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--bs-secondary-color);
    font-weight: 600;
}

.fiche-produit-prix {
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1;
}

.fiche-produit-meta {
    font-size: .875rem;
    border-top: 1px solid var(--bs-border-color);
}

.fiche-produit-meta > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .5rem 0;
    border-bottom: 1px dashed var(--bs-border-color);
}

.fiche-produit-meta > div:last-child {
    border-bottom: 0;
}

/* Bouton du compte, dans la barre du haut */
.btn-compte {
    padding: .3rem .5rem;
    border: 0;
    border-radius: .5rem;
    background-color: transparent;
    line-height: 1.2;
}

.btn-compte:hover,
.btn-compte[aria-expanded="true"] {
    background-color: #f4f5fa;
}

.nom-compte {
    font-size: .875rem;
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--bs-body-color);
}

.btn-compte .bi-chevron-down {
    font-size: .7rem;
    color: var(--bs-secondary-color);
}

/* Menu compact : les variables du composant suffisent à le redimensionner */
.menu-compte {
    --bs-dropdown-min-width: 9rem;
    --bs-dropdown-font-size: .8125rem;
    --bs-dropdown-padding-y: .25rem;
    --bs-dropdown-item-padding-y: .375rem;
    --bs-dropdown-item-padding-x: .625rem;
    --bs-dropdown-border-radius: .5rem;
    --bs-dropdown-border-color: var(--bs-border-color);
    --bs-dropdown-box-shadow: 0 .5rem 1.5rem rgba(58, 63, 81, .14);
    margin-top: .25rem;
}

/* Zone d'image des formulaires produit : rectangle cliquable, « + » tant qu'aucune image */
.zone-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 11rem;
    padding: .5rem;
    border: 2px dashed #c7cce0;
    border-radius: .5rem;
    background-color: #ffffff;
    cursor: pointer;
    overflow: hidden;
}

.zone-image:hover,
.zone-image.survol {
    border-color: var(--bs-primary);
    background-color: #f7f8fc;
}

.zone-image.est-invalide {
    border-color: var(--bs-danger);
}

.zone-image-invite {
    font-size: 1.75rem;
    line-height: 1;
    color: var(--bs-secondary-color);
}

.zone-image-apercu {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
