/* ==========================================================================
   STANTECH - Responsive Design (Mobile & Tablette)
   Bootstrap 5 est chargé pour la grille/utilitaires uniquement.
   Ce fichier surcharge les layouts pour les rendre responsive
   SANS changer aucune couleur, police ou animation existante.
   ========================================================================== */

/* ── OVERRIDE: Garder notre .container sur celui de Bootstrap ── */
.container {
  max-width: 1280px;
  padding: 0 1.5rem;
}

/* ── CURSEUR PERSO : Désactiver sur appareils tactiles ── */
@media (hover: none) and (pointer: coarse) {
  body { cursor: auto !important; }
  a, button, [onclick], label { cursor: auto !important; }
  #cursor-dot, #cursor-ring { display: none !important; }
}

/* ==========================================================================
   TABLETTE (768px - 1024px)
   ========================================================================== */
@media (max-width: 1024px) {

  /* ── NAVIGATION ── */
  .nav-menu {
    gap: 1rem;
  }
  .nav-link {
    font-size: 0.88rem;
  }
  .nav-actions .btn {
    padding: 0.5rem 0.9rem;
    font-size: 0.82rem;
  }

  /* ── HERO ── */
  .hero-section {
    padding: 8rem 0 4rem;
  }
  .hero-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
  .hero-content h1 {
    font-size: 2.6rem;
  }
  .hero-stats {
    gap: 1.5rem;
  }
  .stat-item h3 {
    font-size: 1.8rem;
  }

  /* ── SECTION HEADERS ── */
  .section-header h2 {
    font-size: 2rem;
  }

  /* ── SERVICES ── */
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* ── PORTFOLIO ── */
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* ── PRODUCTS ── */
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* ── FOOTER ── */
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  /* ── PRICING (index) ── */
  .pricing-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
  .pricing-card.featured {
    transform: translateY(-4px);
  }

  /* ── TESTIMONIALS ── */
  .testi-card {
    flex: 0 0 calc(50% - 0.75rem);
  }

  /* ── MAP ── */
  .map-wrapper {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
  .map-svg-container {
    height: 300px;
  }

  /* ── CTA ── */
  .cta-box h2 {
    font-size: 2.2rem;
  }

  /* ── CONTACT PAGE (inline grids) ── */
  .contact-page-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 2.5rem !important;
  }

  /* ── ABOUT PAGE ── */
  .about-story-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 2.5rem !important;
  }

  /* ── CART PAGE ── */
  .cart-page-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  /* ── PRODUCT DETAIL ── */
  .product-detail-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 2rem !important;
  }

  /* ── CALCULATOR ── */
  .calc-options-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .calc-wrapper {
    padding: 2rem;
  }

  /* ── CHAT WIDGET ── */
  #ai-chat-window {
    width: 320px;
  }

  /* ── COUNTDOWN BAR ── */
  .countdown-bar {
    font-size: 0.78rem;
    padding: 0.5rem 0.8rem;
    gap: 0.5rem;
  }

  /* ── APPS PAGE ── */
  .apps-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ==========================================================================
   MOBILE (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {

  /* ── CONTAINER ── */
  .container {
    padding: 0 1rem;
  }

  /* ── NAVIGATION ── */
  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .nav-menu {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 1.5rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    transform: translateY(-150%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 0.5rem;
    z-index: 999;
    border-bottom: 2px solid rgba(16, 185, 129, 0.2);
  }
  .nav-menu.active {
    transform: translateY(0);
  }
  .nav-link {
    font-size: 1rem;
    padding: 0.7rem 0;
    width: 100%;
    display: block;
  }
  .nav-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
  }
  .nav-actions .btn {
    display: none;
  }
  .navbar {
    padding: 0.75rem 0;
  }

  /* ── COUNTDOWN BAR ── */
  .countdown-bar {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.74rem;
    padding: 0.45rem 0.65rem;
    text-align: center;
  }

  /* ── HERO ── */
  .hero-section {
    padding: 2.5rem 0 2.5rem;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
  }
  .hero-content h1 {
    font-size: 2rem;
    letter-spacing: -0.02em;
  }
  .hero-content p {
    font-size: 0.95rem;
    margin: 0 auto 1.5rem;
    max-width: 100%;
  }
  .hero-cta {
    justify-content: center;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
  }
  .hero-cta .btn {
    width: 100%;
    max-width: 320px;
    justify-content: center;
  }
  .hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
  }
  .stat-item h3 {
    font-size: 1.6rem;
  }
  .stat-item p {
    font-size: 0.78rem;
  }
  .hero-image-wrapper {
    order: -1;
  }
  .hero-card-main img {
    height: 260px;
  }
  .floating-glass-card {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    margin-top: 1rem;
    animation: none;
    justify-content: center;
  }

  /* ── SECTION HEADERS ── */
  .section-header {
    margin-bottom: 2rem;
  }
  .section-header h2 {
    font-size: 1.7rem;
  }
  .section-header p {
    font-size: 0.9rem;
  }

  /* ── SECTIONS PADDING ── */
  .services-section,
  .realizations-section,
  .shop-section,
  .cta-section,
  .pricing-section,
  .testimonials-section,
  .map-section,
  .order-tracking-section,
  .calculator-section {
    padding: 3.5rem 0;
  }

  /* ── SERVICES ── */
  .services-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }
  .service-card {
    padding: 1.5rem 1.2rem;
  }
  .service-card:hover {
    transform: translateY(-4px);
  }

  /* ── PORTFOLIO ── */
  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .portfolio-img {
    height: 200px;
  }

  /* ── FILTER TABS ── */
  .filter-tabs {
    gap: 0.5rem;
    margin-bottom: 2rem;
  }
  .tab-btn {
    padding: 0.45rem 0.9rem;
    font-size: 0.8rem;
  }

  /* ── PRODUCTS GRID ── */
  .products-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .product-card:hover {
    transform: translateY(-4px);
  }

  /* ── SHOP CONTROLS ── */
  .shop-controls {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  .search-box {
    min-width: 100%;
  }

  /* ── CALCULATOR ── */
  .calc-wrapper {
    padding: 1.5rem;
    border-radius: 16px;
  }
  .calc-options-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }
  .calc-option-inner {
    padding: 1rem 0.5rem;
  }
  .calc-option-inner strong {
    font-size: 0.78rem;
  }
  .calc-option-inner span {
    font-size: 0.68rem;
  }
  .calc-steps {
    margin-bottom: 1.5rem;
  }
  .calc-result-range {
    font-size: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
  }
  .calc-sliders {
    gap: 1rem;
  }

  /* ── PRICING ── */
  .pricing-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .pricing-card {
    padding: 2rem 1.5rem;
  }
  .pricing-card.featured {
    transform: translateY(0);
  }
  .pricing-price-box .price-val {
    font-size: 1.8rem;
  }
  .pricing-toggle-container {
    padding: 0.4rem 0.8rem;
    font-size: 0.82rem;
  }

  /* ── TESTIMONIALS ── */
  .testi-card {
    flex: 0 0 calc(100% - 0.5rem);
    padding: 1.5rem;
  }
  .testi-text {
    font-size: 0.88rem;
  }
  .testi-prev { left: 0; }
  .testi-next { right: 0; }
  .testi-btn {
    width: 36px;
    height: 36px;
  }

  /* ── MAP ── */
  .map-wrapper {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .map-svg-container {
    height: 250px;
  }
  .map-info-panel {
    padding: 1.5rem;
  }
  .map-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  /* ── TRACKING ── */
  .tracking-card {
    padding: 1.5rem;
  }
  .tracking-search-box {
    flex-direction: column;
  }
  .tracking-result-details {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .tracking-steps {
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
  }

  /* ── CTA ── */
  .cta-box {
    padding: 2.5rem 1.5rem;
  }
  .cta-box h2 {
    font-size: 1.7rem;
  }
  .cta-box p {
    font-size: 1rem;
  }

  /* ── FOOTER ── */
  .footer {
    padding: 3rem 0 1.5rem;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  /* ── CART DRAWER ── */
  .cart-drawer {
    max-width: 100%;
  }

  /* ── MODALS ── */
  .modal-content {
    padding: 1.5rem;
    margin: 0 0.5rem;
    border-radius: 16px;
  }
  .lead-popup {
    width: 95%;
    max-width: 420px;
  }
  .popup-top {
    padding: 1.5rem 1.5rem 1.2rem;
  }
  .popup-body {
    padding: 1.5rem;
  }
  .popup-emoji {
    font-size: 2.5rem;
  }
  .popup-top h2 {
    font-size: 1.3rem;
  }

  /* ── CHAT WIDGET ── */
  #ai-chat-window {
    width: calc(100vw - 2rem);
    right: 1rem;
    bottom: 7rem;
  }
  #ai-chat-btn {
    width: 48px;
    height: 48px;
    bottom: 5rem;
  }
  #ai-chat-btn i {
    width: 22px;
    height: 22px;
  }

  /* ── FLOATING ACTIONS (WhatsApp, Scroll-Top, Admin) ── */
  .floating-actions-container {
    bottom: 1.2rem;
    right: 1.2rem;
    gap: 0.65rem;
  }
  .floating-action-btn {
    width: 48px;
    height: 48px;
  }
  #whatsapp-btn svg {
    width: 25px;
    height: 25px;
  }
  .whatsapp-tooltip,
  .apk-tooltip {
    display: none !important;
  }
  #admin-secret-btn {
    width: 28px;
    height: 28px;
  }

  /* ── SOCIAL NOTIFICATIONS ── */
  .social-notif-item {
    max-width: 230px;
    font-size: 0.75rem;
    padding: 0.6rem 0.8rem;
  }
  #social-notif {
    bottom: 4rem !important;
    left: 0.8rem !important;
  }

  /* ── PARTNERS SLIDER ── */
  .partners-slider-section {
    padding: 2rem 0;
  }
  .partners-slider-track {
    gap: 2.5rem;
  }
  .partner-logo {
    font-size: 0.95rem;
  }

  /* ── CONTACT PAGE ── */
  .contact-page-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
  .contact-form-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── ABOUT PAGE ── */
  .about-story-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
  .about-vision-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* ── CART PAGE ── */
  .cart-page-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
  .cart-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cart-table-wrapper table {
    min-width: 500px;
  }

  /* ── PRODUCT DETAIL ── */
  .product-detail-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
  .product-detail-grid img {
    height: 280px !important;
  }
  .product-detail-actions {
    flex-direction: column !important;
    gap: 0.8rem !important;
  }

  /* ── APPLICATIONS PAGE ── */
  .apps-grid {
    grid-template-columns: 1fr !important;
  }
  .apps-filter-bar {
    gap: 0.5rem !important;
  }
  .apps-filter-bar .btn {
    padding: 0.4rem 1rem !important;
    font-size: 0.8rem !important;
  }

  /* ── PAGE BANNERS ── */
  .page-banner h1,
  section[style*="font-size: 3rem"] h1 {
    font-size: 2rem !important;
  }
  .page-banner p {
    font-size: 0.95rem !important;
  }

  /* ── FORMS (checkout modal) ── */
  .checkout-form-2col {
    grid-template-columns: 1fr !important;
  }

  /* ── VIDEO MODAL ── */
  .video-modal-inner {
    width: 96%;
    border-radius: 12px;
  }
  .video-close {
    top: -38px;
  }
}

