/* Styles personnalisés - Design classique et professionnel */

/* Optimisations de performance - Lazy loading */
img.lazy,
picture.lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

img.lazy.loaded,
picture.lazy.loaded {
    opacity: 1;
}

/* Prévenir le layout shift avec aspect ratio */
img[loading="lazy"] {
    background-color: #f3f4f6;
}

/* ============================================
   ACCESSIBILITÉ
   ============================================ */

/* Skip link pour navigation clavier */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Focus visible amélioré pour tous les éléments interactifs */
*:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Focus ring pour Tailwind (si utilisé) */
.focus\:ring-2:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Amélioration du contraste pour les liens */
a {
    color: #2563eb;
}

a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Logo dans le header - pas de underline ni de bordure - FORCE SUR TOUTES LES PAGES */
nav a[aria-label*="Retour à l'accueil"],
nav a[aria-label*="Atlas PC"],
nav a[href="index.php"],
nav a[href*="index.php"] {
    text-decoration: none !important;
    border: 0 !important;
    border-bottom: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-top: 0 !important;
    border-width: 0 !important;
    outline: none !important;
    box-shadow: none !important;
}

nav a[aria-label*="Retour à l'accueil"]:hover,
nav a[aria-label*="Atlas PC"]:hover,
nav a[href="index.php"]:hover,
nav a[href*="index.php"]:hover {
    text-decoration: none !important;
    border: 0 !important;
    border-bottom: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-top: 0 !important;
    border-width: 0 !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Supprimer toutes les bordures sur le logo et le texte - FORCE */
nav a[aria-label*="Retour à l'accueil"] img,
nav a[aria-label*="Atlas PC"] img,
nav a[href="index.php"] img,
nav a[href*="index.php"] img,
nav img[alt*="Logo"],
nav img[alt*="Atlas PC"],
nav img[src*="logo.png"] {
    border: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-top: 0 !important;
    border-bottom: 0 !important;
    border-width: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    -moz-box-shadow: none !important;
}

nav a[aria-label*="Retour à l'accueil"] span,
nav a[aria-label*="Atlas PC"] span,
nav a[href="index.php"] span,
nav a[href*="index.php"] span {
    border: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-top: 0 !important;
    border-bottom: 0 !important;
    border-width: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    -moz-box-shadow: none !important;
}

/* Supprimer toute bordure entre les éléments du logo - FORCE */
nav a[href="index.php"] > *,
nav a[href*="index.php"] > * {
    border: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-top: 0 !important;
    border-bottom: 0 !important;
    border-width: 0 !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Force pour tous les éléments dans le conteneur du logo */
nav .container > div > a[href*="index"] * {
    border: 0 !important;
    border-width: 0 !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Contraste minimum pour le texte */
.text-gray-700 {
    color: #374151; /* Contraste WCAG AA */
}

.text-gray-600 {
    color: #4b5563; /* Contraste WCAG AA */
}

/* Navigation simple et élégante */
.nav-gradient {
    background: #2563eb; /* Bleu classique */
}

/* Force le texte blanc pour tous les liens dans la navbar admin */
.nav-gradient a {
    color: white !important;
}

.nav-gradient a:hover {
    color: white !important;
    text-decoration: underline;
}

/* ============================================
   SYSTÈME DE BOUTONS UNIFORME
   ============================================ */

/* Boutons principaux (bleu) */
.btn-primary {
    background: #2563eb;
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-block;
    text-align: center;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Boutons secondaires (gris) */
.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    display: inline-block;
    text-align: center;
}

.btn-secondary:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Boutons de quantité (petits, carrés) */
.btn-quantity {
    background: #f3f4f6;
    color: #374151;
    font-weight: 700;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    min-width: 2.5rem;
    text-align: center;
}

.btn-quantity:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    transform: scale(1.05);
}

.btn-quantity:active {
    transform: scale(0.95);
}

/* Boutons de suppression (rouge) */
.btn-danger {
    background: #ef4444;
    color: white;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-block;
    text-align: center;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-danger:active {
    transform: translateY(0);
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Boutons de succès (vert) */
.btn-success {
    background: #10b981;
    color: white;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-block;
    text-align: center;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-success:active {
    transform: translateY(0);
}

/* Boutons de suppression (lien texte rouge) */
.btn-link-danger {
    color: #ef4444;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-link-danger:hover {
    color: #dc2626;
    background: #fee2e2;
    text-decoration: underline;
}

/* Boutons sombres (gris foncé) */
.btn-dark {
    background: #374151;
    color: white;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-block;
    text-align: center;
    box-shadow: 0 2px 4px rgba(55, 65, 81, 0.2);
}

.btn-dark:hover {
    background: #1f2937;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(55, 65, 81, 0.4);
}

.btn-dark:active {
    transform: translateY(0);
}

/* Boutons d'icônes (petits, carrés) */
.btn-icon {
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-blue {
    background: #dbeafe;
    color: #1e40af;
}

.btn-icon-blue:hover {
    background: #bfdbfe;
    transform: scale(1.05);
}

.btn-icon-green {
    background: #d1fae5;
    color: #065f46;
}

.btn-icon-green:hover {
    background: #a7f3d0;
    transform: scale(1.05);
}

.btn-icon-gray {
    background: #f3f4f6;
    color: #374151;
}

.btn-icon-gray:hover {
    background: #e5e7eb;
    transform: scale(1.05);
}

.btn-icon-red {
    background: #fee2e2;
    color: #991b1b;
}

.btn-icon-red:hover {
    background: #fecaca;
    transform: scale(1.05);
}

.btn-icon:active {
    transform: scale(0.95);
}

/* ============================================
   RECHERCHE AVANCÉE
   ============================================ */

/* Suggestions autocomplete */
#search-suggestions,
#mobile-search-suggestions {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

#search-suggestions a,
#mobile-search-suggestions a {
    border-bottom: 1px solid #f3f4f6;
}

#search-suggestions a:last-child,
#mobile-search-suggestions a:last-child {
    border-bottom: none;
}

/* Animation pour les suggestions */
#search-suggestions,
#mobile-search-suggestions {
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cartes avec effet de profondeur */
.card-hover {
    transition: all 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

/* Masquer complètement la scrollbar (garder le scroll fonctionnel) */
#thumbs {
    -ms-overflow-style: none !important; /* IE/Edge */
    scrollbar-width: none !important; /* Firefox */
}

#thumbs::-webkit-scrollbar {
    display: none !important; /* Chrome/Safari */
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

/* ============================================
   NAVIGATION & MENU MOBILE
   ============================================ */

/* Navigation sticky */
nav.sticky {
    position: sticky;
    top: 0;
    z-index: 50;
}

/* Menu mobile animations */
#mobile-menu {
    transition: opacity 0.3s ease;
}

#menu-panel {
    transition: transform 0.3s ease-in-out;
}

/* Trust signals */
.trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 0.5rem;
    color: #166534;
    font-size: 0.875rem;
    font-weight: 500;
}

.trust-badge svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

/* ============================================
   RESPONSIVE DESIGN - AMÉLIORATIONS MOBILE
   ============================================ */

/* Touch targets minimum 44x44px pour mobile */
@media (max-width: 640px) {
    button, a, input[type="submit"], input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Espacement amélioré sur mobile */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Textes plus lisibles sur mobile */
    body {
        font-size: 16px; /* Évite le zoom auto sur iOS */
        line-height: 1.6;
    }
    
    /* Grilles plus compactes */
    .grid {
        gap: 1rem;
    }
    
    /* Cards produits sur mobile */
    .card-hover {
        margin-bottom: 0.5rem;
    }
    
    /* Formulaires plus espacés */
    form input,
    form textarea,
    form select {
        font-size: 16px; /* Évite le zoom auto sur iOS */
    }
}

/* Améliorations pour tablettes */
@media (min-width: 641px) and (max-width: 1024px) {
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* Améliorations pour très petits écrans */
@media (max-width: 375px) {
    /* Logo plus petit */
    nav img {
        height: 2rem !important;
    }
    
    nav span {
        font-size: 1rem !important;
    }
    
    /* Espacement réduit */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* Grille 1 colonne sur très petits écrans */
    #produits {
        grid-template-columns: 1fr !important;
    }
}

/* Amélioration de la lisibilité sur tous les écrans */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
}

