/*
 * Grab-it Market — socle visuel commun (direction D1R)
 * Jetons, en-tête générique, châssis des modales, formulaires, boutons, pied de page
 * et restitution des fragments injectés par sinLib.php.
 * Chargé après sincss.css et bootstrap.min.css, sur l'accueil et sur les pages rayons.
 * Tout est porté par .gm-site pour ne pas toucher les pages d'administration.
 */

:root {
    --gm-ink: #0E1C26;
    --gm-ink-soft: #28414F;
    --gm-muted: #5C6F7B;
    --gm-brand: #004C8C;
    --gm-brand-dark: #0A3F6B;
    --gm-line: #E1E9EE;
    --gm-line-soft: #EEF3F6;
    --gm-soft: #F4F8FA;
    --gm-danger: #A33B29;
    --gm-success: #1E6B4A;
    --gm-wrap: 1200px;
    --gm-radius: 8px;
}

/* ---------------------------------------------------------------- base */

.gm-site {
    margin: 0;
    background: #EEF3F6;
    color: var(--gm-ink);
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

.gm-site *,
.gm-site *::before,
.gm-site *::after {
    box-sizing: border-box;
}

.gm-site a {
    text-decoration: none;
    color: inherit;
}

.gm-site img {
    display: block;
    max-width: 100%;
}

/* Remise à zéro des règles globales de sincss.css sur ces pages */
.gm-site section {
    background: none;
}

.gm-site footer {
    position: static;
    width: auto;
    text-align: left;
}

.gm-site table {
    overflow: visible;
}

.gm-wrap {
    width: min(var(--gm-wrap), 100% - 64px);
    margin: 0 auto;
}

.gm-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ------------------------------------------- éléments d'en-tête communs */

.gm-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 900;
    letter-spacing: -.2px;
    white-space: nowrap;
}

.gm-logo img {
    width: 50px;
    height: 34px;
    object-fit: contain;
}

.gm-acts {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 20px;
}

.gm-acct {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--gm-ink-soft);
    white-space: nowrap;
}

.gm-ava {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #CBD9E1;
    background: #EDF3F6;
}

.gm-cart {
    position: relative;
    width: 40px;
    height: 40px;
    border: 1px solid #D7E2E8;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gm-ink);
    flex: 0 0 auto;
}

.gm-cart img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.gm-cart:hover {
    border-color: #B9CBD6;
}

.gm-conn {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    object-fit: cover;
}

/* Note de contact réutilisée par l'accueil et les rayons */
.gm-note {
    margin-top: 12px;
    padding: 14px 12px;
    background: #F2F7FA;
    border-radius: 6px;
}

.gm-note strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 900;
}

.gm-note span {
    display: block;
    font-size: 12.5px;
    line-height: 1.45;
    color: #526975;
}

/* -------------------------------------------------------------- footer */

.gm-ft {
    margin-top: 36px;
    background: #0B2434;
}

.gm-ft-in {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.gm-ft-in p {
    margin: 0;
    font-size: 12.5px;
    color: rgba(255, 255, 255, .66);
}

.gm-ft-in div {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
}

.gm-ft-in a,
.gm-ft-in span {
    font-size: 12.5px;
    color: rgba(255, 255, 255, .82);
}

/* --------------------------------------------------------- modales */

.gm-site .sinModal {
    position: fixed;
    inset: 0;
    z-index: 60;
    padding: 24px;
    overflow: auto;
    background: rgba(9, 22, 32, .58);
}

/* sincss.css verrouille l'overflow de cette modale par son identifiant */
.gm-site #sinLoginModal {
    overflow: auto;
}

.gm-site .sinModalcontent {
    width: min(1040px, 100%);
    margin: 4vh auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 24px 60px rgba(4, 16, 26, .34);
    overflow: hidden;
}

.gm-site #sinPanierModal .sinModalcontent,
.gm-site #sinModifPnierModal .sinModalcontent {
    width: min(1120px, 100%);
}

.gm-site .sinModalheader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 56px;
    padding: 0 24px;
    background: #fff;
    border-bottom: 1px solid #E7EEF2;
}

.gm-site .sinModalheader h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 900;
    color: var(--gm-ink);
}

.gm-site .sinModal .close {
    float: none;
    order: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #F2F6F8;
    color: #1B3540;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.gm-site .sinModal .close:hover {
    background: #E7EEF2;
}

.gm-site .sinModalbody {
    max-height: calc(100vh - 160px);
    padding: 24px;
    overflow: auto;
    color: var(--gm-ink);
}

/* Champs de formulaire des modales */
.gm-site .gm-field {
    margin-bottom: 14px;
}

.gm-site .gm-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 12.5px;
    color: var(--gm-muted);
}

.gm-site .sinModal input[type="text"],
.gm-site .sinModal input[type="email"],
.gm-site .sinModal input[type="password"],
.gm-site .sinModal input[type="tel"],
.gm-site .sinModal select,
.gm-site .sinModal textarea {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid #DCE6EB;
    border-radius: 6px;
    background: #fff;
    color: var(--gm-ink);
    font: 400 14px 'Lato', sans-serif;
}

.gm-site .sinModal textarea {
    height: auto;
    min-height: 96px;
    padding: 10px 12px;
}

.gm-site .sinModal input:focus,
.gm-site .sinModal textarea:focus,
.gm-site .sinModal select:focus {
    border-color: var(--gm-brand);
    box-shadow: 0 0 0 3px rgba(0, 76, 140, .12);
    outline: none;
}

.gm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 6px;
    font: 900 14px 'Lato', sans-serif;
    cursor: pointer;
}

.gm-btn--primary {
    background: var(--gm-brand);
    color: #fff;
}

.gm-btn--primary:hover {
    background: var(--gm-brand-dark);
}

