/**
 * CSS Principal - Strat'
 * Styles non-critiques chargés de manière asynchrone
 */

/* ========== FONTS ========== */
@font-face {
    font-family: 'System';
    src: local(-apple-system), local(BlinkMacSystemFont), local("Segoe UI"), 
         local(Roboto), local(Oxygen), local(Ubuntu), local(Cantarell), 
         local("Fira Sans"), local("Droid Sans"), local("Helvetica Neue");
    font-display: swap;
}

/* ========== COMPONENTS ========== */

/* Forms */
input,
textarea,
select {
    width: 100%;
    padding: 1.2rem 1.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    font-size: 1.6rem;
    transition: all 0.3s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(234, 93, 111, 0.1);
}

/* Cards */
.card {
    background: var(--bg);
    border-radius: 1.5rem;
    padding: 2.5rem;
    box-shadow: 0 5px 20px var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px var(--shadow);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.4rem 1.2rem;
    background: var(--surface);
    border-radius: 2rem;
    font-size: 1.3rem;
    font-weight: 500;
}

.badge-red {
    background: rgba(234, 93, 111, 0.1);
    color: var(--accent-red);
}

.badge-green {
    background: rgba(0, 161, 77, 0.1);
    color: var(--accent-green);
}

.badge-yellow {
    background: rgba(251, 204, 64, 0.1);
    color: var(--accent-yellow);
}

/* Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    padding: 0.8rem 1.2rem;
    background: var(--text);
    color: var(--bg);
    border-radius: 0.6rem;
    font-size: 1.3rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

/* ========== UTILITIES ========== */

/* Spacing */
.m-0 { margin: 0; }
.m-1 { margin: 0.5rem; }
.m-2 { margin: 1rem; }
.m-3 { margin: 1.5rem; }
.m-4 { margin: 2rem; }
.m-5 { margin: 3rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 3rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-5 { margin-bottom: 3rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }
.p-5 { padding: 3rem; }

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Display */
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

/* Flexbox */
.flex-row { flex-direction: row; }
.flex-column { flex-direction: column; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.align-start { align-items: flex-start; }
.align-center { align-items: center; }
.align-end { align-items: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }
.gap-5 { gap: 3rem; }

/* Grid */
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Width */
.w-25 { width: 25%; }
.w-50 { width: 50%; }
.w-75 { width: 75%; }
.w-100 { width: 100%; }
.w-auto { width: auto; }

/* Height */
.h-100 { height: 100%; }
.h-auto { height: auto; }

/* Position */
.position-relative { position: relative; }
.position-absolute { position: absolute; }
.position-fixed { position: fixed; }
.position-sticky { position: sticky; }

/* Z-index */
.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

/* Opacity */
.opacity-0 { opacity: 0; }
.opacity-25 { opacity: 0.25; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* ========== RESPONSIVE UTILITIES ========== */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .sm\:d-none { display: none; }
    .sm\:d-block { display: block; }
    .sm\:d-flex { display: flex; }
    .sm\:text-left { text-align: left; }
    .sm\:text-center { text-align: center; }
    .sm\:text-right { text-align: right; }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .md\:d-none { display: none; }
    .md\:d-block { display: block; }
    .md\:d-flex { display: flex; }
    .md\:text-left { text-align: left; }
    .md\:text-center { text-align: center; }
    .md\:text-right { text-align: right; }
    .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .lg\:d-none { display: none; }
    .lg\:d-block { display: block; }
    .lg\:d-flex { display: flex; }
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .xl\:d-none { display: none; }
    .xl\:d-block { display: block; }
    .xl\:d-flex { display: flex; }
}

/* ========== PRINT STYLES ========== */
@media print {
    /* Reset colors for print */
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    /* Hide non-essential elements */
    .header,
    .footer,
    .cookie-banner,
    .mobile-menu,
    .theme-toggle,
    .menu-toggle,
    .btn,
    .social-link {
        display: none !important;
    }
    
    /* Ensure good print layout */
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        break-after: avoid;
    }
    
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    
    /* Show URLs for links */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        font-weight: normal;
    }
    
    /* Expand abbreviated content */
    abbr[title]:after {
        content: " (" attr(title) ")";
    }
}

/* ========== DARK MODE OVERRIDES ========== */
[data-theme="dark"] {
    /* Adjust shadows for dark mode */
    .card {
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    }
    
    .card:hover {
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
    }
    
    /* Adjust image brightness */
    img {
        filter: brightness(0.9);
    }
    
    /* Code blocks */
    code,
    pre {
        background: var(--surface);
        color: var(--text);
    }
}

/* ========== PERFORMANCE OPTIMIZATIONS ========== */

/* Use GPU acceleration for animations */
.hero-device,
.floating,
.card,
.btn {
    will-change: transform;
}

/* Optimize font rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Prevent layout shifts from images */
img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

/* Optimize touch targets for mobile */
@media (hover: none) {
    .btn,
    .tab-button,
    .social-link {
        min-height: 48px;
        min-width: 48px;
    }
}

/* ========== ACCESSIBILITY ========== */

/* Focus styles */
:focus {
    outline: 3px solid var(--accent-red);
    outline-offset: 2px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-red);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
}

.skip-to-content:focus {
    top: 0;
}

/* Screen reader only text */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --accent-red: #ff0033;
        --accent-green: #00ff66;
        --accent-yellow: #ffcc00;
    }
    
    .btn-primary {
        border: 2px solid currentColor;
    }
}

