/* ============================================
   KN-MAINTAINANCE - FULL RESPONSIVE STYLES
   Mobile-First Approach with Comprehensive Breakpoints
   ============================================ */

/* ---------- GLOBAL FIXES (All Screens) ---------- */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

* {
  max-width: 100%;
}

img, video, svg, canvas {
  max-width: 100%;
  height: auto;
}

/* Auto-hide loader fallback (in case JS fails) - faster hide */
@keyframes loaderAutoHide {
  0%, 70% { opacity: 1; visibility: visible; }
  100% { opacity: 0; visibility: hidden; pointer-events: none; }
}

.loader-wrapper {
  /* Fallback positioning for browsers without 'inset' support */
  top: 0; left: 0; right: 0; bottom: 0;
  animation: loaderAutoHide 2s ease forwards;
  animation-delay: 0.3s;
  pointer-events: auto;
}

.loader-wrapper.hidden {
  pointer-events: none !important;
}

/* Fallback for browsers that don't support inset */
.slider-slide {
  top: 0; left: 0; right: 0; bottom: 0;
}

.slide-bg {
  top: 0; left: 0; right: 0; bottom: 0;
}

.slide-shapes {
  top: 0; left: 0; right: 0; bottom: 0;
}

/* Hide topbar + collapse nav on screens < 1200px (laptops, tablets, phones) */
@media (max-width: 1199px) {
  .topbar { display: none !important; }
  .hero-slider-wrapper { margin-top: 80px; }
  .nav-menu { display: none !important; }
  .header-search { display: none !important; }
  .header-actions .btn { display: none !important; }
  .menu-toggle { display: flex !important; }
  .mega-menu, .dropdown { display: none !important; }
}

@media (max-width: 991px) {
  .hero-slider-wrapper { margin-top: 80px; }
}

