/**
 * OnMyShop SEO & Performance Optimization CSS
 * Styles pour améliorer le SEO et les performances
 */

/* Lazy loading styles */
img.lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

img.loaded {
    opacity: 1;
}

/* Optimisation des images */
img {
    max-width: 100%;
    height: auto;
    loading: lazy; /* Lazy loading natif pour les navigateurs modernes */
}

/* Amélioration de l'accessibilité */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible pour l'accessibilité */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Optimisation des performances */
.product-item img {
    will-change: transform;
    transform: translateZ(0);
}

/* Amélioration du contraste pour l'accessibilité */
.text-muted {
    color: #6c757d !important;
}

/* Optimisation des boutons */
.btn {
    transition: all 0.2s ease-in-out;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Optimisation des cartes produits */
.product-item {
    transition: all 0.3s ease;
    will-change: transform;
}

.product-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

/* Amélioration de la lisibilité */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    margin-bottom: 1rem;
}

p {
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Optimisation des formulaires */
.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
}

/* Amélioration des liens */
a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Optimisation des performances pour les animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

/* Responsive images */
.responsive-img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Optimisation des icônes */
.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: middle;
}

/* Amélioration de la navigation */
.nav-link {
    position: relative;
    transition: color 0.2s ease;
}

.nav-link:hover::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #007bff;
}

/* Optimisation des tableaux */
.table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
}

.table th,
.table td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid #dee2e6;
}

/* Amélioration des alertes */
.alert {
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* Optimisation des modales */
.modal {
    z-index: 1050;
}

.modal-backdrop {
    z-index: 1040;
}

/* Amélioration de l'UX */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Optimisation pour les écrans tactiles */
@media (hover: none) and (pointer: coarse) {
    .product-item:hover {
        transform: none;
        box-shadow: none;
    }
    
    .btn:hover {
        transform: none;
        box-shadow: none;
    }
}

/* Amélioration de la performance sur mobile */
@media (max-width: 768px) {
    .product-item {
        margin-bottom: 1rem;
    }
    
    .product-item img {
        height: 200px;
        object-fit: cover;
    }
}

/* Optimisation pour l'impression */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
}