/* ==========================================================================
   VERY SMALL MOBILE (max-width: 480px)
   ========================================================================== */
@media (max-width: 480px) {

  .hero-content h1 {
    font-size: 1.65rem;
  }
  .hero-content p {
    font-size: 0.88rem;
  }
  .hero-card-main img {
    height: 200px;
  }

  .section-header h2 {
    font-size: 1.45rem;
  }
  .section-header p {
    font-size: 0.85rem;
  }

  .calc-options-grid {
    grid-template-columns: 1fr 1fr;
  }
  .calc-result-range {
    font-size: 1.3rem;
  }

  .pricing-price-box .price-val {
    font-size: 1.5rem;
  }
  .pricing-card {
    padding: 1.5rem 1.2rem;
  }

  .cta-box h2 {
    font-size: 1.45rem;
  }
  .cta-box p {
    font-size: 0.9rem;
  }

  .stat-item h3 {
    font-size: 1.4rem;
  }

  .btn {
    padding: 0.65rem 1.2rem;
    font-size: 0.88rem;
  }

  .service-card h3 {
    font-size: 1.15rem;
  }

  .footer-title {
    font-size: 1rem;
  }

  .testi-card {
    padding: 1.2rem;
  }
  .testi-text {
    font-size: 0.82rem;
  }
  .testi-author strong {
    font-size: 0.82rem;
  }

  .badge {
    font-size: 0.68rem;
    padding: 0.25rem 0.65rem;
  }

  /* Checkout modal 2-col on mobile */
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   LANDSCAPE MOBILE (height ≤ 500px, width > height)
   ========================================================================== */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-section {
    padding: 6rem 0 2rem;
  }
  .hero-card-main img {
    height: 200px;
  }
  #lead-popup-overlay .lead-popup {
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* ==========================================================================
   GENERAL RESPONSIVE FIXES FOR INLINE STYLES
   These use attribute selectors to override inline grid styles on pages
   that use style="" attributes directly in the HTML.
   ========================================================================== */

/* ── Fix all 2-column inline grids on mobile ── */
@media (max-width: 768px) {
  /* Contact page main grid */
  div[style*="grid-template-columns: 1fr 1.3fr"],
  div[style*="grid-template-columns: 1fr 1fr"][style*="gap: 4rem"] {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  /* About page story grid */
  div[style*="grid-template-columns: 1fr 1fr"][style*="align-items: center"] {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  /* Cart page grid */
  div[style*="grid-template-columns: 1.8fr 1.2fr"] {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  /* Product detail grid */
  div[style*="grid-template-columns: 1fr 1.2fr"] {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  /* Checkout modal 2-col */
  div[style*="grid-template-columns: 1fr 1fr"][style*="gap: 1rem"],
  div[style*="grid-template-columns: 1fr 1fr"][style*="gap: 1.2rem"] {
    grid-template-columns: 1fr !important;
  }

  /* Application page grid */
  div[style*="grid-template-columns: repeat(auto-fill, minmax(350px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }

  /* About values grid */
  div[style*="grid-template-columns: repeat(auto-fit, minmax(260px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }

  /* Process steps grid */
  div[style*="grid-template-columns: repeat(auto-fit, minmax(240px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }

  /* Page banner h1 size */
  section > .container > h1[style*="font-size: 3rem"],
  h1[style*="font-size: 3rem"] {
    font-size: 1.8rem !important;
  }
  h1[style*="font-size: 2.5rem"] {
    font-size: 1.7rem !important;
  }
  h1[style*="font-size: 2.2rem"] {
    font-size: 1.6rem !important;
  }

  /* Page banner heading */
  h2[style*="font-size: 2.3rem"] {
    font-size: 1.6rem !important;
  }
  h2[style*="font-size: 2rem"] {
    font-size: 1.5rem !important;
  }

  /* About vision blocks */
  div[style*="grid-template-columns: 1fr 1fr"][style*="gap: 1.5rem"] {
    grid-template-columns: 1fr !important;
  }

  /* Page banner sections padding */
  section[style*="padding: 9rem 0 4rem"] {
    padding: 7rem 0 2.5rem !important;
  }
  section[style*="padding: 9rem 0 5rem"] {
    padding: 7rem 0 3rem !important;
  }
  section[style*="padding: 9rem 0 6rem"] {
    padding: 7rem 0 3rem !important;
  }
  section[style*="padding: 5rem 0"] {
    padding: 3rem 0 !important;
  }
  section[style*="padding: 4rem 0 6rem"] {
    padding: 2.5rem 0 3rem !important;
  }

  /* Product detail image height */
  img[style*="height: 420px"] {
    height: 260px !important;
  }

  /* Price display on product detail */
  span[style*="font-size: 2.2rem"][style*="font-weight: 800"] {
    font-size: 1.6rem !important;
  }

  /* Cart table responsive scroll */
  div[style*="box-shadow: var(--shadow-sm)"] table,
  div[style*="box-shadow"] table[style*="border-collapse"] {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Product detail actions row */
  div[style*="display: flex"][style*="gap: 1rem"][style*="align-items: center"][style*="margin-bottom: 2.5rem"] {
    flex-direction: column;
    align-items: stretch !important;
  }
}

/* ── Tablette fixes for inline styles ── */
@media (min-width: 769px) and (max-width: 1024px) {
  /* Applications grid: 2 columns */
  div[style*="grid-template-columns: repeat(auto-fill, minmax(350px, 1fr))"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Page banner h1 */
  h1[style*="font-size: 3rem"] {
    font-size: 2.3rem !important;
  }

  /* Contact grid stays 2-col but tighter gap */
  div[style*="grid-template-columns: 1fr 1.3fr"] {
    gap: 2rem !important;
  }

  /* Product detail grid */
  div[style*="grid-template-columns: 1fr 1.2fr"] {
    gap: 2rem !important;
  }

  /* Cart grid */
  div[style*="grid-template-columns: 1.8fr 1.2fr"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 2rem !important;
  }

  /* Section padding adjustments */
  section[style*="padding: 9rem 0 4rem"] {
    padding: 8rem 0 3rem !important;
  }
}

/* ==========================================================================
   DARK MODE RESPONSIVE FIXES
   ========================================================================== */
@media (max-width: 768px) {
  [data-theme="dark"] .nav-menu {
    background: #1e293b;
    border-bottom-color: rgba(16, 185, 129, 0.15);
  }
  [data-theme="dark"] .countdown-bar {
    font-size: 0.75rem;
  }
}

/* ==========================================================================
   PRINT STYLES (bonus)
   ========================================================================== */
@media print {
  .navbar, .footer, #whatsapp-btn, #ai-chat-btn, #ai-chat-window,
  #admin-secret-btn, #cursor-dot, #cursor-ring, #read-progress,
  .countdown-bar, #lead-popup-overlay, .cart-drawer-overlay,
  .social-notif-item { display: none !important; }
  body { cursor: auto !important; }
}
