/* Hostxolo - Complete Mobile Responsive Fixes */
/* ======== GLOBAL ======== */
*, *::before, *::after {
  -webkit-tap-highlight-color: transparent;
}

html { overflow-x: clip; }

body {
  overflow-x: clip;
  width: 100%;
  position: relative;
  min-height: 100vh;
}

img, iframe, video, embed { max-width: 100%; height: auto; }

.container { padding-left: 16px; padding-right: 16px; }

/* ======== TABLET (max-width: 991px) ======== */
@media (max-width: 991.98px) {
  /* Navbar */
  .navbar-collapse {
    background: #fff;
    padding: 1rem;
    border-radius: 1rem;
    margin-top: 0.75rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border: 1px solid #e2e8f0;
    max-height: 80vh;
    overflow-y: auto;
  }
  .navbar-nav .nav-link {
    padding: 0.7rem 1rem !important;
    border-radius: 0.5rem;
    margin: 2px 0;
    color: #1e293b !important;
  }
  .navbar-nav .nav-link:hover,
  .navbar-nav .nav-link.active {
    background: rgba(249,115,22,0.08);
    color: #f97316 !important;
  }
  .navbar-nav .dropdown-menu {
    background: #f8fafc;
    border: none;
    box-shadow: none;
    padding: 0 0.5rem;
    margin: 0;
  }
  .navbar-nav .dropdown-item {
    padding: 0.6rem 1rem;
    border-radius: 0.375rem;
    color: #475569;
  }
  .navbar-nav .dropdown-item:hover {
    background: #f97316;
    color: #fff;
  }
  .navbar-nav .btn {
    width: 100%;
    margin: 0.375rem 0;
    justify-content: center;
  }
  .navbar-brand img { max-height: 32px; }

  /* Hero */
  .hero-title { font-size: 2.5rem !important; }
  .section-title { font-size: 2rem !important; }
  .pricing-card.featured { transform: none !important; }
  .pricing-card.featured:hover { transform: translateY(-4px) !important; }
  .page-header { padding: 6rem 0 3rem !important; }

  /* Disable 3D tilt on touch */
  .tilt-card { transform: none !important; }
  .tilt-card .tilt-glow { display: none !important; }
  .card-3d { transform: none !important; }
  .magnetic-btn { transform: none !important; }

  /* Admin sidebar */
  .admin-sidebar {
    min-height: auto !important;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 1040;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
  }
  .admin-sidebar .nav-link { padding: 0.75rem 1rem; }
  .admin-content { margin-left: 0 !important; }
}

