/* ==========================================================================
   RESPONSIVE AMÉLIORÉ GÉNÉRAL - MOBILE FIRST
   ========================================================================== */

/* Extra Small Devices (320px - 480px) */
@media (max-width: 480px) {
    :root {
        --space-6xl: 2.5rem;
        --space-7xl: 3rem;
        --space-8xl: 3.5rem;
    }

    body {
        font-size: 14px;
    }

    .container {
        padding: 0 1rem;
    }

    .section {
        padding: 3rem 0;
    }

    .section--hero {
        min-height: calc(100vh - 70px);
        padding-top: 90px;
    }

    .title-hero {
        font-size: clamp(1.75rem, 8vw, 2.5rem);
        line-height: 1.1;
        margin-bottom: 1.5rem;
    }

    .title-section {
        font-size: clamp(1.5rem, 6vw, 2rem);
        margin-bottom: 1.25rem;
    }

    .title-subsection {
        font-size: clamp(1.25rem, 5vw, 1.75rem);
    }

    .title-card {
        font-size: clamp(1rem, 4vw, 1.25rem);
    }

    .lead {
        font-size: 1rem;
        margin-bottom: 1.25rem;
    }

    .body {
        font-size: 0.9rem;
    }

    /* Buttons mobile */
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
        width: 100%;
        justify-content: center;
    }

    .btn--lg {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }

    .btn--sm {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    /* Navigation mobile */
    .navbar-container {
        padding: 0 1rem;
        height: 70px;
    }

    .navbar-logo {
        height: 45px;
    }

    .navbar-mobile-link {
        font-size: 1.5rem;
    }

    .navbar-mobile {
        gap: 2rem;
    }

    /* Hero mobile */
    .hero {
        min-height: calc(100vh - 70px);
    }

    .hero__particles {
        display: none;
    }

    .hero-stats {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1.5rem;
    }

    .stat-pill {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }

    /* Cards mobile */
    .card {
        padding: 1.25rem;
    }

    .card--service {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        padding: 1.25rem;
    }

    .service-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin: 0 auto;
    }

    /* Grid mobile */
    .grid,
    .grid-cols-1,
    .grid-cols-2,
    .grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* CTA mobile */
    .cta__title {
        font-size: clamp(1.5rem, 6vw, 2rem);
    }

    .cta__description {
        font-size: 0.95rem;
        margin-bottom: 2rem;
    }

    .cta__buttons {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .cta__buttons .btn {
        width: 100%;
    }

    /* Footer mobile */
    .footer__content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: left;
    }

    .footer__logo {
        height: 50px;
    }

    .footer__title {
        font-size: 1.125rem;
        margin-bottom: 1rem;
    }

    .footer__social {
        justify-content: flex-start;
        gap: 0.75rem;
    }

    .social-icon {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }

    .footer__bottom {
        padding: 1.5rem 0;
        text-align: center;
    }

    /* Badges mobile */
    .badge {
        font-size: 0.7rem;
        padding: 0.375rem 0.75rem;
    }

    /* Glass effects mobile */
    .glass {
        padding: 1.25rem;
    }

    /* Chatbot mobile */
    .chatbot-window {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        bottom: 0;
        right: 0;
    }

    .chatbot-trigger {
        bottom: 1rem;
        right: 1rem;
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }

    .chatbot-header {
        padding: 1rem;
    }

    .chatbot-messages {
        padding: 1rem;
    }

    .message {
        max-width: 85%;
        font-size: 0.875rem;
    }

    .chatbot-input {
        padding: 1rem;
    }
}

