/* ═══════════════════════════════════════════
   DragonsMag — Base CSS partagée
   Charte : #675151 · #262323 · #741b47 · #FFFFFF
   Inclus dans toutes les pages TCG Manager
═══════════════════════════════════════════ */

/* ── Variables communes ── */
:root {
    /* Fonds — dérivés de #262323 */
    --bg:           #1a1717;
    --bg2:          #211e1e;
    --bg3:          #2a2626;
    --bg4:          #332e2e;
    --bg5:          #3d3838;

    /* Bordures — dérivées de #675151 */
    --border:       #3d3636;
    --border2:      #4d4444;

    /* Texte */
    --text:         #f5f0f0;
    --text2:        #c4aaaa;
    --text3:        #8a7070;

    /* Accent principal — dérivé de #741b47 */
    --accent:       #741b47;
    --accent2:      #9b2460;
    --accent3:      #bc3d7a;
    --accent-bg:    rgba(116,27,71,.15);
    --accent-bg2:   rgba(116,27,71,.08);

    /* Muted — dérivé de #675151 */
    --muted:        #675151;
    --muted2:       #8a6e6e;

    /* États fonctionnels */
    --green:        #4ade80;
    --green-bg:     rgba(74,222,128,.12);
    --red:          #f87171;
    --red-bg:       rgba(248,113,113,.12);
    --amber:        #fbbf24;
    --amber-bg:     rgba(251,191,36,.12);
    --blue:         #60a5fa;
    --blue-bg:      rgba(96,165,250,.12);

    /* Couleurs cartes TCG (One Piece, etc.) */
    --tcg-red:      #e84040;
    --tcg-red-bg:   rgba(232,64,64,.12);
    --tcg-green:    #3de880;
    --tcg-green-bg: rgba(61,232,128,.12);
    --tcg-blue:     #3d8fe8;
    --tcg-blue-bg:  rgba(61,143,232,.12);
    --tcg-purple:   #a040e8;
    --tcg-purple-bg:rgba(160,64,232,.12);
    --tcg-black:    #8090b0;
    --tcg-black-bg: rgba(128,144,176,.12);
    --tcg-yellow:   #e8c040;
    --tcg-yellow-bg:rgba(232,192,64,.12);

    /* Or (deck builder) */
    --gold:         #c8a84a;
    --gold2:        #f0d060;
    --gold-bg:      rgba(200,168,74,.15);

    /* Dimensions */
    --r:            10px;
    --rl:           16px;
    --header-h:     60px;

    /* Typographie */
    --fh:           'Syne', 'Arial Black', sans-serif;
    --fm:           'DM Mono', 'Consolas', monospace;
    --fb:           'Barlow', 'Segoe UI', sans-serif;
    --fc:           'Cinzel', 'Georgia', serif;
}

/* ── Reset minimal ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--fm);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 13px;
    line-height: 1.6;
}

/* ── Utilitaires partagés ── */

/* En-tête bordeaux */
.bloc-header {
    background: var(--accent);
    padding: 9px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bloc-header-title {
    font-family: var(--fh);
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .5px;
}

/* ── Conteneurs de page ── */
.page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 16px 40px;
}

/* ── Layouts ── */
.two-col-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 16px;
    align-items: start;
}

.two-col-layout-wide {
    display: grid;
    grid-template-columns: 1fr 310px;
    gap: 16px;
    align-items: start;
}

.single-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Media queries associées ── */
@media (max-width: 1100px) {
    .two-col-layout       { grid-template-columns: 1fr 260px; }
    .two-col-layout-wide  { grid-template-columns: 1fr 270px; }
}

@media (max-width: 900px) {
    .two-col-layout,
    .two-col-layout-wide  { grid-template-columns: 1fr; }
}

/* ── Bloc simple ── */
.simple-bloc {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
}

.simple-bloc-body {
    margin-left:20px;
    margin-right:20px;
    margin-bottom: 20px;
    margin-top: 20px;
}

.simple-bloc-body a {
    font-size: 11px;
    color: var(--text3);
    text-decoration: none;
    transition: color .15s;
}
.simple-bloc-body a:hover { color: var(--accent3); }

.simple-bloc-foot {
    display: flex;
    justify-content: flex-end;
    padding: 8px 14px;
    border-top: 1px solid var(--border);
    background: var(--bg3);
}

.simple-bloc-foot a {
    font-size: 11px;
    color: var(--text3);
    text-decoration: none;
    transition: color .15s;
}
.simple-bloc-foot a:hover { color: var(--accent3); }

/* ── Sidebar commune ── */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-bloc {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
}

.sidebar-bloc-head {
    background: var(--accent);
    padding: 8px 14px;
    font-family: var(--fh);
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .3px;
}