@media (max-width: 480px) {
  .hero-slider-wrapper { margin-top: 60px; }
  
  /* Safety: no element wider than viewport (excluding fixed-width drawers/modals) */
  .container, .hero-search, .form-container, .auth-card, section, footer, header {
    max-width: 100vw !important;
  }
  
  /* Chatbot specific */
  .chatbot-window {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    left: 12px !important;
    right: 12px !important;
  }
  
  .toast {
    max-width: calc(100vw - 24px) !important;
  }
  
  .mobile-nav {
    max-width: 85vw !important;
  }
  
  .services-sidebar, .dashboard-sidebar {
    max-width: 85vw !important;
  }
  
  .modal {
    max-width: calc(100vw - 16px) !important;
  }
  
  /* Ensure grids don't overflow */
  .services-grid, .categories-grid, .features-grid, .stats-grid,
  .steps-grid, .blog-grid, .footer-grid, .dashboard-stats,
  .dashboard-cards, .charts-grid, .analytics-grid, .quick-actions {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* Prevent text overflow */
  h1, h2, h3, h4, h5, h6, p, span, a, button, input, select, textarea {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  /* Mobile nav width */
  .mobile-nav { width: min(280px, 85vw) !important; }
}

/* ---------- Base Mobile Styles (up to 480px) ---------- */
@media (max-width: 480px) {
  :root {
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;
    --space-3xl: 48px;
    --space-4xl: 64px;
    --header-height: 60px;
  }
  
  html { font-size: 14px; }
  
  /* Force horizontal scroll prevention */
  html, body, .container, section, header, footer, main, div {
    max-width: 100vw;
  }
  
  /* Hide non-essential header items on very small screens */
  .header-actions .icon-btn:not(:first-child) { display: none; }
  .header-actions .theme-toggle { display: none; }
  
  /* Compact header */
  .header-inner { padding: 6px 0; min-height: 56px; }
  
  body { font-size: 14px; }
  
  .container { padding: 0 12px; }
  
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.125rem; }
  h4 { font-size: 1rem; }
  
  .section { padding: 40px 0; }
  .section-sm { padding: 24px 0; }
  .section-lg { padding: 56px 0; }
  
  .section-header { margin-bottom: 32px; }
  .section-title { font-size: 1.375rem; margin-bottom: 8px; }
  .section-description { font-size: 0.875rem; }
  .section-badge { font-size: 0.7rem; padding: 4px 12px; }
  
  /* Header on smallest */
  .header-inner { padding: 8px 0; gap: 8px; }
  .logo { font-size: 1rem; gap: 6px; }
  .logo-icon { width: 34px; height: 34px; font-size: 0.875rem; }
  .logo-text { display: none; }
  
  .icon-btn { width: 36px; height: 36px; font-size: 0.875rem; }
  .icon-btn .badge { min-width: 16px; height: 16px; font-size: 0.65rem; }
  
  .btn { padding: 8px 14px; font-size: 0.8125rem; }
  .btn-lg { padding: 10px 18px; font-size: 0.875rem; }
  .btn-sm { padding: 6px 10px; font-size: 0.75rem; }
  
  /* Hero Slider */
  .hero-slider-wrapper { margin-top: 60px; min-height: 600px; }
  .slider-track { min-height: 600px; }
  .slide-content { padding: 0 12px; gap: 20px; }
  .slide-badge { font-size: 0.65rem; padding: 4px 10px; margin-bottom: 12px; }
  .slide-title { font-size: 1.375rem; margin-bottom: 10px; line-height: 1.2; }
  .slide-description { font-size: 0.8125rem; margin-bottom: 14px; line-height: 1.5; }
  .slide-features { gap: 8px; margin-bottom: 14px; flex-direction: column; align-items: center; }
  .slide-feature { font-size: 0.75rem; gap: 6px; }
  .slide-feature i { width: 18px; height: 18px; font-size: 0.65rem; }
  .slide-buttons { flex-direction: column; gap: 8px; width: 100%; }
  .slide-btn { width: 100%; justify-content: center; padding: 10px 16px; font-size: 0.8125rem; }
  .slide-visual { max-width: 180px !important; }
  .visual-card { max-width: 180px; }
  .visual-main { padding: 16px; border-radius: 20px; }
  .visual-icon { font-size: 4rem; }
  .visual-float { display: none !important; }
  .slider-arrow { width: 32px; height: 32px; font-size: 0.7rem; }
  .slider-arrows { padding: 0 8px; }
  .slider-controls { bottom: 12px; }
  .slider-dot-new { width: 8px; height: 8px; }
  .slider-dot-new.active { width: 24px; }
  
  /* Search */
  .hero-search { padding: 16px; border-radius: 12px; }
  .hero-search-title { font-size: 0.9375rem; margin-bottom: 12px; }
  .search-form { grid-template-columns: 1fr; gap: 8px; }
  .search-field input, .search-field select { height: 40px; font-size: 0.875rem; }
  .search-btn { padding: 10px; font-size: 0.8125rem; }
  
  /* Categories */
  .categories-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .category-card { padding: 10px 6px; border-radius: 10px; }
  .category-icon { width: 36px; height: 36px; font-size: 0.9375rem; margin-bottom: 6px; border-radius: 8px; }
  .category-card h4 { font-size: 0.65rem; font-weight: 600; }
  .category-card p { display: none; }
  
  /* Service Cards */
  .services-grid { grid-template-columns: 1fr; gap: 12px; }
  .service-card { border-radius: 12px; }
  .service-image { height: 160px; }
  .service-content { padding: 12px; }
  .service-category { font-size: 0.65rem; }
  .service-title { font-size: 0.9375rem; margin-bottom: 8px; }
  .service-meta { font-size: 0.7rem; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
  .service-rating { font-size: 0.7rem; }
  .service-rating .rating i { font-size: 0.7rem; }
  .service-footer { flex-direction: row; padding-top: 10px; gap: 8px; }
  .service-price { font-size: 0.9375rem; }
  .service-price span { font-size: 0.65rem; }
  .service-btn { padding: 6px 12px; font-size: 0.75rem; }
  .service-wishlist { width: 32px; height: 32px; top: 10px; right: 10px; font-size: 0.75rem; }
  .service-badge { top: 10px; left: 10px; font-size: 0.65rem; padding: 2px 8px; }
  
  /* Features */
  .features-grid { grid-template-columns: 1fr; gap: 12px; }
  .feature-card { padding: 20px 16px; border-radius: 12px; }
  .feature-icon { width: 56px; height: 56px; font-size: 1.25rem; border-radius: 12px; margin-bottom: 12px; }
  .feature-title { font-size: 1rem; margin-bottom: 6px; }
  .feature-description { font-size: 0.8125rem; }
  
  /* Steps */
  .steps-grid { grid-template-columns: 1fr; gap: 24px; }
  .step-number { width: 60px; height: 60px; font-size: 1.5rem; }
  .step-title { font-size: 0.9375rem; }
  .step-description { font-size: 0.8125rem; }
  
  /* Stats */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 16px 12px; flex-direction: column; text-align: center; gap: 8px; }
  .stat-icon { width: 40px; height: 40px; font-size: 1rem; margin: 0 auto; }
  .stat-number { font-size: 1.375rem; }
  .stat-label { font-size: 0.7rem; }
  
  /* CTA */
  .cta-banner { padding: 24px 16px; border-radius: 16px; }
  .cta-banner h2 { font-size: 1.25rem; margin-bottom: 8px; }
  .cta-banner p { font-size: 0.875rem; margin-bottom: 16px; }
  .cta-buttons { flex-direction: column; gap: 8px; }
  .cta-btn-primary, .cta-btn-secondary { width: 100%; justify-content: center; padding: 10px 16px; font-size: 0.875rem; }
  
  /* Footer */
  .footer { padding-top: 32px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-logo { font-size: 1rem; margin-bottom: 12px; }
  .footer-logo-icon { width: 36px; height: 36px; font-size: 0.9375rem; }
  .footer-description { font-size: 0.8125rem; }
  .footer-column h4 { font-size: 0.9375rem; margin-bottom: 12px; }
  .footer-links a { font-size: 0.8125rem; padding: 4px 0; }
  .footer-contact-item { font-size: 0.8125rem; margin-bottom: 10px; }
  .footer-social a { width: 36px; height: 36px; font-size: 0.875rem; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; padding: 16px 0; font-size: 0.75rem; }
  .footer-bottom-links { gap: 12px; flex-wrap: wrap; justify-content: center; }
  
  /* Floating elements - stacked vertically to avoid overlap */
  .floating-buttons { bottom: 170px; right: 12px; gap: 8px; }
  .floating-btn { width: 44px; height: 44px; font-size: 1.125rem; }
  .back-to-top { bottom: 80px; right: 12px; width: 44px; height: 44px; font-size: 0.875rem; }
  
  /* Chatbot */
  .chatbot-launcher { bottom: 12px; left: 12px; width: 52px; height: 52px; font-size: 1.125rem; }
  .chatbot-window { width: calc(100vw - 24px); height: calc(100vh - 100px); bottom: 80px; left: 12px; border-radius: 16px; }
  .chatbot-header { padding: 12px 14px; }
  .chatbot-avatar { width: 36px; height: 36px; font-size: 1rem; }
  .chatbot-info h4 { font-size: 0.875rem; }
  .chatbot-info p { font-size: 0.65rem; }
  .chatbot-messages { padding: 12px; gap: 10px; }
  .chat-message { max-width: 90%; }
  .chat-message-bubble { padding: 8px 12px; font-size: 0.8125rem; }
  .chat-message-avatar { width: 26px; height: 26px; font-size: 0.75rem; }
  .chatbot-input-area { padding: 10px 12px; }
  .chatbot-input { padding: 8px 12px; font-size: 0.8125rem; }
  .chatbot-send { width: 36px; height: 36px; }
  .chat-quick-reply { padding: 4px 10px; font-size: 0.7rem; }
  
  /* Forms */
  .form-container { padding: 20px 16px; border-radius: 12px; }
  .form-title h2 { font-size: 1.25rem; }
  .form-row { flex-direction: column; gap: 0; }
  .form-control { height: 44px; font-size: 0.875rem; }
  .form-select { height: 44px; font-size: 0.875rem; }
  textarea.form-control { min-height: 100px; padding: 10px 12px; }
  .input-group .form-control { padding-left: 40px; }
  .input-group-icon { left: 12px; }
  
  /* Tables */
  table { font-size: 0.8125rem; }
  th, td { padding: 10px 8px; }
  .table-wrapper { font-size: 0.8125rem; }
  
  /* Modals */
  .modal { margin: 8px; max-height: calc(100vh - 16px); border-radius: 16px; }
  .modal-header, .modal-body, .modal-footer { padding: 16px; }
  .modal-header h3 { font-size: 1rem; }
  
  /* Pagination */
  .pagination { gap: 4px; margin-top: 24px; }
  .pagination-btn { min-width: 32px; height: 32px; font-size: 0.75rem; }
  
  /* Breadcrumb */
  .breadcrumb { font-size: 0.7rem; gap: 4px; flex-wrap: wrap; }
  
  /* Testimonial */
  .testimonial-card { padding: 16px; border-radius: 12px; }
  .testimonial-quote { font-size: 2.5rem; top: 12px; right: 12px; }
  .testimonial-content { font-size: 0.875rem; margin-bottom: 12px; }
  .testimonial-avatar { width: 40px; height: 40px; }
  .testimonial-info h5 { font-size: 0.875rem; }
  .testimonial-info p { font-size: 0.7rem; }
  
  /* Blog */
  .blog-card { border-radius: 12px; }
  .blog-image { height: 140px; }
  .blog-content { padding: 12px; }
  .blog-meta { font-size: 0.7rem; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
  .blog-category { font-size: 0.65rem; padding: 2px 8px; }
  .blog-title { font-size: 0.9375rem; }
  .blog-excerpt { font-size: 0.75rem; -webkit-line-clamp: 2; }
  .blog-link { font-size: 0.8125rem; }
  
  /* Vendor */
  .vendor-card { padding: 16px; border-radius: 12px; }
  .vendor-avatar { width: 48px; height: 48px; }
  .vendor-info h4 { font-size: 0.9375rem; }
  .vendor-category { font-size: 0.75rem; }
  .vendor-stats { padding: 10px; gap: 4px; }
  .vendor-stat h5 { font-size: 0.9375rem; }
  .vendor-stat p { font-size: 0.65rem; }
  .vendor-actions { flex-direction: column; }
  .vendor-actions .btn { width: 100%; }
  
  /* Newsletter */
  .newsletter-section { padding: 40px 0; }
  .newsletter-content h2 { font-size: 1.25rem; }
  .newsletter-content p { font-size: 0.8125rem; margin-bottom: 16px; }
  .newsletter-form { flex-direction: column; gap: 8px; }
  .newsletter-form input { height: 44px; font-size: 0.875rem; padding: 0 16px; }
  .newsletter-form button { height: 44px; font-size: 0.875rem; padding: 0 20px; }
  
  /* Partners */
  .partners-grid { gap: 20px; }
  .partner-logo { height: 24px; }
  
  /* FAQ */
  .faq-item { border-radius: 10px; margin-bottom: 8px; }
  .faq-question { padding: 12px 14px; font-size: 0.875rem; gap: 8px; }
  .faq-question i { font-size: 0.7rem; }
  .faq-answer-content { padding: 0 14px 14px; font-size: 0.8125rem; }
}

/* ---------- Small Mobile (481px - 767px) ---------- */
@media (min-width: 481px) and (max-width: 767px) {
  .container { padding: 0 16px; }
  
  .logo-text { display: inline; }
  
  .categories-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .category-icon { width: 44px; height: 44px; font-size: 1.125rem; }
  .category-card h4 { font-size: 0.75rem; }
  
  .services-grid { grid-template-columns: 1fr; }
  
  .features-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .feature-card { padding: 20px; }
  
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  
  .steps-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  
  .slide-content { grid-template-columns: 1fr; text-align: center; gap: 24px; }
  .slide-visual { order: -1; max-width: 220px; margin: 0 auto; }
  .visual-icon { font-size: 5rem; }
  .visual-float { display: none; }
  .slide-features { justify-content: center; }
  .slide-buttons { justify-content: center; }
  .slide-description { margin-left: auto; margin-right: auto; }
  
  .hero-search { padding: 20px; }
  .search-form { grid-template-columns: 1fr 1fr; }
  .search-form > div:nth-child(3) { grid-column: span 2; }
  .search-btn { grid-column: span 2; }
  
  .footer-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
  .footer-brand { grid-column: span 2; text-align: center; max-width: 100%; }
  .footer-logo { justify-content: center; }
  .footer-social { justify-content: center; }
  
  .blog-grid { grid-template-columns: 1fr; }
  
  .form-container { padding: 24px; }
}

/* ---------- Tablet (768px - 991px) ---------- */
@media (min-width: 768px) and (max-width: 991px) {
  .topbar { display: none; }
  
  .header { background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(20px); box-shadow: var(--shadow-md); }
  .dark-mode .header { background: rgba(27, 40, 56, 0.95); }
  
  .nav-menu, .header-search, .header-actions .btn { display: none; }
  .menu-toggle { display: flex; }
  
  .hero-slider-wrapper { margin-top: 80px; min-height: 80vh; }
  .slider-track { min-height: 80vh; }
  
  .slide-content { grid-template-columns: 1fr; text-align: center; gap: 32px; padding: 0 24px; }
  .slide-visual { order: -1; max-width: 280px; margin: 0 auto; }
  .visual-icon { font-size: 6rem; }
  .visual-float { display: none; }
  .slide-features { justify-content: center; }
  .slide-buttons { justify-content: center; }
  .slide-description { margin-left: auto; margin-right: auto; }
  
  .hero-search { padding: 24px; }
  .search-form { grid-template-columns: 1fr 1fr auto; }
  .search-form > div:nth-child(3) { grid-column: auto; }
  .search-btn { grid-column: auto; padding: 0 20px; }
  
  .categories-grid { grid-template-columns: repeat(5, 1fr); gap: 12px; }
  .category-icon { width: 52px; height: 52px; font-size: 1.25rem; }
  .category-card h4 { font-size: 0.8125rem; }
  .category-card p { font-size: 0.7rem; }
  
  .services-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  
  .features-grid { grid-template-columns: repeat(3, 1fr); }
  
  .steps-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .steps-grid::before { display: none; }
  .step-number { width: 72px; height: 72px; font-size: 1.75rem; }
  
  .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .stat-card { padding: 20px 12px; flex-direction: column; text-align: center; gap: 8px; }
  .stat-icon { margin: 0 auto; width: 48px; height: 48px; font-size: 1.125rem; }
  .stat-number { font-size: 1.5rem; }
  .stat-label { font-size: 0.75rem; }
  
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
  
  .footer-grid { grid-template-columns: repeat(2, 1fr); gap: 32px; }
  .footer-brand { grid-column: span 2; text-align: center; max-width: 100%; }
  .footer-logo { justify-content: center; }
  .footer-social { justify-content: center; }
  .footer-description { text-align: center; }
  
  /* Services page sidebar as drawer on tablet */
  .services-layout { grid-template-columns: 1fr; }
  .services-sidebar { position: fixed; left: -320px; top: 0; bottom: 0; width: 300px; height: 100vh; border-radius: 0; z-index: 100; overflow-y: auto; transition: left 0.3s ease; }
  .services-sidebar.active { left: 0; }
  .sidebar-overlay.active { display: block; }
  .mobile-filter-btn { display: inline-flex !important; }
  
  .dashboard-sidebar { left: -280px; }
  .dashboard-sidebar.active { left: 0; }
  .dashboard-main { margin-left: 0 !important; padding: 16px; }
  .dashboard-mobile-header { display: flex !important; }
  .dashboard-header { padding-top: 60px; }
  .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
  .dashboard-cards { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
}

/* ---------- Laptop (992px - 1199px) ---------- */
@media (min-width: 992px) and (max-width: 1199px) {
  .header-search { width: 200px; }
  .header-search button { display: none; }
  
  .nav-link { padding: 8px 10px; font-size: 0.875rem; }
  
  .mega-menu { min-width: 480px; }
  .mega-menu-grid { grid-template-columns: repeat(2, 1fr); }
  
  .slide-content { gap: 32px; }
  .slide-title { font-size: 2.5rem; }
  .slide-description { font-size: 1rem; }
  .visual-icon { font-size: 8rem; }
  
  .categories-grid { grid-template-columns: repeat(6, 1fr); gap: 12px; }
  
  .services-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  
  .features-grid { grid-template-columns: repeat(3, 1fr); }
  
  .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .stat-card { padding: 20px 16px; }
  .stat-number { font-size: 1.75rem; }
  
  .blog-grid { grid-template-columns: repeat(3, 1fr); }
  
  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1.5fr; gap: 32px; }
  .footer-brand { grid-column: auto; text-align: left; }
  .footer-logo { justify-content: flex-start; }
  .footer-social { justify-content: flex-start; }
  
  .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 1.5rem; }
}

/* ---------- Desktop (1200px - 1399px) ---------- */
@media (min-width: 1200px) and (max-width: 1399px) {
  .header-search { width: 250px; }
  
  .slide-title { font-size: 3rem; }
  .visual-icon { font-size: 9rem; }
  
  .categories-grid { grid-template-columns: repeat(6, 1fr); }
  
  .services-grid { grid-template-columns: repeat(3, 1fr); }
  
  .features-grid { grid-template-columns: repeat(3, 1fr); }
  
  .blog-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Large Desktop (1400px+) ---------- */
@media (min-width: 1400px) {
  .container { max-width: 1320px; }
  
  .slide-title { font-size: 4rem; }
  .visual-icon { font-size: 10rem; }
  
  .categories-grid { grid-template-columns: repeat(6, 1fr); gap: 16px; }
  
  .services-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; }
  
  .features-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; }
  
  .blog-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; }
}