/* Small Devices (481px - 767px) */
@media (min-width: 481px) and (max-width: 767px) {
    .container {
        padding: 0 1.5rem;
    }

    .title-hero {
        font-size: clamp(2rem, 7vw, 3rem);
    }

    .btn {
        width: auto;
    }

    .hero-stats {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .stat-pill {
        flex: 1 1 45%;
        min-width: 180px;
        max-width: 250px;
    }

    .card--service {
        flex-direction: row;
        text-align: left;
    }

    .service-icon {
        margin: 0;
    }

    .cta__buttons {
        flex-direction: row;
        justify-content: center;
    }

    .cta__buttons .btn {
        width: auto;
        min-width: 180px;
    }

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

    .chatbot-window {
        width: 90%;
        height: 80%;
        max-width: 400px;
        max-height: 600px;
        border-radius: 1.5rem;
    }
}

/* Medium Devices (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .navbar-container {
        padding: 0 2rem;
    }

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

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

    .hero-stats {
        gap: 1.5rem;
    }

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

/* Large Devices (1024px - 1279px) */
@media (min-width: 1024px) and (max-width: 1279px) {
    .grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }

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

/* Extra Large Devices (1280px+) */
@media (min-width: 1280px) {
    .container {
        max-width: 1400px;
    }
}

/* ==========================================================================
   OPTIMISATIONS TACTILES
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
    /* Augmentation zones tactiles */
    .btn {
        min-height: 48px;
        padding: 1rem 1.5rem;
    }

    .navbar-toggle {
        width: 44px;
        height: 44px;
        padding: 0.5rem;
    }

    .navbar-nav-link {
        padding: 1rem 0;
    }

    .social-icon {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
    }

    .footer__link {
        padding: 0.75rem 0;
    }

    /* Désactivation effets hover */
    .card:hover,
    .service-card:hover,
    .glass:hover,
    .btn:hover {
        transform: none;
    }

    /* Feedback tactile */
    .btn:active,
    .card:active,
    .service-card:active {
        opacity: 0.85;
        transform: scale(0.98);
    }

    .navbar-nav-link:active,
    .footer__link:active,
    .social-icon:active {
        opacity: 0.7;
    }

    /* Simplification animations */
    .service-icon::before,
    .card::before,
    .glass::before {
        display: none;
    }
}

/* ==========================================================================
   ORIENTATION PAYSAGE MOBILE
   ========================================================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 2rem 0;
    }

    .section--hero {
        min-height: auto;
        padding-top: 100px;
        padding-bottom: 2rem;
    }

    .title-hero {
        font-size: clamp(1.5rem, 5vw, 2rem);
        margin-bottom: 1rem;
    }

    .lead {
        margin-bottom: 1rem;
    }

    .hero-stats {
        margin-top: 1rem;
        gap: 0.75rem;
    }

    .stat-pill {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }

    .navbar-container {
        height: 60px;
    }

    .navbar-logo {
        height: 40px;
    }

    .navbar-mobile {
        padding: 1rem;
        gap: 1.5rem;
        justify-content: flex-start;
    }

    .navbar-mobile-link {
        font-size: 1.25rem;
    }

    .section {
        padding: 2rem 0;
    }
}

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

@media print {
    .navbar,
    .navbar-mobile,
    .navbar-toggle,
    .hero__particles,
    .particle,
    .btn,
    .cta,
    .footer__social,
    .chatbot-trigger,
    .chatbot-window {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .hero,
    .section {
        page-break-inside: avoid;
        min-height: auto;
        padding: 1rem 0;
    }

    .card,
    .service-card {
        border: 1px solid #000 !important;
        page-break-inside: avoid;
        box-shadow: none !important;
    }

    .gradient-text,
    .gradient-text-gold,
    .hero-gradient {
        -webkit-text-fill-color: black !important;
        color: black !important;
    }

    .title-hero,
    .title-section,
    .title-subsection {
        color: black !important;
    }
}

/* ==========================================================================
   FIXES iPhone-spécifiques (ajoutés 2026-04-30)
   ========================================================================== */

/* iOS Safari zoom intempestif : forcer 16px sur tous les inputs sur mobile */
@media (max-width: 768px) {
    input[type="text"], input[type="email"], input[type="password"],
    input[type="tel"], input[type="url"], input[type="search"],
    input[type="number"], input[type="date"], input[type="time"],
    textarea, select,
    .form-control, .form-input, .form-textarea, .form-select {
        font-size: 16px !important;
    }
}

