/**
 * Styles personnalisés pour codeosys.fr
 * Complément à Tailwind CSS
 */

/* ============================================
   BASE - Empêcher le scroll horizontal
   ============================================ */
html {
    overflow-x: hidden;
    width: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
}

* {
    box-sizing: border-box;
}

/* ============================================
   LAYOUT - Scroll uniquement au survol
   ============================================ */
.scroll-on-hover {
    overflow-y: hidden;
    overflow-x: hidden;
    min-height: 0;
}

.scroll-on-hover:hover {
    overflow-y: auto;
    overflow-x: hidden;
}

/* ============================================
   FORMULAIRES - Checkboxes et Radio buttons
   ============================================ */
input[type="checkbox"],
input[type="radio"] {
    accent-color: #00bcd4; /* primary-500 - Turquoise vibrant */
    outline: none !important;
    box-shadow: none !important;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus,
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* ============================================
   NAVIGATION - Header responsive
   ============================================ */
.site-header__nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
    padding: 1rem;
    position: relative;
}

/* Liens de navigation (à gauche sur desktop) */
.site-header__nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
    order: 1;
    position: relative;
}

.site-header__nav-links a {
    white-space: nowrap;
}

/* Actions (panier et connexion à droite) */
.site-header__nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    order: 2;
    flex-shrink: 0;
    margin-left: auto;
    position: relative;
}

/* Panier */
.site-header__cart {
    display: flex;
    align-items: center;
}

.site-header__cart-link {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.icon-cart {
    width: 1.5rem;
    height: 1.5rem;
}

/* Mini-cart preview - positionné par rapport à la barre de navigation */
.mini-cart-preview {
    position: absolute;
    right: 1rem;
    top: calc(100% + 0.5rem);
    width: 20rem;
    max-width: calc(100vw - 2rem);
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Afficher le mini-cart au survol du panier */
/* Utilisation de :has() pour détecter le hover sur le panier */
.site-header__nav:has(.site-header__cart:hover) .mini-cart-preview {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Menu hamburger (caché sur desktop) */
.site-header__menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: inherit;
    width: auto;
    height: auto;
}

.site-header__menu-icon {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 3px;
}

.site-header__menu-icon span {
    width: 100%;
    height: 2px;
    background-color: currentColor;
    transition: all 0.3s;
    display: block;
}

/* ============================================
   RESPONSIVE - Mobile
   ============================================ */
@media (max-width: 768px) {
    .site-header__nav {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        padding: 0.75rem;
        gap: 0.75rem;
        overflow: visible;
        box-sizing: border-box;
    }
    
    /* Menu hamburger visible */
    .site-header__menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        order: 1;
        flex-shrink: 0;
        min-width: 2rem;
        min-height: 2rem;
    }
    
    /* Liens cachés par défaut */
    .site-header__nav-links {
        display: none !important;
        position: absolute;
        top: calc(100% - 0.5rem);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        width: 100%;
        background-color: white;
        padding: 0.75rem;
        padding-top: calc(0.75rem + 0.5rem);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        z-index: 100;
        order: 3;
        margin-top: 0;
        border-radius: 0 0 0.5rem 0.5rem;
        box-sizing: border-box;
    }
    
    .site-header__nav-links.active {
        display: flex !important;
    }
    
    /* Actions (hamburger, panier, connexion) sur la même ligne */
    .site-header__nav-actions {
        order: 2;
        margin-left: auto;
        flex-shrink: 0;
    }
    
    /* Mini-cart sur mobile : positionné à droite, largeur adaptée */
    .mini-cart-preview {
        right: 0;
        width: calc(100vw - 3rem);
        max-width: calc(100vw - 3rem);
    }
}

/* ============================================
   PAGINATION - Responsive
   ============================================ */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
}

.pagination-btn {
    white-space: nowrap;
    min-width: 2.5rem;
    text-align: center;
}

.pagination-btn-nav {
    font-size: 0.875rem;
}

.pagination-btn-page {
    min-width: 2.5rem;
}

.pagination-ellipsis {
    display: inline-block;
    white-space: nowrap;
}

/* Mobile : pagination simplifiée */
@media (max-width: 640px) {
    .pagination-container {
        gap: 0.25rem;
    }
    
    .pagination-btn-page {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        min-width: 2.25rem;
    }
    
    .pagination-btn-nav {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Masquer certaines pages */
    .pagination-btn-page:nth-child(n+5):not(:last-child):not(:nth-last-child(2)) {
        display: none;
    }
    
    .pagination-ellipsis {
        display: none;
    }
}

/* Très petit écran : seulement précédent/suivant et page actuelle */
@media (max-width: 480px) {
    .pagination-btn-page:not(.pagination-btn-page:first-of-type) {
        display: none;
    }
    
    .pagination-btn-page:first-of-type {
        display: inline-block;
    }
}

/* ============================================
   SCROLLBARS - Fines et discrètes
   ============================================ */
/* Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 1px;
    height: 1px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1; /* slate-300 */
    border-radius: 1px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; /* slate-400 */
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent; /* thumb track */
}

