/* ══════════════════════════════════════════════════════════════
   29-mobile-first.css — Corrections responsive Mobile-First
   Appliqué APRÈS tous les autres CSS pour corriger le responsive

   Stratégie : styles de base = mobile, enrichis via min-width
   Breakpoints : sm=576px, md=768px, lg=992px, xl=1200px
   ══════════════════════════════════════════════════════════════ */

/* ══════ GLOBAL MOBILE FIXES ══════ */

/* Empêcher tout scroll horizontal */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* FOND : sur mobile, pas de fixed attachment (cause les gros espaces vides sur iOS) */
body {
    background-attachment: scroll !important;
    background-size: cover !important;
    background-position: center top !important;
}

@media (min-width: 992px) {
    body {
        background-attachment: fixed !important;
    }
}

/* Images responsives par défaut */
img, video, svg, picture {
    max-width: 100%;
    height: auto;
}

/* Boutons tactiles : taille minimum 44px (norme Apple) */
button, .btn, a.btn, .salle-btn, .cb-btn, .arn-btn, [type="submit"] {
    min-height: 44px;
}

/* Inputs tactiles confortables */
input, select, textarea {
    font-size: 16px !important; /* Empêche le zoom auto iOS */
}

/* ══════ PARCHEMIN WRAPPER — MOBILE ══════ */

/* De base (mobile) : padding réduit, pas de marges */
.salle-parch,
.cb-parch,
.faq-parch,
.ins-parch,
.forum-parchment {
    margin: 0.15rem;
    padding: 0.6rem 0.5rem 0.7rem;
    border-radius: 4px;
}

/* Coins décoratifs : plus petits sur mobile */
.salle-parch-corner,
.cb-parch-corner,
.faq-parch-corner,
.ins-parch-corner,
.parch-corner {
    width: 40px;
    height: 40px;
}

/* Sceau : plus petit sur mobile */
.salle-parch-seal,
.cb-parch-seal,
.faq-parch-seal,
.ins-parch-seal {
    width: 30px;
    height: 30px;
    font-size: 11px;
    top: -12px;
}

/* ≥ Tablette : restaurer les tailles normales */
@media (min-width: 768px) {
    .salle-parch,
    .cb-parch,
    .faq-parch,
    .ins-parch,
    .forum-parchment {
        margin: 0.35rem auto;
        padding: 1rem 1.3rem 1.1rem;
        border-radius: 6px;
    }
    .salle-parch-corner,
    .cb-parch-corner,
    .faq-parch-corner,
    .ins-parch-corner,
    .parch-corner {
        width: 80px;
        height: 80px;
    }
    .salle-parch-seal,
    .cb-parch-seal,
    .faq-parch-seal,
    .ins-parch-seal {
        width: 36px;
        height: 36px;
        font-size: 14px;
        top: -16px;
    }
}

/* ══════ HERO SECTIONS — MOBILE ══════ */

.salle-hero,
.cb-hero,
.faq-hero {
    padding: 0.55rem 0.7rem 0.5rem;
    margin-bottom: 0.5rem;
}

.salle-hero-title,
.cb-hero-title,
.faq-hero-title {
    font-size: 1rem;
    letter-spacing: 0.03em;
}

.salle-hero-icon,
.cb-hero-icon,
.faq-hero-icon {
    font-size: 1.2rem;
}

.salle-hero-sub,
.cb-hero-sub,
.faq-hero-sub {
    font-size: 0.68rem;
}

@media (min-width: 768px) {
    .salle-hero,
    .cb-hero,
    .faq-hero {
        padding: 0.85rem 1rem 0.75rem;
        margin-bottom: 0.7rem;
    }
    .salle-hero-title,
    .cb-hero-title,
    .faq-hero-title {
        font-size: 1.3rem;
        letter-spacing: 0.06em;
    }
    .salle-hero-icon,
    .cb-hero-icon,
    .faq-hero-icon {
        font-size: 1.85rem;
    }
}

/* ══════ RP BLOCKS — MOBILE ══════ */

.salle-rp {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.6rem;
    gap: 0.6rem;
}

.salle-rp-portrait img {
    width: 70px;
    height: 70px;
}

.salle-rp-portrait-name {
    font-size: 0.55rem;
}

.salle-rp-action {
    font-size: 0.72rem;
    line-height: 1.5;
}

