/* ============================================================================
 *  app.css — BonCadeauConnect (JYL Software)
 *  Styles complémentaires (au-dessus de ../partner-theme.css / Bootstrap 5.3).
 *  Design homogène avec les autres apps Connect (tokens --bc-* JYL, bleu marine).
 * ========================================================================== */

:root {
    --bcg-primary:   var(--bc-primary, #3949ab);
    --bcg-primary-d: var(--bc-primary-dark, #1a237e);
    --bcg-bg:        var(--bc-bg, #f5f6fa);
    --bcg-text:      var(--bc-text, #1a237e);
    --bcg-muted:     var(--bc-muted, #6c757d);
    --bcg-radius:    16px;
    --bcg-shadow:    0 2px 12px rgba(0,0,0,.08);
    --bcg-shadow-h:  0 4px 24px rgba(26,35,126,.25);
}

* { -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
    background: var(--bcg-bg);
    color: var(--bcg-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Filtre plein écran (override d'un éventuel body::before limité du thème) */
body.home-page::before, body.settings-page::before {
    max-width: none !important;
    width: 100% !important;
    left: 0 !important;
    transform: none !important;
    background: var(--bcg-bg) !important;
    box-shadow: none !important;
}

/* ── Login ─────────────────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--bcg-primary) 0%, var(--bcg-primary-d) 100%);
}
.login-card {
    background: #fff; width: 100%; max-width: 420px;
    border-radius: var(--bcg-radius); box-shadow: var(--bcg-shadow-h); overflow: hidden;
}
.login-card-header {
    background: linear-gradient(135deg, var(--bcg-primary), var(--bcg-primary-d));
    color: #fff; text-align: center; padding: 24px 16px 18px;
}
.login-card-header h2 { margin: 0; font-weight: 600; }
.login-card-body { padding: 20px 22px; }

/* ── Header (home + settings) ──────────────────────────────────────────── */
.home-header {
    background: var(--bc-header-bg, #1a237e);
    color: #fff;
    box-shadow: var(--bcg-shadow);
    position: sticky; top: 0; z-index: 50;
    border-radius: 0 0 18px 18px;
    gap: 10px;
}
.home-header h1 { font-weight: 600; }
.header-company { display: flex; flex-direction: column; min-width: 0; }
.header-company .hc-title {
    font-size: clamp(1rem, 2.6vw, 1.2rem); font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15;
}
.header-company .hc-sub {
    font-size: .78rem; opacity: .82;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hdr-btn, .home-header .hdr-btn, .licence-reset-btn {
    width: 40px; height: 40px; min-width: 40px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0; font-size: 1rem; line-height: 1; color: #fff;
    background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35);
    transition: background .15s, transform .15s, border-color .15s; text-decoration: none;
    cursor: pointer;
}
.hdr-btn:hover, .home-header .hdr-btn:hover, .licence-reset-btn:hover,
.hdr-btn:focus, .home-header .hdr-btn:focus, .licence-reset-btn:focus {
    background: rgba(255,255,255,.32); border-color: rgba(255,255,255,.6);
    color: #fff; transform: scale(1.05);
}
.hdr-btn:active, .licence-reset-btn:active { transform: scale(.95); }
.hdr-btn i, .licence-reset-btn i { pointer-events: none; }

/* ── Bandeau licence ───────────────────────────────────────────────────── */
.licence-banner {
    margin: 12px auto; max-width: 1100px; padding: 10px 16px;
    border-radius: 12px; font-weight: 500; text-align: center;
}
.licence-banner.lb-warn   { background: #fff3cd; color: #7a5b00; border: 1px solid #ffe69c; }
.licence-banner.lb-grace  { background: #f8d7da; color: #842029; border: 1px solid #f1aeb5; }
.licence-banner.lb-expired{ background: #dc3545; color: #fff; }

/* ── Grand bouton « Ajouter un bon » ───────────────────────────────────── */
.add-bon-wrap { display: flex; justify-content: center; margin: 8px auto 22px; }
.btn-add-bon {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; width: min(92vw, 420px); min-height: 168px; padding: 24px;
    border: none; border-radius: 24px; color: #fff; cursor: pointer;
    background: linear-gradient(135deg, var(--bc-secondary, #667eea) 0%, var(--bcg-primary) 55%, var(--bcg-primary-d) 100%);
    box-shadow: var(--bcg-shadow-h);
    transition: transform .12s, box-shadow .12s, filter .12s;
}
.btn-add-bon:hover  { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(26,35,126,.35); }
.btn-add-bon:active { transform: scale(.98); }
.btn-add-bon:disabled { filter: grayscale(.7) opacity(.6); cursor: not-allowed; transform: none; }
.add-bon-icon  { font-size: 3rem; }
.add-bon-label { font-size: 1.5rem; font-weight: 700; letter-spacing: .3px; }

/* ── Barre outils liste ────────────────────────────────────────────────── */
.bons-toolbar {
    max-width: 1100px; margin: 0 auto; display: flex; flex-wrap: wrap;
    align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 10px;
}
.bons-total-bar {
    max-width: 1100px; margin: 0 auto 12px; display: flex; align-items: center;
    justify-content: space-between; padding: 10px 18px; background: #fff;
    border: 1px solid var(--bc-border, #c5cae9); border-radius: 12px; box-shadow: var(--bcg-shadow);
}
.bons-total-value { font-size: 1.4rem; font-weight: 800; color: var(--bcg-primary-d); }

/* ── Table des bons ────────────────────────────────────────────────────── */
.bons-card { max-width: 1100px; margin: 0 auto; border: none; border-radius: 14px; box-shadow: var(--bcg-shadow); overflow: hidden; }
.bons-table thead th { background: var(--bc-primary-lighter, #e8eaf6); color: var(--bcg-primary-d); font-weight: 600; white-space: nowrap; border: none; }
.bons-table thead th[data-sort] { cursor: pointer; user-select: none; }
.bons-table thead th .sort-ico { opacity: .4; font-size: .8em; }
.bons-table thead th.sort-active .sort-ico { opacity: 1; }
.bons-table td { vertical-align: middle; }
.bons-table .bon-code { font-family: monospace; letter-spacing: .04em; }
.bons-table .bon-montant { font-weight: 700; }
.badge-unprinted { background: var(--bc-warning, #f59e0b); color: #3a2c00; }

/* ── Modale montant ────────────────────────────────────────────────────── */
.montant-input-wrap { position: relative; }
.montant-input {
    font-size: 2.6rem; font-weight: 800; text-align: center; height: auto;
    padding: 14px 44px 14px 14px; border-radius: 14px; letter-spacing: .02em;
}
.montant-euro { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 2rem; font-weight: 700; color: var(--bcg-muted); pointer-events: none; }
.montants-rapides { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.montant-quick { min-width: 84px; font-size: 1.1rem; font-weight: 600; border-radius: 50px; }

/* ── Settings ──────────────────────────────────────────────────────────── */
.settings-page { background: var(--bcg-bg); min-height: 100vh; }
.settings-nav { position: sticky; top: 84px; background: #fff; border-radius: 14px; padding: 8px; box-shadow: var(--bcg-shadow); }
.settings-nav .nav-link { color: var(--bcg-text); border-radius: 10px; text-align: left; padding: 10px 14px; font-weight: 500; }
.settings-nav .nav-link:hover  { background: var(--bc-primary-lighter, #e8eaf6); color: var(--bcg-primary); }
.settings-nav .nav-link.active { background: var(--bcg-primary); color: #fff; }
.settings-nav .settings-nav-group { letter-spacing: .04em; }
.settings-content .card { border: none; border-radius: 14px; box-shadow: var(--bcg-shadow); }
.settings-content .form-label { font-weight: 500; }
.pair-pin { font-family: monospace; font-size: 2rem; font-weight: 800; letter-spacing: 10px; color: var(--bcg-primary-d); }

@media (max-width: 767.98px) {
    .settings-nav { position: static; display: flex; flex-direction: row; overflow-x: auto; }
    .settings-nav .settings-nav-group { display: none; }
    .settings-nav .nav-link { white-space: nowrap; }
}

/* ── PIN admin (modale) ────────────────────────────────────────────────── */
#adminModal .pin-display { font-family: monospace; font-size: 2rem; text-align: center; letter-spacing: 12px; background: var(--bc-bg, #f5f6fa); border-radius: 12px; padding: 10px; }
#adminModal .pin-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
#adminModal .pin-key {
    height: 58px; font-size: 1.3rem; font-weight: 600; border: 1px solid var(--bc-border, #c5cae9);
    background: #fff; border-radius: 12px; color: var(--bcg-text); cursor: pointer;
    transition: background .1s, transform .1s;
}
#adminModal .pin-key:active { background: var(--bcg-primary); color: #fff; transform: scale(.96); }
#adminModal .pin-key.pin-key-ok { background: var(--bc-success, #28a745); color: #fff; border-color: transparent; }
#adminModal .pin-key.pin-key-clear { background: #eceef5; }

/* ── Toasts ────────────────────────────────────────────────────────────── */
.bcg-toast {
    position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
    background: #333; color: #fff; padding: 12px 20px; border-radius: 50px;
    box-shadow: 0 6px 24px rgba(0,0,0,.25); z-index: 3000; opacity: 0;
    transition: opacity .25s, transform .25s; font-weight: 500; max-width: 90vw;
}
.bcg-toast.show { opacity: 1; transform: translate(-50%, 0); }
.bcg-toast-ok  { background: var(--bc-success-dark, #1e7e34); }
.bcg-toast-err { background: var(--bc-danger, #d32f2f); }