/* Touch targets : Apple HIG recommande min 44x44px pour le toucher */
@media (max-width: 768px) {
    .btn,
    .nav-link,
    .footer-link,
    a.btn--primary, a.btn--outline,
    button[type="submit"] {
        min-height: 44px;
    }
    .social-link, .menu-toggle {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Safe area iPhone X+ : pour le chatbot et CTA fixed bottom */
@media (max-width: 768px) {
    .chatbot-toggle,
    .floating-cta,
    [class*="chatbot"][class*="toggle"] {
        bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }
}

/* Footer mobile : aérer la grille de liens */
@media (max-width: 640px) {
    .footer-content,
    .footer-grid {
        gap: 1.5rem;
    }
    .footer-section h4 {
        margin-bottom: 0.75rem;
    }
    .footer-section ul li {
        margin-bottom: 0.5rem;
    }
}

/* Map iframe Google : hauteur réduite sur mobile */
@media (max-width: 640px) {
    iframe[src*="google.com/maps"] {
        height: 250px !important;
        border-radius: 0.875rem;
    }
}

/* Anti-débordement horizontal global */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    img, video, iframe {
        max-width: 100%;
        height: auto;
    }
}

/* Hero mobile : padding-top safe-area aware
   IMPORTANT : ne PAS utiliser [class*="hero"] car ça matche aussi hero__grid,
   hero__content, hero__text, etc. -> 80px se cumule sur 3 niveaux = 240px de vide. */
@media (max-width: 480px) {
    .hero, .section--hero {
        padding-top: max(80px, env(safe-area-inset-top, 0px) + 80px);
    }
}

/* CTA buttons : zones cliquables plus larges sur mobile */
@media (max-width: 480px) {
    .cta-button, .btn--primary, .btn--lg {
        padding: 0.875rem 1.5rem;
        min-height: 48px;
        font-size: 1rem;
    }
}

/* Tap highlight : feedback rose POEM au tap mobile */
@media (max-width: 768px) {
    a, button, [role="button"] {
        -webkit-tap-highlight-color: rgba(236, 72, 153, 0.15);
    }
}

/* Navbar auth links : cachés en mobile (visibles dans le drawer) */
@media (max-width: 1023px) {
    .navbar-auth-link, .navbar-auth-cta { display: none !important; }
}

/* Sur tablette/desktop étroit : raccourcir le label "Se connecter" */
@media (min-width: 1024px) and (max-width: 1180px) {
    .navbar-auth-link span { display: none !important; }
    .navbar-auth-cta span { display: none !important; }
}

/* Hero homepage : la règle desktop .hero__grid {1fr 1fr} de style.css est definie
   APRÈS les @media mobile (ligne 2909 vs 1688) -> source order gagne et casse mobile.
   On force la colonne unique ici (loaded last). */
@media (max-width: 767px) {
    .hero__grid {
        grid-template-columns: 1fr !important;
        gap: var(--space-3xl, 2rem);
        text-align: center;
        min-height: auto !important;
    }
    .hero__text { padding-right: 0 !important; }
    .hero__visual { order: -1; }
    .hero__image-container { max-width: 280px; }

    /* Hero global : pas de double padding-top empilé */
    .hero { padding-top: 80px; }
    .hero__content { padding-top: 0 !important; }
    .hero__grid { padding-top: 0 !important; }
}

/* =========================================================================
   CHATBOT — refonte pro cohérente avec design POEM (rose-bleu, pas cyberpunk)
   Override les anciennes regles cyberpunk de style.css (charge avant)
   ========================================================================= */

/* Bouton trigger flottant en bas-droite */
.chatbot-trigger {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #ec4899, #3b82f6) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 8px 24px -8px rgba(236, 72, 153, 0.5) !important;
    cursor: pointer !important;
    z-index: 1080 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 22px !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    animation: none !important;
}
.chatbot-trigger:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 12px 32px -8px rgba(236, 72, 153, 0.6) !important;
}
.chatbot-trigger.has-notification::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
    animation: chatbot-notif-pulse 1.5s ease-in-out infinite;
}
@keyframes chatbot-notif-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* Fenêtre du chat */
.chatbot-window {
    position: fixed !important;
    bottom: 96px !important;
    right: 24px !important;
    width: 380px !important;
    height: 560px !important;
    max-height: calc(100vh - 120px) !important;
    background: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.3), 0 8px 24px -8px rgba(236, 72, 153, 0.15) !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    transform: translateY(20px) scale(0.96) !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1), opacity 0.25s ease, visibility 0.25s !important;
    z-index: 1080 !important;
    font-family: 'Inter', 'Plus Jakarta Sans', system-ui, sans-serif !important;
}
.chatbot-window.active {
    transform: translateY(0) scale(1) !important;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.chatbot-window::before { display: none !important; }

/* Header */
.chatbot-window .chatbot-header {
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 50%, #3b82f6 100%) !important;
    padding: 16px 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-radius: 0 !important;
    flex-shrink: 0 !important;
    color: white !important;
}
.chatbot-window .chatbot-header::before { display: none !important; }
.chatbot-window .chatbot-title {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: white !important;
    text-shadow: none !important;
    letter-spacing: 0.3px !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}
.chatbot-window .chatbot-title::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4);
    animation: chatbot-online 2s ease-in-out infinite;
}
@keyframes chatbot-online {
    0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
}
.chatbot-window .chatbot-close {
    background: rgba(255, 255, 255, 0.18) !important;
    color: white !important;
    width: 30px !important;
    height: 30px !important;
    border-radius: 8px !important;
    transition: background 0.15s !important;
}
.chatbot-window .chatbot-close:hover {
    background: rgba(255, 255, 255, 0.28) !important;
    transform: none !important;
}