/* ---------- Ultra-Wide (1600px+) ---------- */
@media (min-width: 1600px) {
  .container { max-width: 1440px; }
  
  .services-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Landscape Mobile ---------- */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-slider-wrapper { min-height: 100vh; }
  .slider-track { min-height: 100vh; }
  
  .slide-content { grid-template-columns: 1.5fr 1fr; }
  .slide-visual { max-width: 200px; }
  .visual-icon { font-size: 5rem; }
  
  .chatbot-window { height: calc(100vh - 20px); bottom: 10px; }
}

/* ---------- Print Styles ---------- */
@media print {
  .header, .footer, .floating-buttons, .back-to-top, .scroll-progress,
  .chatbot-launcher, .chatbot-window, .hero-slider-wrapper, .cta-banner,
  .newsletter-section, .mobile-nav, .mobile-nav-overlay, .loader-wrapper { display: none !important; }
  
  body { background: white !important; color: black !important; }
  
  .section { padding: 20px 0 !important; }
  
  .service-card, .feature-card, .blog-card { break-inside: avoid; box-shadow: none !important; border: 1px solid #ddd !important; }
  
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.75em; color: #666; }
}

/* ---------- Touch Device Optimizations ---------- */
@media (hover: none) and (pointer: coarse) {
  .btn:hover, .category-card:hover, .service-card:hover, .feature-card:hover,
  .blog-card:hover, .vendor-card:hover, .nav-link:hover { transform: none !important; }
  
  .service-card:hover .service-image img,
  .blog-card:hover .blog-image img { transform: none !important; }
  
  .mega-menu, .nav-item:hover .mega-menu, .dropdown, .nav-item:hover .dropdown { display: none !important; }
}

/* ---------- High DPI Displays ---------- */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  img, .slide-bg { image-rendering: -webkit-optimize-contrast; }
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .slider-slide.active .slide-bg { transform: scale(1) !important; }
  .slide-shape { animation: none !important; }
  .visual-main { animation: none !important; }
  .visual-float { animation: none !important; }
}