.sidebar-bloc-body {
    padding: 10px 14px;
}

/* Liens génériques dans un bloc de sidebar (ex: "Série" dans l'encart deck de card/view_deck.tpl)
   — sans cette règle le lien reste en bleu/souligné par défaut du navigateur, aucune classe du
   thème ne s'appliquant. */
.sidebar-bloc-body a {
    color: var(--accent3);
    text-decoration: none;
    transition: color .15s;
}
.sidebar-bloc-body a:hover { color: var(--accent2); text-decoration: underline; }

/* Réseaux sociaux */
.social-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 14px;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border2);
    background: var(--bg3);
    color: var(--text2);
    text-decoration: none;
    font-size: 20px;
    transition: all .2s;
}
.social-link:hover {
    border-color: var(--accent2);
    color: var(--accent3);
    background: var(--accent-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(116,27,71,.3);
}

/* Liste sorties / événements */
.sidebar-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sidebar-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    transition: background .1s;
}
.sidebar-list-item:last-child { border-bottom: none; }
.sidebar-list-item:hover .sidebar-item-name { color: var(--accent3); }

.sidebar-item-date {
    font-family: var(--fb);
    font-size: 11px;
    color: var(--text3);
    flex-shrink: 0;
    white-space: nowrap;
}

.sidebar-item-icon {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg4);
}
.sidebar-item-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }

.sidebar-item-name {
    font-family: var(--fb);
    font-size: 12px;
    color: var(--text2);
    line-height: 1.3;
    transition: color .15s;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-item-name.highlight { color: var(--accent3); }

.sidebar-bloc-foot {
    display: flex;
    justify-content: flex-end;
    padding: 8px 14px;
    border-top: 1px solid var(--border);
    background: var(--bg3);
}

.sidebar-bloc-foot a {
    font-size: 11px;
    color: var(--text3);
    text-decoration: none;
    transition: color .15s;
}
.sidebar-bloc-foot a:hover { color: var(--accent3); }

/* ════════════════════════════════════════════
   BADGES GÉNÉRIQUES (pages publiques)
   .info-badge : équivalent public de .edit-linked-badge (qui n'existe qu'en style local dans
   produits/admin_edit.tpl et n'était donc pas chargé sur les pages publiques qui le réutilisaient
   par erreur — badge invisible/non stylé sur produits/view.tpl et card/view_deck.tpl).
   .qty-badge : variante contrastée pour mettre en avant une quantité (ex: ×3 cartes d'un deck).
════════════════════════════════════════════ */
.info-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 99px;
    background: var(--bg4);
    border: 1px solid var(--border2);
    color: var(--text3);
}

.qty-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 22px;
    padding: 0 7px;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-family: var(--fh);
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

/* ════════════════════════════════════════════
   BARRE DE PROGRESSION DE LECTURE
════════════════════════════════════════════ */
#progressBar {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 3px;
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: var(--bg3);
    z-index: 9999;
}
#progressBar::-webkit-progress-bar { background: transparent; }
#progressBar::-webkit-progress-value { background: var(--accent3); }
#progressBar::-moz-progress-bar { background: var(--accent3); }

/* Boutons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--r);
    border: none;
    cursor: pointer;
    font-family: var(--fm);
    font-size: 12px;
    font-weight: 500;
    transition: all .15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(116,27,71,.4); }
.btn-outline  { background: transparent; border: 1px solid var(--border2); color: var(--text2); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent3); background: var(--accent-bg); }
.btn-danger   { background: var(--red-bg); border: 1px solid rgba(248,113,113,.3); color: var(--red); }
.btn-danger:hover { background: rgba(248,113,113,.2); }
.btn-amber    { background: var(--amber-bg); border: 1px solid rgba(251,191,36,.3); color: var(--amber); }
.btn-amber:hover { background: rgba(251,191,36,.2); }
.btn-green    { background: var(--green-bg); border: 1px solid rgba(74,222,128,.3); color: var(--green); }
.btn-sm       { padding: 5px 11px; font-size: 11px; }
.btn-add      { background: var(--bg4); border: 1px dashed var(--border2); color: var(--text3); width: 100%; justify-content: center; margin-top: 8px; }
.btn-add:hover { border-color: var(--accent); color: var(--accent3); background: var(--accent-bg); }

/* Alertes */
.alert { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: var(--r); margin-bottom: 18px; font-size: 12px; }
.alert-ok  { background: var(--green-bg);  border: 1px solid rgba(74,222,128,.3);  color: var(--green); }
.alert-err { background: var(--red-bg);    border: 1px solid rgba(248,113,113,.3); color: var(--red); }
.alert-am  { background: var(--amber-bg);  border: 1px solid rgba(251,191,36,.3);  color: var(--amber); }