.gm-site .gm-modal-foot {
    margin: 14px 0 0;
    font-size: 13px;
    color: var(--gm-muted);
}

.gm-site .gm-linkbtn,
.gm-site #inscription {
    padding: 0;
    border: 0;
    background: none;
    color: var(--gm-brand);
    font: 700 13px 'Lato', sans-serif;
    text-decoration: none;
    cursor: pointer;
}

/* sincss.css colore les identifiants de blocs de modale : on neutralise */
.gm-site #divloginClient,
.gm-site #divlogoutClient {
    padding: 0;
    background: none;
}

/* Boutons Bootstrap contenus dans les modales, alignés sur la palette */
.gm-site .sinModal .btn-primary {
    background: var(--gm-brand);
    border-color: var(--gm-brand);
}

.gm-site .sinModal .btn-success {
    background: var(--gm-success);
    border-color: var(--gm-success);
}

.gm-site .sinModal .btn-danger {
    background: var(--gm-danger);
    border-color: var(--gm-danger);
}

.gm-site .sinModal .btn {
    border-radius: 6px;
    font: 700 13.5px 'Lato', sans-serif;
}

.gm-site .sinModal .sin-btn {
    float: none;
    width: auto;
    min-width: 160px;
    height: 44px;
    margin: 12px 0 0;
}

/* Contenu produit injecté par sinLib.php (codemap 37) */
.gm-site .sinModal .imgsinrow {
    display: block;
}

/* Fiche produit : visuel à gauche, informations à droite */
.gm-site #sinProduitModal .sinModalbody {
    display: grid;
    grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
    column-gap: 28px;
    align-content: start;
}

.gm-site #sinProduitModal .sinModalbody .imgsinrow {
    grid-column: 1;
    grid-row: 1 / span 12;
}

.gm-site #sinProduitModal .sinModalbody > p,
.gm-site #sinProduitModal .sinModalbody > h6,
.gm-site #sinProduitModal .sinModalbody > button,
.gm-site #sinProduitModal .sinModalbody > div[sinid] {
    grid-column: 2;
}

.gm-site #sinProduitModal .img-sincard_produit {
    max-width: 100%;
    margin: 0;
}

.gm-site .sinModal .imgsincol {
    float: none;
    width: auto;
    padding: 0;
}

.gm-site .sinModal .img-sincard_produit {
    width: 100%;
    max-width: 360px;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    margin: 0 auto;
    border-radius: var(--gm-radius);
    background: var(--gm-soft);
}

.gm-site .sinModal .img-sinMiniCard-produit {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border: 1px solid var(--gm-line);
    border-radius: 6px;
}

.gm-site .sinModal hr {
    margin: 14px 0;
    border: 0;
    border-top: 1px solid var(--gm-line);
}

.gm-site .sinModal p {
    margin: 0 0 8px;
    font-size: 13.5px;
    line-height: 1.6;
    color: #3C5361;
}

.gm-site .sinModal h4,
.gm-site .sinModal h5 {
    margin: 0 0 6px;
    color: var(--gm-ink);
}

.gm-site .sinModal .badge-success {
    background: #E4F3EA;
    color: var(--gm-success);
}

.gm-site .sinModal .badge-danger {
    background: #FBEAE7;
    color: var(--gm-danger);
}

.gm-site .sinModal #panier_qte {
    width: 64px;
    height: 34px;
    margin: 0 6px;
    padding: 0;
    text-align: center;
}

/* Tableaux du panier injectés par sinLib.php */
.gm-site .sinModal table {
    width: 100%;
    border-collapse: collapse;
}

.gm-site .sinModal td {
    padding: 10px 8px;
    border-bottom: 1px solid #F0F4F6;
    font-size: 13.5px;
    vertical-align: middle;
}

.gm-site .sinModal td img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
}

/* --------------------------------------------------- carte produit D1R */

.gm-site .gm-card {
    width: auto;
    margin: 0;
    padding: 0;
    display: block;
    background: #fff;
    border: 1px solid var(--gm-line);
    border-radius: var(--gm-radius);
    box-shadow: none;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .18s, transform .18s;
}

.gm-site .gm-card:hover {
    border-color: #B9CBD6;
    transform: translateY(-2px);
}

.gm-shot {
    aspect-ratio: 7 / 6;
    background: var(--gm-soft);
    overflow: hidden;
}

.gm-site .gm-shot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gm-cardbody {
    padding: 12px 12px 14px;
}

.gm-site .gm-cardbody .title-sinCard {
    margin: 0 0 4px;
    min-height: 2.6em;
    font-size: clamp(12.5px, 1vw, 14px);
    line-height: 1.3;
    font-weight: 700;
    text-align: left;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gm-cat {
    margin: 0 0 8px;
    font-size: clamp(11px, .85vw, 12px);
    color: #6A7F8B;
}

.gm-site .gm-cardbody .price-sinCard {
    margin: 0;
    font-size: clamp(15px, 1.2vw, 17px);
    font-weight: 900;
    letter-spacing: -.2px;
    color: var(--gm-brand);
}

/* --------------------------------------------------------- adaptations */

@media (max-width: 830px) {
    .gm-acct span {
        display: none;
    }
}

@media (max-width: 760px) {
    .gm-wrap {
        width: min(var(--gm-wrap), 100% - 32px);
    }

    .gm-acts {
        gap: 8px;
    }

    .gm-ft {
        margin-top: 18px;
    }

    .gm-ft-in {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px 0;
        gap: 8px;
    }

    .gm-site .sinModal {
        padding: 0;
    }

    .gm-site .sinModalcontent {
        width: 100%;
        min-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .gm-site .sinModalbody {
        max-height: none;
        padding: 16px;
    }

    .gm-site #sinProduitModal .sinModalbody {
        display: block;
    }
}