/* ---------- Safe Area Insets (Notch Devices) ---------- */
@supports (padding: max(0px)) {
  .header { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .footer { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .chatbot-window { left: max(12px, env(safe-area-inset-left)); }
  .chatbot-launcher { left: max(12px, env(safe-area-inset-left)); }
  .floating-buttons { right: max(12px, env(safe-area-inset-right)); }
  .back-to-top { right: max(12px, env(safe-area-inset-right)); }
}

/* ---------- Dark Mode System Preference ---------- */
@media (prefers-color-scheme: dark) {
  :root:not(.light-mode):not(.dark-mode-forced-light) {
    /* System dark mode is optional; we rely on toggle */
  }
}

/* ---------- Responsive Typography Scaling ---------- */
@media (min-width: 768px) {
  html { font-size: 15px; }
}

@media (min-width: 992px) {
  html { font-size: 16px; }
}

@media (min-width: 1200px) {
  html { font-size: 16px; }
}

@media (min-width: 1600px) {
  html { font-size: 17px; }
}

@media (min-width: 1920px) {
  html { font-size: 18px; }
}

/* ---------- Responsive Images ---------- */
img { max-width: 100%; height: auto; display: block; }

/* ---------- Responsive Tables ---------- */
@media (max-width: 767px) {
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 600px; }
}

/* ---------- Responsive Grid Utility ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

@media (max-width: 991px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Accessibility Focus States ---------- */
@media (prefers-reduced-motion: no-preference) {
  :focus-visible {
    outline: 2px solid #1E88E5;
    outline-offset: 2px;
    transition: outline-offset 0.15s ease;
  }
}

/* ---------- Responsive Spacing ---------- */
@media (max-width: 767px) {
  .mt-mobile-0 { margin-top: 0 !important; }
  .mb-mobile-0 { margin-bottom: 0 !important; }
  .p-mobile-sm { padding: 12px !important; }
}

/* ---------- Responsive Flex Utilities ---------- */
.flex-mobile-column { display: flex; }
@media (max-width: 767px) {
  .flex-mobile-column { flex-direction: column; }
}

/* ---------- Responsive Hidden Classes ---------- */
.hide-mobile { display: block; }
.hide-tablet { display: block; }
.hide-desktop { display: none; }

@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: block !important; }
}

@media (min-width: 768px) and (max-width: 991px) {
  .hide-tablet { display: none !important; }
  .show-tablet { display: block !important; }
}

@media (min-width: 992px) {
  .hide-desktop { display: block !important; }
  .show-desktop { display: block !important; }
}