/* ========== ANIMATIONS ========== */

/* Smooth page transitions */
.page-transition {
    animation: pageIn 0.5s ease-out;
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse animation for CTAs */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(234, 93, 111, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(234, 93, 111, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(234, 93, 111, 0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Skeleton loading animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton-loading {
    background: linear-gradient(
        90deg,
        var(--surface) 25%,
        var(--border) 50%,
        var(--surface) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ========== FLOATING CALL BUTTON ========== */
.floating-call-btn {
    --btn-size: 60px;
    --btn-color: var(--accent-red);
    --btn-shadow: 0 4px 20px rgba(234, 93, 111, 0.4);
    
    /* IMPORTANT : Caché par défaut sur TOUS les appareils */
    display: none !important;
    
    /* Positionnement fixe */
    position: fixed;
    bottom: 25px;
    right: 20px;
    z-index: 900;
    
    /* Dimensions et style */
    width: var(--btn-size);
    height: var(--btn-size);
    background: var(--btn-color);
    border-radius: 50%;
    box-shadow: var(--btn-shadow);
    
    /* Centrage du contenu */
    align-items: center;
    justify-content: center;
    
    /* Transitions */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Reset des styles de lien */
    text-decoration: none;
    color: white;
    
    /* IMPORTANT : Masquer le débordement pour l'effet de brillance */
    overflow: hidden;
    
    /* Optimisation des performances */
    will-change: transform;
    -webkit-tap-highlight-color: transparent;
    
    /* Animation de pulsation douce */
    animation: soft-pulse 2.5s ease-in-out infinite;
}

/* AFFICHAGE UNIQUEMENT SUR MOBILE - avec !important pour forcer */
@media only screen and (max-width: 768px) {
    .floating-call-btn {
        display: flex !important;
    }
}

/* S'assurer que c'est caché sur tablette et desktop */
@media only screen and (min-width: 769px) {
    .floating-call-btn {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

/* Animation de pulsation douce */
@keyframes soft-pulse {
    0%, 100% {
        box-shadow: 
            0 4px 20px rgba(234, 93, 111, 0.4),
            0 0 0 0 rgba(234, 93, 111, 0.4);
    }
    50% {
        box-shadow: 
            0 4px 20px rgba(234, 93, 111, 0.4),
            0 0 0 15px rgba(234, 93, 111, 0);
    }
}

/* Icône du téléphone */
.call-icon {
    width: 28px;
    height: 28px;
    position: relative;
    z-index: 2;
}

/* Effet de brillance - Optimisé pour light et dark mode */
.floating-call-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    transform: skewX(-20deg);
    animation: shine 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shine {
    0% {
        left: -100%;
    }
    50%, 100% {
        left: 200%;
    }
}

/* État au survol/toucher */
.floating-call-btn:hover,
.floating-call-btn:active {
    transform: scale(1.1);
    animation-play-state: paused;
}

.floating-call-btn:hover {
    box-shadow: 0 6px 25px rgba(234, 93, 111, 0.5);
}

/* Support du mode sombre - OPTIMISÉ */
[data-theme="dark"] .floating-call-btn {
    --btn-shadow: 0 4px 20px rgba(234, 93, 111, 0.6);
    background: #ff4757;
}

/* Effet de brillance adapté pour le mode sombre */
[data-theme="dark"] .floating-call-btn::before {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.15) 50%,
        transparent 100%
    );
}

/* Animation de pulsation adaptée pour le mode sombre */
[data-theme="dark"] .floating-call-btn {
    animation: soft-pulse-dark 2.5s ease-in-out infinite;
}

@keyframes soft-pulse-dark {
    0%, 100% {
        box-shadow: 
            0 4px 20px rgba(234, 93, 111, 0.6),
            0 0 0 0 rgba(234, 93, 111, 0.6);
    }
    50% {
        box-shadow: 
            0 4px 20px rgba(234, 93, 111, 0.6),
            0 0 0 12px rgba(234, 93, 111, 0.1);
    }
}

/* Accessibilité - Focus visible */
.floating-call-btn:focus-visible {
    outline: 3px solid white;
    outline-offset: 3px;
    animation-play-state: paused;
}

/* Réduction des animations si demandé */
@media (prefers-reduced-motion: reduce) {
    .floating-call-btn {
        animation: none;
    }
    
    .floating-call-btn::before {
        animation: none;
        display: none;
    }
}

/* Ajustements pour les petits écrans */
@media only screen and (max-width: 380px) {
    .floating-call-btn {
        --btn-size: 55px;
        bottom: 20px;
        right: 15px;
    }
    
    .call-icon {
        width: 24px;
        height: 24px;
    }
}

/* Éviter les conflits avec le cookie banner - uniquement sur mobile */
@media only screen and (max-width: 768px) {
    .cookie-banner ~ .floating-call-btn {
        bottom: 120px;
        transition: bottom 0.3s ease;
    }
}

/* Animation d'attention périodique */
@keyframes attention {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.05) rotate(-2deg);
    }
    75% {
        transform: scale(1.05) rotate(2deg);
    }
}

.floating-call-btn.attention {
    animation: attention 0.5s ease-in-out;
}

/* État pendant le clic pour feedback visuel */
.floating-call-btn:active {
    transform: scale(0.95);
}