/**
 * AMÉLIORATIONS ACCESSIBILITÉ & RESPONSIVE GLOBAL
 * Optimisations pour mobile, tablette et accessibilité
 */

/* ============================================
   ACCESSIBILITÉ - Focus visible
   ============================================ */
*:focus-visible {
    outline: 2px solid #6ee7b7;
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid #6ee7b7;
    outline-offset: 2px;
}

/* Skip to content link (pour screen readers) */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 0;
    background: #6ee7b7;
    color: #0a0e1a;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    font-weight: 700;
    z-index: 10000;
    border-radius: 0 0 8px 0;
}

.skip-to-content:focus {
    top: 0;
}

/* ============================================
   CONTENEURS RESPONSIVE
   ============================================ */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .container {
        padding: 0 2rem;
    }
}

@media (min-width: 1440px) {
    .container {
        padding: 0 3rem;
    }
}

/* ============================================
   CARTES & CONTENUS
   ============================================ */
.hero-card {
    padding: 1.5rem;
}

@media (min-width: 768px) {
    .hero-card {
        padding: 2rem;
    }
}

@media (min-width: 1024px) {
    .hero-card {
        padding: 2.5rem;
    }
}

/* ============================================
   BOUTONS RESPONSIVE
   ============================================ */
.btn,
button,
.button {
    min-height: 44px; /* Taille tactile recommandée */
    min-width: 44px;
    touch-action: manipulation; /* Améliore la réactivité tactile */
}

@media (max-width: 767px) {
    .btn,
    button {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* ============================================
   FORMULAIRES RESPONSIVE
   ============================================ */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select {
    min-height: 44px;
    font-size: 16px; /* Évite le zoom auto sur iOS */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

@media (max-width: 767px) {
    input,
    textarea,
    select {
        font-size: 16px !important; /* Force 16px sur mobile */
    }
}

/* ============================================
   IMAGES RESPONSIVE
   ============================================ */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

picture {
    display: block;
}

/* ============================================
   TABLEAUX RESPONSIVE
   ============================================ */
@media (max-width: 767px) {
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table thead {
        display: none; /* Masquer en-têtes sur mobile */
    }
    
    table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        padding: 1rem;
    }
    
    table td {
        display: block;
        text-align: right;
        padding: 0.5rem 0;
        border: none;
    }
    
    table td::before {
        content: attr(data-label);
        float: left;
        font-weight: 700;
        color: #6ee7b7;
    }
}

/* ============================================
   GRILLES RESPONSIVE
   ============================================ */
.grid,
.member-select-grid,
.builds-grid {
    display: grid;
    gap: 1rem;
}

/* Mobile: 1 colonne */
@media (max-width: 767px) {
    .grid,
    .member-select-grid,
    .builds-grid {
        grid-template-columns: 1fr;
    }
}

/* Tablette: 2 colonnes */
@media (min-width: 768px) and (max-width: 1023px) {
    .grid,
    .member-select-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .builds-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: 3+ colonnes */
@media (min-width: 1024px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .member-select-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .builds-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

/* ============================================
   MODALES RESPONSIVE
   ============================================ */
.modal,
.dialog {
    max-width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .modal,
    .dialog {
        max-width: 600px;
    }
}

@media (min-width: 1024px) {
    .modal.large,
    .dialog.large {
        max-width: 900px;
    }
}

/* ============================================
   TEXTES RESPONSIVE
   ============================================ */
h1 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
}

p,
li {
    font-size: clamp(0.9rem, 2vw, 1rem);
    line-height: 1.7;
}

/* ============================================
   ESPACEMENT RESPONSIVE
   ============================================ */
.section {
    padding: 2rem 0;
}

@media (min-width: 768px) {
    .section {
        padding: 3rem 0;
    }
}

@media (min-width: 1024px) {
    .section {
        padding: 4rem 0;
    }
}

/* ============================================
   UTILITAIRES RESPONSIVE
   ============================================ */
/* Cacher/Afficher selon device */
.hide-mobile {
    display: none;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: block;
    }
    
    .hide-desktop {
        display: none;
    }
}

.show-mobile {
    display: block;
}

@media (min-width: 768px) {
    .show-mobile {
        display: none;
    }
}

/* ============================================
   PERFORMANCE - Réduire animations sur mobile
   ============================================ */
@media (max-width: 767px) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    /* Garder animations essentielles */
    .message-badge,
    .guild-role-badge,
    .loading,
    .spinner {
        animation-duration: revert !important;
        animation-iteration-count: revert !important;
    }
}

/* ============================================
   DARK MODE - Support système
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Déjà en dark mode par défaut */
}

@media (prefers-color-scheme: light) {
    /* Forcer dark mode même si préférence light */
    body {
        background: #020617;
        color: #e6eef6;
    }
}

/* ============================================
   REDUCED MOTION - Accessibilité
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================
   PRINT - Styles d'impression
   ============================================ */
@media print {
    .site-header,
    .social-widgets,
    .footer,
    .mobile-menu-toggle,
    .widget-toggle-btn,
    button,
    .btn {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    a {
        text-decoration: underline;
    }
    
    a::after {
        content: " (" attr(href) ")";
    }
}

/* ============================================
   ORIENTATION - Paysage mobile
   ============================================ */
@media (max-width: 767px) and (orientation: landscape) {
    .site-header {
        height: 56px;
    }
    
    .header-menu {
        height: 100vh;
    }
}