/* Images responsives */
img {
    max-width: 100%;
    height: auto;
}

/* Prévenir le débordement horizontal */
body {
    overflow-x: hidden;
}

/* Amélioration des boutons sur mobile */
@media (max-width: 640px) {
    .btn-primary,
    .btn-secondary,
    .btn-danger,
    .btn-success {
        width: 100%;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Espacement entre boutons */
    .btn-primary + .btn-primary,
    .btn-secondary + .btn-secondary {
        margin-top: 0.75rem;
    }
}

/* Amélioration du menu mobile */
@media (max-width: 768px) {
    #menu-panel {
        width: 85vw;
        max-width: 320px;
    }
}

/* Amélioration des tableaux sur mobile */
@media (max-width: 768px) {
    table {
        font-size: 0.875rem;
    }
    
    table th,
    table td {
        padding: 0.5rem 0.25rem;
    }
}

/* Amélioration des modales et overlays */
@media (max-width: 640px) {
    /* Suggestions de recherche */
    #search-suggestions,
    #mobile-search-suggestions {
        max-height: 60vh;
        font-size: 0.875rem;
    }
}

/* Amélioration de la navigation sticky sur mobile */
@media (max-width: 768px) {
    nav.sticky {
        position: sticky;
        top: 0;
        z-index: 50;
    }
    
    /* Prévenir le scroll horizontal */
    nav .container {
        overflow-x: hidden;
    }
}

/* Amélioration des inputs sur mobile */
@media (max-width: 640px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px; /* Évite le zoom auto sur iOS */
        padding: 0.75rem;
    }
}

/* ============================================
   BOUTON WHATSAPP STICKY
   ============================================ */

/* Bouton WhatsApp flottant */
a[href*="wa.me"] {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 50;
    background: #25D366;
    color: white;
    border-radius: 50%;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    min-width: 64px;
    min-height: 64px;
}

a[href*="wa.me"]:hover {
    background: #20BA5A;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.5);
}

a[href*="wa.me"]:active {
    transform: scale(0.95);
}

a[href*="wa.me"] svg {
    width: 32px;
    height: 32px;
}

/* Responsive pour mobile */
@media (max-width: 640px) {
    a[href*="wa.me"] {
        bottom: 1rem;
        right: 1rem;
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
        padding: 0.75rem;
    }
    
    a[href*="wa.me"] svg {
        width: 28px;
        height: 28px;
    }
}

/* Animation pulse pour attirer l'attention */
@keyframes pulse-whatsapp {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.6);
    }
}

a[href*="wa.me"] {
    animation: pulse-whatsapp 2s ease-in-out infinite;
}