/* ======== MOBILE (max-width: 768px) ======== */
@media (max-width: 768px) {
  /* Container padding */
  .container { padding-left: 14px; padding-right: 14px; }

  /* Hero */
  .hero-section,
  .about-hero,
  .support-hero {
    padding: 4.5rem 0 3rem !important;
    text-align: center;
    min-height: auto !important;
  }
  .hero-section h1,
  .hero-title,
  .about-hero h1,
  .support-hero h1 {
    font-size: 1.75rem !important;
    margin-bottom: 0.75rem;
    line-height: 1.2;
  }
  .hero-subtitle {
    font-size: 1rem !important;
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 100% !important;
  }
  .hero-section p.text-light {
    font-size: 0.9375rem;
    margin-left: auto;
    margin-right: auto;
  }
  .hero-buttons { text-align: center; }
  .hero-buttons .btn {
    padding: 0.7rem 1.25rem;
    font-size: 0.875rem;
    margin: 0.25rem;
    display: inline-block;
    width: auto;
  }
  .section-badge { font-size: 0.7rem; padding: 0.35rem 0.75rem; }

  /* Page Header */
  .page-header {
    padding: 5rem 0 2.5rem !important;
  }
  .page-header h1 {
    font-size: 1.625rem !important;
  }
  .page-header p { font-size: 0.9375rem; }

  /* Section Titles */
  .section-title {
    font-size: 1.5rem !important;
    line-height: 1.3;
  }
  .section-subtitle {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
  }

  /* Stats */
  .stats-section { padding: 3rem 0 !important; }
  .stat-number { font-size: 2rem !important; }
  .stat-label { font-size: 0.8rem; }
  .stat-item { padding: 0.75rem 0.25rem; }

  /* Service Cards */
  .services-section,
  .software-section,
  .testimonials-section {
    padding: 3rem 0 !important;
  }
  .service-card { padding: 1.25rem; }
  .service-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 0.75rem;
  }
  .service-icon i { font-size: 1.25rem; }
  .service-card h3 { font-size: 1.0625rem; }
  .service-card p { font-size: 0.875rem; }
  .service-card .btn-sm { font-size: 0.8125rem; padding: 0.4rem 0.75rem; }

  /* Software Cards */
  .software-header { padding: 1.25rem; }
  .software-header i { font-size: 2rem; }
  .software-header h4 { font-size: 1.0625rem; }
  .software-body { padding: 1rem; }
  .software-body p { font-size: 0.875rem; }
  .software-price { font-size: 1.25rem; }

  /* Blog */
  .blog-image { height: 160px !important; }
  .blog-body { padding: 1rem; }
  .blog-title { font-size: 1rem; }

  /* Testimonials */
  .testimonial-card { padding: 1.25rem; }
  .testimonial-content { font-size: 0.9375rem; }
  .testimonial-rating { margin-bottom: 0.75rem; }

  /* Pricing Cards (plans.php) */
  .pricing-hero { padding: 80px 14px 30px !important; }
  .pricing-hero h1 { font-size: 1.75rem !important; }
  .pricing-card-wrapper { flex: 1 1 100% !important; max-width: 100% !important; }
  .pricing-card { padding: 24px 18px !important; border-radius: 18px !important; }
  .plan-price { font-size: 1.75rem !important; }
  .plan-title { font-size: 1.2rem !important; }
  .plan-section { padding: 12px 14px !important; }
  .plan-section-title { font-size: 0.7rem !important; }
  .plan-list li { font-size: 0.82rem !important; padding: 2px 6px !important; }
  .feature-item { font-size: 0.82rem !important; }
  .popular-badge { font-size: 0.6rem !important; padding: 4px 10px !important; top: 12px !important; right: 12px !important; }
  .plan-cta { padding: 12px 18px !important; font-size: 0.9rem !important; }

  /* CTA */
  .cta-section { padding: 3rem 0 !important; }
  .cta-section h2 { font-size: 1.5rem !important; }
  .cta-section p { font-size: 0.9375rem; }
  .cta-section .btn-light { padding: 0.75rem 1.5rem; font-size: 0.9375rem; }

  /* Contact */
  .contact-form { padding: 1rem; }
  .contact-info { margin-bottom: 1.5rem; text-align: center; }
  .contact-info .icon { margin: 0 auto 0.75rem; }

  /* Support */
  .support-hero .display-4 { font-size: 1.75rem !important; }
  .support-hero .lead { font-size: 0.9375rem !important; }
  .contact-card { padding: 1.25rem !important; }
  .contact-card h4 { font-size: 1.0625rem; }
  .contact-icon { width: 60px; height: 60px; font-size: 1.5rem; }

  /* About */
  .about-hero .display-4 { font-size: 1.75rem !important; }
  .stat-card { padding: 1.25rem; }
  .stat-card h3 { font-size: 1.5rem !important; }
  .value-card { padding: 1.25rem; }
  .value-icon { width: 60px; height: 60px; font-size: 1.75rem; }
  .mission-section { padding: 2rem !important; }

  /* FAQ */
  .faq-section h2 { font-size: 1.5rem !important; }
  .accordion-button { font-size: 0.9rem !important; padding: 14px 16px !important; }
  .accordion-body { font-size: 0.875rem !important; padding: 0 16px 14px !important; }

  /* Footer */
  footer { padding: 2.5rem 0 1rem !important; }
  footer .row > div { margin-bottom: 1.5rem; }
  footer h5 { font-size: 0.9375rem; margin-bottom: 0.75rem; }
  footer .d-flex.gap-3 { justify-content: flex-start; }

  /* Back to Top */
  .back-to-top {
    bottom: 20px;
    right: 15px;
    width: 40px;
    height: 40px;
    font-size: 0.875rem;
  }

  /* Buttons General */
  .btn-lg { padding: 0.7rem 1.5rem; font-size: 0.9375rem; }

  /* Tables */
  .table { font-size: 0.8125rem; }
  .table th, .table td { padding: 0.5rem 0.625rem; white-space: nowrap; }
  .table-responsive { border-radius: 0.75rem; border: 1px solid #e2e8f0; }

  /* Forms */
  .form-control,
  .form-select {
    font-size: 16px !important;
    padding: 0.65rem 0.875rem;
  }
  .btn { min-height: 44px; font-size: 0.9375rem; }
  .btn-group .btn { min-height: auto; }

  /* Modals */
  .modal-dialog { margin: 0.75rem; }

  /* Dashboard */
  .user-sidebar {
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }
  .welcome-banner {
    padding: 1.5rem !important;
    text-align: center;
  }
  .welcome-banner h2 { font-size: 1.375rem; }
  .stat-card { padding: 1rem; }
  .stat-card .icon { width: 44px; height: 44px; font-size: 1.125rem; }
  .stat-card h3 { font-size: 1.25rem; }
  .stat-card h6 { font-size: 0.6875rem; }

  /* Page template legal pages */
  .cms-content { font-size: 0.9375rem; }
  .cms-content h2 { font-size: 1.25rem; }
  .cms-content h3 { font-size: 1.0625rem; }

  /* Service/Software filter buttons */
  .btn-group.flex-wrap .btn {
    font-size: 0.8125rem;
    padding: 0.4rem 0.75rem;
    margin: 2px;
  }
}

