/* ============================================
   RESPONSIVE CSS - VERSION FINALE
   Problèmes résolus :
   - Éléments tactiles : 48px minimum
   - Tailles de police : minimum 14px (0.875rem)
   - Menu burger mobile fonctionnel
   - Tableaux responsives
   ============================================ */

/* ===== VARIABLES ===== */
:root {
    --breakpoint-mobile: 480px;
    --breakpoint-tablet: 768px;
    --breakpoint-desktop: 992px;
    --breakpoint-large: 1200px;
    --spacing-mobile: 10px;
    --spacing-tablet: 15px;
    --spacing-desktop: 20px;
}

/* ===== RÉINITIALISATION DE BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    overflow-x: hidden;
    font-size: 16px;
}

body {
    width: 100%;
    overflow-x: hidden;
    font-family: 'Segoe UI', Arial, sans-serif;
    line-height: 1.5;
    font-size: 1rem;
}

/* ===== CONTENEURS ===== */
.container,
.content,
[class*="container"]:not(.no-responsive) {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--spacing-desktop);
    padding-right: var(--spacing-desktop);
}

/* ===== GRILLES RESPONSIVES ===== */
.grid-2,
.grid-3,
.grid-auto,
.metaphor-grid,
.offres-grid,
.info-grid,
.cards-container {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-auto,
.metaphor-grid,
.offres-grid,
.cards-container {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Fallback pour les navigateurs anciens */
@supports not (display: grid) {
    .grid-2,
    .grid-3,
    .metaphor-grid {
        display: flex;
        flex-wrap: wrap;
    }
    .grid-2 > *,
    .grid-3 > *,
    .metaphor-grid > * {
        flex: 1 1 280px;
        margin: 10px;
    }
}

/* ===== SECTION HERO ===== */
.hero-content {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.hero-text {
    flex: 1;
    min-width: 200px;
}

.hero-image {
    flex: 0 0 35%;
}

.hero-image img {
    width: 100%;
    height: auto;
    border-radius: 16px;
}

/* ===== CARTES ===== */
.card,
.offre-card,
.metaphor-card,
.highlight-box {
    padding: 20px;
    border-radius: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* ============================================
   CORRECTION 1 : ÉLÉMENTS TACTILES (48px minimum)
   ============================================ */
.btn,
button,
[class*="btn"],
[type="submit"],
[type="button"],
.btn-offre,
.btn-commander,
.nav-links li a,
.mobile-menu-toggle,
.back-link,
.login-button,
.logout-link,
.admin-link,
.close-bandeau,
.alert button,
.quantity-selector button,
.tab-btn,
.pagination a,
.pagination span {
    min-width: 48px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Navigation links */
.nav-links li a {
    padding: 12px 16px !important;
}

/* Menu burger */
.mobile-menu-toggle {
    min-width: 48px;
    min-height: 48px;
    padding: 12px;
}

/* Badge panier - zone cliquable agrandie */
.panier-badge {
    min-width: 24px;
    min-height: 24px;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Espacement entre éléments cliquables */
.nav-links,
.hero-buttons,
.metaphor-buttons,
.offre-card .btn {
    gap: 12px;
}

/* ===== BOUTONS ===== */
.btn,
button,
[class*="btn"],
[type="submit"],
.btn-offre,
.btn-commander {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

/* ===== FORMULAIRES ===== */
input,
textarea,
select,
.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus,
.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

/* ===== TABLEAUX ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 15px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}
/* ============================================
   CORRECTIONS SPÉCIFIQUES HEADER
   ============================================ */

/* Ajustements pour que le header tienne sur une seule ligne */
@media screen and (min-width: 769px) and (max-width: 1100px) {
    .header-content {
        gap: 8px !important;
    }
    
    .nav-links {
        gap: 2px !important;
    }
    
    .nav-links li a {
        padding: 10px 8px !important;
        font-size: 0.8rem !important;
        gap: 4px !important;
    }
    
    .nav-links li a i {
        font-size: 0.85rem !important;
        margin-right: 2px !important;
    }
    
    .logo .logo-text {
        font-size: 1.1rem !important;
    }
}

/* Écrans très larges (>= 1101px) */
@media screen and (min-width: 1101px) {
    .nav-links li a {
        padding: 10px 14px !important;
    }
}

/* Pour éviter que le menu ne déborde sur les écrans entre 769px et 900px */
@media screen and (min-width: 769px) and (max-width: 900px) {
    /* Cache le texte des liens sur cette plage, garde les icônes + bouton Connexion */
    .nav-links li a span:not(.panier-badge) {
        display: none !important;
    }
    
    .nav-links li a.login-button span {
        display: inline !important;
    }
    
    .nav-links li a i {
        margin-right: 0 !important;
        font-size: 1rem !important;
    }
    
    .nav-links li a {
        padding: 10px 6px !important;
        min-width: 40px;
    }
}



/* Version mobile des tableaux */
@media (max-width: 768px) {
    .table-mobile-cards {
        display: block;
    }
    
    .table-mobile-cards thead {
        display: none;
    }
    
    .table-mobile-cards tbody,
    .table-mobile-cards tr,
    .table-mobile-cards td {
        display: block;
        width: 100%;
    }
    
    .table-mobile-cards tr {
        margin-bottom: 20px;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 15px;
        background: white;
    }
    
    .table-mobile-cards td {
        text-align: right;
        padding-left: 50%;
        position: relative;
        border: none;
        padding: 8px 0;
    }
    
    .table-mobile-cards td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        text-align: left;
        font-weight: bold;
    }
}

/* ===== ALERTES ===== */
.alert {
    padding: 15px;
    margin: 15px 0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.9375rem;
}

/* ===== ADMIN TOOLBAR ===== */
.admin-toolbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.admin-toolbar button {
    min-width: 48px;
    min-height: 48px;
    padding: 8px 16px;
    font-size: 0.875rem;
}

/* ============================================
   CORRECTION 2 : TAILLES DE POLICE (minimum 14px)
   ============================================ */

/* Typographie générale */
h1 { font-size: clamp(1.5rem, 5vw, 2.5rem); margin-bottom: 1rem; }
h2 { font-size: clamp(1.25rem, 4vw, 2rem); margin-bottom: 0.875rem; }
h3 { font-size: clamp(1.125rem, 3.5vw, 1.5rem); margin-bottom: 0.75rem; }
h4 { font-size: clamp(1rem, 3vw, 1.25rem); margin-bottom: 0.5rem; }

/* Textes courants - minimum 15px */
p, li, .text-base, .description, .offre-description, .hero p {
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* Petits textes - minimum 14px */
.small-text, 
.tva-info, 
.offre-prix-detail, 
.form-text, 
.price-striked,
.legal-notice,
.footer-bottom,
.credit-card-footer,
.mention {
    font-size: 0.875rem;
}

/* Prix */
.offre-prix,
.product-price {
    font-size: clamp(1.3rem, 4vw, 1.8rem);
}

/* ============================================
   MEDIA QUERIES PRINCIPALES
   ============================================ */

/* TABLETTE (max-width: 1024px) */
@media screen and (max-width: 1024px) {
    .container,
    .content {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero-image {
        flex: 0 0 40%;
    }
}

/* TABLETTE PETITE / MOBILE LARGE (max-width: 768px) */
@media screen and (max-width: 768px) {
    html {
        font-size: 15px;
        -webkit-text-size-adjust: 100%;
    }
    
    body {
        min-width: 320px;
        overflow-x: hidden;
        font-size: 0.9375rem;
    }
    
    /* Conteneurs pleine largeur */
    .container,
    .content,
    [class*="container"] {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    
    /* Grilles - passage en colonne unique */
    .grid-2,
    .grid-3,
    .grid-auto,
    .metaphor-grid,
    .offres-grid,
    .cards-container,
    [class*="grid"]:not(.keep-grid) {
        display: block !important;
    }
    
    .grid-2 > *,
    .grid-3 > *,
    .grid-auto > *,
    .metaphor-grid > *,
    .offres-grid > *,
    .cards-container > * {
        width: 100% !important;
        margin-bottom: 20px !important;
    }
    
    /* Hero section */
    .hero-content {
        flex-direction: column !important;
        text-align: center;
    }
    
    .hero-text {
        width: 100% !important;
        text-align: center;
    }
    
    .hero-image {
        width: 80% !important;
        margin: 0 auto;
    }
    
    /* Boutons - pleine largeur */
    .btn,
    button,
    [class*="btn"],
    [type="submit"],
    .btn-offre,
    .btn-commander {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        margin: 8px 0 !important;
        min-height: 48px;
    }
    
    .hero-buttons {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .hero-buttons .btn {
        width: 100% !important;
    }
    
    .metaphor-buttons {
        flex-direction: column;
    }
    
    .metaphor-buttons .btn {
        width: 100%;
    }
    
    /* Images */
    img,
    [class*="image"] {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Tableaux - scroll horizontal */
    table:not(.no-scroll),
    [class*="table"]:not(.no-scroll) {
        display: block !important;
        overflow-x: auto !important;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Formulaires - taille 16px pour éviter zoom iOS */
    input,
    textarea,
    select {
        width: 100% !important;
        font-size: 16px !important;
    }
    
    /* Admin toolbar */
    .admin-toolbar {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .admin-toolbar button {
        font-size: 0.8rem;
        padding: 8px 12px;
        min-height: 44px;
    }
    
    /* Cartes */
    .card,
    .offre-card,
    .metaphor-card {
        margin-bottom: 15px;
    }
    
    /* Prix */
    .offre-prix {
        font-size: 1.5rem;
    }
    
    /* Onglets */
    .tabs-header {
        flex-direction: column;
    }
    
    .tab-btn {
        width: 100%;
        justify-content: center;
        min-height: 48px;
        padding: 12px;
    }
    
    /* Modal */
    .modal-content,
    .maintenance-card {
        width: 90% !important;
        margin: 20px auto !important;
        padding: 20px !important;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination a,
    .pagination span {
        margin: 5px;
        min-width: 44px;
    }
}

/* MOBILE (max-width: 480px) */
@media screen and (max-width: 480px) {
    html {
        font-size: 15px;
    }
    
    .container,
    .content {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    /* Tailles de police adaptées */
    h1 {
        font-size: 1.5rem !important;
    }
    h2 {
        font-size: 1.3rem !important;
    }
    h3 {
        font-size: 1.1rem !important;
    }
    h4 {
        font-size: 1rem !important;
    }
    
    p, li, .text-base, .description {
        font-size: 0.9375rem !important;
    }
    
    .small-text, .tva-info, .offre-prix-detail, .price-striked {
        font-size: 0.875rem !important;
    }
    
    /* Logo */
    .logo .logo-text,
    .logo h1 {
        font-size: 1rem !important;
    }
    
    /* Prix */
    .offre-prix {
        font-size: 1.3rem;
    }
    
    /* Badge panier */
    .panier-badge {
        min-width: 20px;
        height: 20px;
        font-size: 0.65rem;
    }
    
    /* Alertes */
    .alert {
        padding: 12px;
        font-size: 0.875rem;
    }
    
    /* Quantity selector */
    .quantity-selector {
        justify-content: center;
    }
    
    /* Espacements */
    .card,
    .offre-card,
    .metaphor-card,
    .highlight-box {
        padding: 15px;
    }
}

/* TRÈS PETIT MOBILE (max-width: 360px) */
@media screen and (max-width: 360px) {
    .container,
    .content {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    
    .hero-image {
        width: 100% !important;
    }
    
    .btn,
    button,
    [class*="btn"] {
        padding: 10px 12px;
        font-size: 0.875rem;
        min-height: 44px;
    }
    
    p, li {
        font-size: 0.875rem !important;
    }
}

/* ============================================
   UTILITAIRES RESPONSIVES
   ============================================ */

/* Affichage conditionnel */
.hide-on-mobile {
    display: block;
}

.hide-on-desktop {
    display: none;
}

.show-on-mobile {
    display: none;
}

@media screen and (max-width: 768px) {
    .hide-on-mobile {
        display: none !important;
    }
    .show-on-mobile {
        display: block !important;
    }
    .show-on-mobile-flex {
        display: flex !important;
    }
    .show-on-mobile-inline {
        display: inline !important;
    }
}

@media screen and (min-width: 769px) {
    .hide-on-desktop {
        display: none !important;
    }
}

/* Texte responsive */
.text-center-mobile {
    text-align: inherit;
}

@media screen and (max-width: 768px) {
    .text-center-mobile {
        text-align: center !important;
    }
}

/* Marges responsives */
.mt-responsive {
    margin-top: clamp(0.5rem, 3vw, 2rem);
}

.mb-responsive {
    margin-bottom: clamp(0.5rem, 3vw, 2rem);
}

/* Largeur pleine sur mobile */
.w-full-mobile {
    width: auto;
}

@media screen and (max-width: 768px) {
    .w-full-mobile {
        width: 100% !important;
    }
}

/* Flex direction responsive */
.flex-column-mobile {
    flex-direction: row;
}

@media screen and (max-width: 768px) {
    .flex-column-mobile {
        flex-direction: column !important;
    }
}

/* ============================================
   OPTIMISATIONS PERFORMANCES MOBILE
   ============================================ */

@media screen and (max-width: 768px) {
    /* Désactiver les animations au survol sur mobile */
    .card:hover,
    .offre-card:hover,
    .metaphor-card:hover,
    [class*="card"]:hover {
        transform: none !important;
    }
    
    /* Feedback tactile */
    .btn:active,
    button:active,
    .clickable:active {
        opacity: 0.7;
        transform: scale(0.98);
    }
    
    /* Réduire les ombres pour meilleures performances */
    .card,
    .offre-card,
    .metaphor-card {
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }
}

/* ============================================
   CORRECTIONS SPÉCIFIQUES POUR VOTRE SITE
   ============================================ */

/* Pages d'acquisition */
@media screen and (max-width: 768px) {
    .commande-container {
        padding: 0 5px;
    }
    
    .produit-resume {
        padding: 20px;
    }
    
    .produit-titre {
        font-size: 1.3rem;
        text-align: center;
    }
    
    .features-list li {
        font-size: 0.9375rem;
        padding: 10px 0;
    }
    
    .price-details {
        padding: 15px;
    }
    
    .price-row {
        font-size: 0.9375rem;
        flex-wrap: wrap;
        gap: 5px;
        padding: 8px 0;
    }
    
    .btn-commander {
        min-height: 48px;
    }
}

/* Panier */
@media screen and (max-width: 768px) {
    .cart-item {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
    
    .cart-item-actions {
        justify-content: center;
    }
    
    .cart-total {
        text-align: center;
    }
    
    .quantity-selector {
        justify-content: center;
    }
}

/* Visionneuse */
@media screen and (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        transition: left 0.3s ease;
        z-index: 1000;
        height: 100%;
        background: white;
        top: 0;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .split-container {
        flex-direction: column;
    }
    
    .split-pane {
        width: 100% !important;
    }
    
    .toolbar {
        flex-wrap: wrap;
    }
    
    .toolbar .edit-only {
        flex-wrap: wrap;
    }
}

/* Profil - onglets */
@media screen and (max-width: 768px) {
    .tabs {
        flex-direction: column;
    }
    
    .tab-button {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions .btn-outline {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   IMPRESSION
   ============================================ */

@media print {
    .admin-toolbar,
    .mobile-menu-toggle,
    .no-print,
    button:not(.no-print),
    .btn:not(.no-print),
    .nav-links,
    header,
    footer,
    .alert,
    .back-link {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
        font-size: 12pt;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }
    
    a {
        text-decoration: none;
        color: black;
    }
    
    @page {
        margin: 2cm;
    }
}