.salle-rp-dialogue {
    border-left: none;
    border-top: 3px solid var(--salle-c, #8b5a1e);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
}

.salle-rp-dialogue p {
    font-size: 0.75rem;
    line-height: 1.5;
}

@media (min-width: 768px) {
    .salle-rp {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        padding: 0.8rem 1rem;
        gap: 1rem;
    }
    .salle-rp-portrait img {
        width: 100px;
        height: 100px;
    }
    .salle-rp-portrait-name {
        font-size: 0.6rem;
    }
    .salle-rp-action {
        font-size: 0.8rem;
        line-height: 1.65;
    }
    .salle-rp-dialogue {
        border-left: 3px solid var(--salle-c, #8b5a1e);
        border-top: none;
        border-radius: 0 6px 6px 0;
        padding: 0.5rem 0.8rem;
    }
    .salle-rp-dialogue p {
        font-size: 0.82rem;
        line-height: 1.7;
    }
}

/* ══════ CARDS — MOBILE ══════ */

.salle-card,
.cb-card,
.faq-card {
    padding: 0.55rem 0.6rem;
    margin-bottom: 0.45rem;
    border-radius: 9px;
}

.salle-card-title,
.cb-card-title {
    font-size: 0.78rem;
    gap: 0.3rem;
}

@media (min-width: 768px) {
    .salle-card,
    .cb-card,
    .faq-card {
        padding: 0.75rem 0.9rem;
        margin-bottom: 0.6rem;
        border-radius: 11px;
    }
    .salle-card-title,
    .cb-card-title {
        font-size: 0.88rem;
    }
}

/* ══════ SECTION TITLES — MOBILE ══════ */

.cb-stitle,
.salle-card-title {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
}

@media (min-width: 768px) {
    .cb-stitle {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }
}

/* ══════ TABS — MOBILE ══════ */

.salle-tabs,
.mg-tabs,
.faq-nav {
    gap: 0.2rem;
}

.salle-tab,
.mg-tab {
    font-size: 0.62rem;
    padding: 0.4rem 0.55rem;
    min-width: 0;
    flex: 1;
}

@media (min-width: 768px) {
    .salle-tab,
    .mg-tab {
        font-size: 0.74rem;
        padding: 0.5rem 0.85rem;
        min-width: 140px;
    }
}

/* ══════ BUTTONS — MOBILE ══════ */

.salle-btn,
.cb-btn {
    font-size: 0.6rem;
    padding: 0.45rem 0.6rem;
}

.salle-cta {
    font-size: 0.68rem;
    padding: 0.55rem 0.9rem;
}

@media (min-width: 768px) {
    .salle-btn,
    .cb-btn {
        font-size: 0.7rem;
        padding: 0.55rem 0.9rem;
    }
    .salle-cta {
        font-size: 0.78rem;
        padding: 0.7rem 1.2rem;
    }
}

/* ══════ STAT GRIDS — MOBILE ══════ */

.salle-stats,
.cb-stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
}

.salle-stat,
.cb-stat {
    padding: 0.35rem 0.5rem;
}

.cb-stat-val {
    font-size: 0.85rem;
}

.cb-stat-lbl {
    font-size: 0.48rem;
}

@media (min-width: 576px) {
    .cb-stat-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

@media (min-width: 768px) {
    .salle-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
    }
    .cb-stat-val {
        font-size: 1rem;
    }
    .cb-stat-lbl {
        font-size: 0.54rem;
    }
}

/* ══════ GRIDS — MOBILE ══════ */

.salle-grid-2,
.salle-grid-3,
.cb-grid-2,
.cb-grid-3,
.cb-grid-4,
.cb-lobby {
    grid-template-columns: 1fr !important;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .salle-grid-2,
    .cb-grid-2 {
        grid-template-columns: 1fr 1fr !important;
    }
    .cb-lobby {
        grid-template-columns: 1fr 1.3fr !important;
    }
}

@media (min-width: 992px) {
    .salle-grid-3,
    .cb-grid-3 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .cb-grid-4 {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ══════ FAQ — Styles gérés dans faq.php (inline) ══════ */

/* ══════ POKÉDEX / REGISTRE — MOBILE ══════ */

.pdx-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.35rem;
}

.pdx-card {
    padding: 0.4rem;
}

.pdx-avatar {
    width: 46px;
    height: 46px;
    font-size: 1.1rem;
}

.pdx-name {
    font-size: 0.62rem;
}

.fl-pers-grid {
    grid-template-columns: 1fr !important;
}

@media (min-width: 576px) {
    .pdx-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .fl-pers-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (min-width: 768px) {
    .pdx-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    .pdx-avatar {
        width: 56px;
        height: 56px;
        font-size: 1.3rem;
    }
    .pdx-name {
        font-size: 0.72rem;
    }
}

@media (min-width: 992px) {
    .pdx-grid {
        grid-template-columns: repeat(6, 1fr) !important;
    }
    .fl-pers-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ══════ CONNEXION — MOBILE ══════ */
@media (max-width: 991px) {
    .connexion-wrapper {
        justify-content: flex-start !important;
        padding: 0.5rem 0.3rem 1rem !important;
        min-height: auto !important;
    }
    .connexion-wrapper .parchment-card {
        max-width: 100%;
    }
}
@media (min-width: 992px) {
    .connexion-wrapper {
        justify-content: center !important;
        padding: 1.5rem 1rem !important;
        min-height: 100vh !important;
    }
}

/* Mobile uniquement : pas de 100vh qui bloque le scroll */
@media (max-width: 991px) {
    .main-column,
    .content {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        min-height: 0 !important;
    }
    .connexion-wrapper,
    .inscription-wrapper {
        min-height: auto !important;
        padding-top: 0.3rem !important;
    }
}

/* Pages parchemin génériques : réduire l'espace */
.ins-parch,
.forum-parchment {
    margin-top: 0.1rem !important;
}

/* ══════ CONNEXION / INSCRIPTION — desktop centré ══════ */
@media (min-width: 992px) {
    .inscription-wrapper {
        justify-content: center !important;
        padding: 1rem 1rem !important;
        min-height: 100vh !important;
    }
}

/* ══════ INSCRIPTION — MOBILE ══════ */
@media (max-width: 991px) {
    .inscription-wrapper {
        padding: 0.3rem 0.2rem 0.5rem !important;
        min-height: auto !important;
        justify-content: flex-start !important;
    }
    .ins-parch {
        padding: 0.5rem 0.4rem !important;
        margin: 0.1rem !important;
    }
}

.parchment-card {
    padding: 1rem 0.7rem 0.8rem !important;
    border-radius: 12px;
    max-height: none !important;
}

.magical-title {
    font-size: 0.95rem;
}

.genre-selector {
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.genre-card {
    width: 85%;
    max-width: 220px;
    flex-direction: row;
    padding: 0.5rem 0.7rem;
    gap: 0.5rem;
}

.genre-avatar-img {
    max-width: 70px;
}

.step-dot {
    width: 24px;
    height: 24px;
    font-size: 0.6rem;
}

.step-line {
    width: 10px;
}

.diff-grid {
    gap: 0.25rem;
}

.diff-name {
    font-size: 0.65rem;
}

.diff-desc {
    font-size: 0.5rem;
}

@media (min-width: 576px) {
    .genre-selector {
        flex-direction: row;
        gap: 1rem;
    }
    .genre-card {
        width: 180px;
        flex-direction: column;
        padding: 0.8rem 0.6rem;
    }
    .genre-avatar-img {
        max-width: 150px;
    }
    .step-dot {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    .step-line {
        width: 20px;
    }
}

@media (min-width: 768px) {
    .inscription-wrapper {
        padding: 1rem 0;
    }
    .parchment-card {
        padding: 1.5rem 2rem 1.2rem !important;
        border-radius: 16px;
    }
    .magical-title {
        font-size: 1.35rem;
    }
}

/* ══════ TABLES — MOBILE ══════ */

/* Tables : scroll horizontal sur mobile */
.cb-table,
table:not(.no-responsive) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
    .cb-table,
    table:not(.no-responsive) {
        display: table;
        overflow-x: visible;
    }
}

/* ══════ CONTENT BLOCK — MOBILE ══════ */

.content-block,
.pg-card {
    padding: 0.7rem;
    border-radius: 10px;
}

@media (min-width: 768px) {
    .content-block,
    .pg-card {
        padding: 1.2rem;
        border-radius: 14px;
    }
}

/* ══════ TYPOGRAPHY — MOBILE ══════ */

.pg-title {
    font-size: 0.9rem;
}

@media (min-width: 768px) {
    .pg-title {
        font-size: 1.1rem;
    }
}

/* ══════ MAIN CONTENT PADDING — MOBILE ══════ */

.content {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
}

@media (min-width: 576px) {
    .content {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

@media (min-width: 768px) {
    .content {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

@media (min-width: 992px) {
    .content {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }
}

/* ══════ ÉLÈVES GRID — MOBILE ══════ */

.salle-eleves-grid {
    grid-template-columns: 1fr;
    gap: 0.3rem;
}

@media (min-width: 576px) {
    .salle-eleves-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .salle-eleves-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* ══════ ADMIN MODAL — MOBILE ══════ */

.a-modal-box {
    max-width: 95vw;
    padding: 0.8rem;
    max-height: 90vh;
}

.a-modal-box form > div {
    grid-template-columns: 1fr !important;
}

@media (min-width: 768px) {
    .a-modal-box {
        max-width: 620px;
        padding: 1.3rem;
        max-height: 85vh;
    }
    .a-modal-box form > div {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* ══════ COMBAT PAGES — MOBILE ══════ */

/* Arène salons sur mobile : 1 colonne */
.arn-salons {
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .arn-salons {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .arn-salons {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Arène hero stats */
.arn-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem;
}

@media (min-width: 576px) {
    .arn-stats {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.4rem;
    }
}

/* ══════ SIDEBAR PLAYER CARD — MOBILE (visible < 992px) ══════ */

/* Le sidebar-content card est dans l'offcanvas mobile — déjà géré par Bootstrap */

/* ══════ ANNUAIRE — MOBILE ══════ */

.ann-grid {
    grid-template-columns: 1fr !important;
}

@media (min-width: 576px) {
    .ann-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (min-width: 992px) {
    .ann-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ══════ DECK — MOBILE ══════ */

.cb-dk-grid {
    grid-template-columns: 1fr !important;
    gap: 0.4rem;
}

@media (min-width: 576px) {
    .cb-dk-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (min-width: 992px) {
    .cb-dk-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (min-width: 1200px) {
    .cb-dk-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ══════ INDEX / ACCUEIL — MOBILE ══════ */

/* Page d'accueil parchemin */
.welcome-parchment,
.index-parch {
    margin: 0.1rem !important;
    padding: 0.5rem 0.4rem !important;
}

/* Titre Hogwarts RPG plus petit sur mobile */
.welcome-title,
.index-title {
    font-size: 1.4rem !important;
}

@media (min-width: 768px) {
    .welcome-parchment,
    .index-parch {
        margin: 0.35rem auto !important;
        padding: 1rem 1.3rem !important;
    }
    .welcome-title,
    .index-title {
        font-size: 2.2rem !important;
    }
}

/* Écussons maisons : 2 colonnes sur mobile au lieu de 4 */
.houses-grid,
.maisons-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
}

@media (min-width: 768px) {
    .houses-grid,
    .maisons-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 1rem !important;
    }
}

/* ══════ HEADER MOBILE — COMPACT ══════ */

/* Navbar mobile plus compacte */
.navbar-mobile {
    padding: 0.4rem 0.6rem !important;
}

.navbar-mobile .navbar-brand img {
    height: 38px !important;
    width: auto !important;
}

/* Header desktop : cacher sur mobile (Bootstrap le gère déjà avec d-lg-none) */
.rpg-header {
    font-size: 0.7rem;
}

@media (min-width: 992px) {
    .rpg-header {
        font-size: 0.78rem;
    }
}

/* Sidebar : styles consolidés dans 05-sidebar.css */

/* ══════ ATTENTE BETA — MOBILE ══════ */

.beta-parch {
    margin: 0.15rem !important;
    padding: 0.6rem 0.5rem !important;
}

.beta-card {
    padding: 0.6rem !important;
}

@media (min-width: 768px) {
    .beta-parch {
        margin: 0.35rem auto !important;
        padding: 1rem 1.3rem !important;
    }
}

/* ══════ PRINT ══════ */

@media print {
    .sidebar-desktop,
    .navbar-mobile,
    .sidebar-offcanvas,
    .rpg-header {
        display: none !important;
    }
    .content {
        padding: 0 !important;
    }
    body {
        background: white !important;
        color: black !important;
    }
}

/* ══════ ACCESSIBILITÉ ══════ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