/* Messages container */
.chatbot-window .chatbot-messages {
    background: #f9fafb !important;
    flex: 1 !important;
    height: auto !important;
    padding: 16px !important;
    overflow-y: auto !important;
}
.chatbot-window .chatbot-messages::before { display: none !important; }
.chatbot-window .chatbot-messages::-webkit-scrollbar { width: 6px; }
.chatbot-window .chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1) !important;
    border-radius: 3px !important;
}

/* Bulles de message */
.chatbot-window .message {
    margin-bottom: 12px !important;
    animation: chatbot-msg-pop 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1) !important;
}
@keyframes chatbot-msg-pop {
    from { opacity: 0; transform: translateY(8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.chatbot-window .message.bot {
    display: flex !important;
    align-items: flex-end !important;
    gap: 8px !important;
}
.chatbot-window .message.user {
    display: flex !important;
    justify-content: flex-end !important;
}
.chatbot-window .message-avatar {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
    font-size: 14px !important;
    animation: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.chatbot-window .message-content {
    background: white !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    color: #1f2937 !important;
    padding: 10px 14px !important;
    border-radius: 14px !important;
    border-bottom-left-radius: 4px !important;
    border: 1px solid rgba(0, 0, 0, 0.04) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03) !important;
    max-width: 78% !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
}
.chatbot-window .message-content::before { display: none !important; }
.chatbot-window .message.user .message-content {
    background: linear-gradient(135deg, #ec4899, #be185d) !important;
    color: white !important;
    border: none !important;
    border-bottom-right-radius: 4px !important;
    border-bottom-left-radius: 14px !important;
    font-weight: 500 !important;
}

/* Quick replies */
.chatbot-window .quick-replies {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin-top: 10px !important;
}
.chatbot-window .quick-reply {
    background: white !important;
    border: 1px solid rgba(236, 72, 153, 0.25) !important;
    color: #be185d !important;
    padding: 6px 12px !important;
    border-radius: 9999px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.chatbot-window .quick-reply::before { display: none !important; }
.chatbot-window .quick-reply:hover {
    background: #ec4899 !important;
    color: white !important;
    border-color: #ec4899 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px -4px rgba(236, 72, 153, 0.4) !important;
}

/* Input area */
.chatbot-window .chatbot-input {
    background: white !important;
    border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
    padding: 12px 14px !important;
    border-radius: 0 !important;
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
    flex-shrink: 0 !important;
}
.chatbot-window .chatbot-input::before { display: none !important; }
.chatbot-window .chatbot-input input,
.chatbot-window .chatbot-input textarea {
    flex: 1 !important;
    background: #f3f4f6 !important;
    border: 1px solid transparent !important;
    color: #1f2937 !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    transition: border-color 0.15s, background 0.15s !important;
    outline: none !important;
}
.chatbot-window .chatbot-input input:focus,
.chatbot-window .chatbot-input textarea:focus {
    background: white !important;
    border-color: #ec4899 !important;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.12) !important;
}
.chatbot-window .chatbot-input input::placeholder,
.chatbot-window .chatbot-input textarea::placeholder {
    color: #9ca3af !important;
}
.chatbot-window #sendButton {
    background: linear-gradient(135deg, #ec4899, #3b82f6) !important;
    color: white !important;
    border: none !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    transition: transform 0.15s, box-shadow 0.15s !important;
    box-shadow: 0 4px 12px -4px rgba(236, 72, 153, 0.4) !important;
}
.chatbot-window #sendButton:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 6px 16px -4px rgba(236, 72, 153, 0.5) !important;
}

/* Typing indicator */
.chatbot-window .typing-indicator.active {
    display: inline-flex !important;
    gap: 3px !important;
    padding: 8px 12px !important;
}
.chatbot-window .typing-dot {
    width: 6px !important;
    height: 6px !important;
    background: #9ca3af !important;
    border-radius: 50% !important;
    animation: chatbot-typing 1.2s infinite ease-in-out !important;
}
.chatbot-window .typing-dot:nth-child(2) { animation-delay: 0.15s !important; }
.chatbot-window .typing-dot:nth-child(3) { animation-delay: 0.3s !important; }
@keyframes chatbot-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* MOBILE : plein écran propre */
@media (max-width: 640px) {
    .chatbot-window {
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        border: none !important;
    }
    .chatbot-window .message-content { max-width: 80% !important; font-size: 15px !important; }
    .chatbot-window .chatbot-input input,
    .chatbot-window .chatbot-input textarea { font-size: 16px !important; /* anti-zoom iOS */ }
    .chatbot-trigger.active {
        opacity: 0 !important;
        pointer-events: none !important;
        transform: scale(0) !important;
    }
}