/* ============================================================
   Royaume d'Éthoria - Styles globaux
   Thème clair + sombre, toggle via data-theme sur <html>
   ============================================================ */

:root {
    --bg:        #f6f1e7;
    --surface:   #ffffff;
    --surface-2: #f0e9d8;
    --text:      #2a1f12;
    --muted:     #6b5a44;
    --border:    #d8c9a6;
    --primary:   #8b1e1e;       /* rouge héraldique */
    --primary-2: #a83232;
    --accent:    #b58a2a;       /* or */
    --success:   #2d6a4f;
    --danger:    #9d1d1d;
    --warning:   #b58a2a;
    --info:      #345995;
    --shadow:    0 4px 16px rgba(50, 30, 10, .12);
    --radius:    10px;
    --font-head: 'Cinzel', 'Trajan Pro', Georgia, serif;
    --font-body: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html[data-theme="dark"] {
    --bg:        #121018;
    --surface:   #1c1827;
    --surface-2: #262134;
    --text:      #ece8df;
    --muted:     #aaa291;
    --border:    #3a3447;
    --primary:   #c74242;
    --primary-2: #e05a5a;
    --accent:    #e0b34a;
    --success:   #4ec37c;
    --danger:    #e05a5a;
    --warning:   #e0b34a;
    --info:      #6ca0e9;
    --shadow:    0 4px 18px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    display: flex; flex-direction: column;
}

h1,h2,h3,h4 { font-family: var(--font-head); color: var(--text); letter-spacing: .02em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: .8rem 1.5rem;
    display: flex; align-items: center; gap: 1.2rem;
    box-shadow: var(--shadow);
    position: sticky; top: 0; z-index: 100;
}
.site-brand {
    font-family: var(--font-head);
    font-size: 1.4rem;
    color: var(--primary);
    font-weight: 700;
    margin-right: 1rem;
}
.site-nav { display: flex; gap: 1rem; flex: 1; flex-wrap: wrap; }
.site-nav a { color: var(--text); padding: .35rem .6rem; border-radius: 6px; }
.site-nav a:hover { background: var(--surface-2); text-decoration: none; }
.site-actions { display: flex; align-items: center; gap: .6rem; }
.theme-toggle {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 999px;
    padding: .35rem .8rem;
    cursor: pointer;
    font-size: .9rem;
}
.theme-toggle:hover { border-color: var(--primary); }
.currency-badge {
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: .3rem .7rem;
    border-radius: 999px;
    font-size: .9rem;
    color: var(--accent);
    font-weight: 600;
}

main.container { max-width: 1150px; margin: 0 auto; padding: 1.5rem; flex: 1; width: 100%; }

.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1.2rem;
    text-align: center;
    color: var(--muted);
    font-size: .9rem;
}

/* Alerts / flash */
.alert { padding: .8rem 1rem; border-radius: var(--radius); margin: .5rem 0; border: 1px solid var(--border); }
.alert-success { background: rgba(46,106,79,.15); border-color: var(--success); }
.alert-danger  { background: rgba(157,29,29,.15); border-color: var(--danger); }
.alert-warning { background: rgba(181,138,42,.15); border-color: var(--warning); }
.alert-info    { background: rgba(52,89,149,.15); border-color: var(--info); }

/* Buttons */
.btn {
    display: inline-block; padding: .55rem 1.1rem;
    background: var(--primary); color: #fff; border: none;
    border-radius: var(--radius); cursor: pointer; font-weight: 600;
    font-family: var(--font-body);
    transition: background .15s;
    text-decoration: none;
}
.btn:hover { background: var(--primary-2); text-decoration: none; color: #fff; }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-accent { background: var(--accent); color: #2a1f12; }
.btn-danger { background: var(--danger); }
.btn-sm { padding: .3rem .7rem; font-size: .85rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
label { display: block; margin-bottom: .3rem; font-weight: 600; }
.input, textarea, select {
    width: 100%; padding: .55rem .75rem;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-family: var(--font-body); font-size: 1rem;
}
.input:focus, textarea:focus, select:focus {
    outline: 2px solid var(--primary); border-color: var(--primary);
}

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .8rem; border-bottom: 1px solid var(--border); text-align: left; }
th { background: var(--surface-2); font-weight: 700; }

/* Cards (UI) */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* Cartes de jeu (affichage HTML) */
.game-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: .6rem;
    text-align: center;
    position: relative;
    min-height: 160px;
    display: flex; flex-direction: column; justify-content: space-between;
    transition: transform .12s;
}
.game-card:hover { transform: translateY(-3px); }
.game-card .gc-cost {
    position: absolute; top: -8px; left: -8px;
    background: var(--info); color: #fff;
    width: 28px; height: 28px; border-radius: 50%;
    display: grid; place-items: center; font-weight: 700;
}
.game-card .gc-name { font-family: var(--font-head); font-weight: 700; font-size: .95rem; }
.game-card .gc-theme { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.game-card .gc-stats { display: flex; justify-content: space-between; font-weight: 700; margin-top: .4rem; }
.game-card .gc-atk { color: var(--danger); }
.game-card .gc-def { color: var(--info); }
.game-card .gc-armor { color: #8b7355; font-size: .85em; }
.game-card .gc-shield { color: #7b4fc7; font-size: .85em; }
.game-card .gc-stats { display: flex; justify-content: center; gap: .5rem; flex-wrap: wrap; font-weight: 700; margin-top: .4rem; }
.game-card.rarity-commun     { border-color: #888; }
.game-card.rarity-rare       { border-color: #3a7ad1; }
.game-card.rarity-epique     { border-color: #a34fd1; }
.game-card.rarity-legendaire { border-color: #e0a02a; box-shadow: 0 0 8px rgba(224,160,42,.4); }
.game-card.rarity-mythique   { border-color: #d13a3a; box-shadow: 0 0 12px rgba(209,58,58,.5); }
/* Faction themes */
.game-card.theme-dragon       { background: linear-gradient(135deg, var(--surface) 70%, rgba(200,60,30,.15)); }
.game-card.theme-chevalerie   { background: linear-gradient(135deg, var(--surface) 70%, rgba(180,180,200,.2)); }
.game-card.theme-fee          { background: linear-gradient(135deg, var(--surface) 70%, rgba(100,220,180,.15)); }
.game-card.theme-demon        { background: linear-gradient(135deg, var(--surface) 70%, rgba(120,20,60,.15)); }
.game-card.theme-elfe         { background: linear-gradient(135deg, var(--surface) 70%, rgba(50,160,80,.15)); }
.game-card.theme-neutre       { background: var(--surface); }
.game-card.theme-ordre_sacre  { background: linear-gradient(135deg, var(--surface) 70%, rgba(230,200,80,.2)); }

/* Hero / home */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff; padding: 3rem 2rem; border-radius: var(--radius);
    text-align: center; margin-bottom: 1.5rem;
}
.hero h1 { color: #fff; font-size: 2.4rem; margin-bottom: .4rem; }
.hero p { font-size: 1.1rem; opacity: .95; }

/* Admin sidebar */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 1rem; }
.admin-sidebar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; }
.admin-sidebar a { display: block; padding: .5rem .7rem; border-radius: 6px; color: var(--text); }
.admin-sidebar a:hover, .admin-sidebar a.active { background: var(--surface-2); text-decoration: none; }

/* Utilitaires */
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; gap: 1rem; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

@media (max-width: 720px) {
    .admin-layout { grid-template-columns: 1fr; }
    .site-nav { font-size: .9rem; }
    .hero h1 { font-size: 1.8rem; }
}