/* ======== SMALL MOBILE (max-width: 480px) ======== */
@media (max-width: 480px) {
  .container { padding-left: 12px; padding-right: 12px; }

  .hero-section h1,
  .hero-title { font-size: 1.5rem !important; }
  .hero-subtitle { font-size: 0.875rem !important; }
  .hero-buttons .btn {
    display: block;
    width: 100%;
    margin: 0.375rem 0;
  }

  .section-title { font-size: 1.325rem !important; }
  .page-header h1 { font-size: 1.375rem !important; }

  .stat-number { font-size: 1.75rem !important; }
  .stat-label { font-size: 0.75rem; }

  .pricing-hero h1 { font-size: 1.5rem !important; }
  .plan-price { font-size: 1.5rem !important; }
  .pricing-card { padding: 18px 14px !important; }

  .cta-section h2 { font-size: 1.325rem !important; }
  .card-body { padding: 1rem; }

  .btn-group { flex-direction: column; }
  .btn-group .btn {
    border-radius: 0.5rem !important;
    margin-bottom: 0.25rem;
  }

  /* WhatsApp float */
  .position-fixed.btn-success {
    bottom: 15px !important;
    left: 15px !important;
    padding: 8px 14px !important;
    font-size: 0.8125rem !important;
  }
}

/* ======== LANDSCAPE ======== */
@media (max-width: 768px) and (orientation: landscape) {
  .hero-section,
  .about-hero,
  .support-hero {
    padding: 3.5rem 0 1.5rem !important;
  }
  .navbar { padding: 0.25rem 0; }
  .hero-title { font-size: 1.5rem !important; }
}

/* ======== TOUCH DEVICES ======== */
@media (hover: none) and (pointer: coarse) {
  .btn, .nav-link, .dropdown-item, .card-link { min-height: 44px; }
  .btn:active,
  .nav-link:active,
  .card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  .tilt-card { transform: none !important; }
  .tilt-card .tilt-glow { display: none !important; }
  .magnetic-btn { transform: none !important; }
  .hero-particle { display: none !important; }
}

/* ======== CHAT WIDGET SAFE Z-INDEX ======== */
/* Only z-index - never force display/visibility on widget internals */
#tidio-chat, #tawkchat, #tawkchat-container,
.crisp-client:first-child, .intercom-lightweight-app,
body > iframe[style*="fixed"] {
  z-index: 9999 !important;
}

/* ======== DISABLE OVERHEADS ON MOBILE ======== */
@media (max-width: 768px) {
  /* Disable heavy animations */
  .orbit-ring { display: none !important; }
  .hero-particles { opacity: 0.3; }
  .particle-container { opacity: 0.3; }
  .scroll-indicator { display: none !important; }
  .float-anim { animation: none !important; }
  .glow-pulse { animation: none !important; }
  .morph-bg::before { animation: none !important; display: none; }

  /* Reduce shadow for performance */
  .service-card,
  .software-card,
  .blog-card,
  .testimonial-card { box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important; }

  /* Full width cards stack */
  .row.g-4 > [class*="col-"] { padding-bottom: 0; }
}