/* Alias pour Session::flash() (core/Session.php), qui génère encore les classes historiques
   "alert-success" / "error" côté PHP — évite un message flash non stylé dans les pages v3
   qui affichent {$MSGFLASH} brut (héritage v2, cf. admin_competition.tpl et consorts). */
.alert-success { background: var(--green-bg); border: 1px solid rgba(74,222,128,.3);  color: var(--green); }
.alert.error   { background: var(--red-bg);   border: 1px solid rgba(248,113,113,.3); color: var(--red); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 10px; font-weight: 600; }
.badge-accent { background: var(--accent-bg);  color: var(--accent3); border: 1px solid rgba(116,27,71,.3); }
.badge-green  { background: var(--green-bg);   color: var(--green);   border: 1px solid rgba(74,222,128,.3); }
.badge-amber  { background: var(--amber-bg);   color: var(--amber);   border: 1px solid rgba(251,191,36,.3); }
.badge-muted  { background: var(--bg4);        color: var(--text3);   border: 1px solid var(--border); }

/* Champs formulaire */
input[type=text], input[type=number], input[type=date],
input[type=url], input[type=email], input[type=password], select, textarea {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--r);
    color: var(--text);
    font-family: var(--fm);
    font-size: 13px;
    padding: 8px 12px;
    outline: none;
    width: 100%;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent2);
    box-shadow: 0 0 0 3px var(--accent-bg);
}
select option { background: var(--bg3); }
textarea { resize: vertical; min-height: 80px; line-height: 1.7; }
select:disabled, input:disabled { opacity: .4; cursor: not-allowed; }
label { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text3); font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 5px; }
.hint  { font-size: 11px; color: var(--text3); margin-top: 4px; }
code   { color: var(--accent3); background: var(--accent-bg); padding: 1px 5px; border-radius: 4px; font-size: 11px; }

/* Séparateur */
.divider { height: 1px; background: var(--border); margin: 18px 0; }

/* Toast */
.toast {
    position: fixed; bottom: 20px; right: 20px;
    background: var(--bg3); border: 1px solid var(--border2);
    border-radius: var(--r); padding: 10px 18px;
    font-size: 12px; z-index: 9999;
    opacity: 0; transform: translateY(6px);
    transition: all .22s; pointer-events: none;
}
.toast.show  { opacity: 1; transform: none; }
.toast.ok    { border-color: rgba(74,222,128,.4);  color: var(--green); }
.toast.err   { border-color: rgba(248,113,113,.4); color: var(--red); }
.toast.warn  { border-color: rgba(251,191,36,.4);  color: var(--amber); }

/* Scrollbar */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted2); }

/* ── Modale suppression ── */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}
.overlay.open { display: flex; }

.modal {
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--rl);
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn .18s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(.97) translateY(8px); }
    to   { opacity: 1; transform: none; }
}
.modal-head {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-title { font-family: var(--fh); font-size: 15px; font-weight: 700; color: var(--text); }
.modal-close {
    margin-left: auto; padding: 4px 10px; border-radius: 4px;
    border: 1px solid var(--border2); background: transparent;
    color: var(--text3); cursor: pointer; font-size: 13px; transition: all .15s;
}
.modal-close:hover { color: var(--red); border-color: var(--red); }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.modal-foot {
    padding: 12px 18px; border-top: 1px solid var(--border);
    display: flex; gap: 8px; justify-content: flex-end;
    background: var(--bg3);
}

/* ════════════════════════════════════════════
   VISIONNEUSE D'IMAGE ("colorbox")
   Équivalent maison, en JS natif, du plugin jQuery Colorbox utilisé en v2 (jQuery n'est pas chargé
   en v3). Cible tout lien class="colorbox". Déplacé depuis football.css (view_person.tpl) vers ici
   car réutilisé par profils/view.tpl — le HTML de l'overlay + le script restent à dupliquer dans
   chaque template qui l'utilise (pas de script global partagé dans ce projet), mais le CSS est
   commun.
════════════════════════════════════════════ */
.colorbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,.85);
    align-items: center;
    justify-content: center;
    padding: 40px;
    animation: colorboxFadeIn .15s ease;
}
.colorbox-overlay.open { display: flex; }

@keyframes colorboxFadeIn { from { opacity: 0; } to { opacity: 1; } }

.colorbox-overlay img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--r);
    box-shadow: 0 10px 40px rgba(0,0,0,.5);
}

.colorbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: 50%;
    color: var(--text2);
    cursor: pointer;
    transition: all .15s;
}
.colorbox-close:hover { color: var(--accent3); border-color: var(--accent2); }
.colorbox-close svg { width: 18px; height: 18px; }