/* ============================================
   MOBILE RESPONSIVE FIXES
   Nova Titan Systems
   Breakpoints: 1440px, 1024px, 768px, 480px, 360px
   ============================================ */

/* ===== BASE MOBILE FIXES ===== */

/* Prevent horizontal scroll on all devices */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Ensure content doesn't overflow */
.content {
  max-width: 100%;
  overflow-x: hidden;
}

/* ===== 1440px - Large Desktop ===== */
@media (max-width: 1440px) {
  .max-w-7xl {
    max-width: 1200px;
  }
  
  .hero-title {
    font-size: clamp(3rem, 5vw, 4.5rem);
  }
}

/* ===== 1024px - Tablet Landscape ===== */
@media (max-width: 1024px) {
  /* Navigation adjustments */
  .nav-container {
    padding: 0 1.5rem;
  }
  
  /* Hero sections */
  .hero-title {
    font-size: clamp(2.5rem, 4vw, 3.5rem);
  }
  
  /* Card grids */
  .grid.md\\:grid-cols-3,
  .grid.md\\:grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Stats boxes */
  .grid.grid-cols-2.md\\:grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* ===== 768px - Tablet Portrait ===== */
@media (max-width: 768px) {
  /* Typography scaling */
  h1 {
    font-size: clamp(2rem, 6vw, 2.5rem) !important;
  }
  
  h2 {
    font-size: clamp(1.5rem, 5vw, 2rem) !important;
  }
  
  h3 {
    font-size: clamp(1.25rem, 4vw, 1.5rem) !important;
  }
  
  /* Padding adjustments */
  .content {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  section {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }
  
  /* Hero sections */
  .pt-32 {
    padding-top: 6rem !important;
  }
  
  .pt-28 {
    padding-top: 5rem !important;
  }
  
  /* Card grids to single column */
  .grid.md\\:grid-cols-2,
  .grid.md\\:grid-cols-3,
  .grid.md\\:grid-cols-4 {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  /* Buttons full width on mobile */
  .btn-grad,
  .inline-flex.items-center {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
  
  /* Fix button groups */
  .flex.flex-wrap.gap-4 {
    flex-direction: column;
  }
  
  /* Cards */
  .card {
    padding: 1.5rem !important;
  }
  
  /* Footer columns */
  .grid.grid-cols-1.md\\:grid-cols-4 {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  /* Navigation hamburger visible */
  .sm\\:hidden {
    display: block !important;
  }
  
  .hidden.sm\\:flex {
    display: none !important;
  }
}

/* ===== 480px - Mobile Landscape / Small Phone ===== */
@media (max-width: 480px) {
  /* Further typography reduction */
  h1 {
    font-size: clamp(1.75rem, 8vw, 2rem) !important;
    line-height: 1.2;
  }
  
  h2 {
    font-size: clamp(1.5rem, 6vw, 1.75rem) !important;
  }
  
  /* Tighter spacing */
  .px-6 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  .px-8 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  .py-12 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
  
  .py-16 {
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
  }
  
  /* Cards even tighter */
  .card {
    padding: 1rem !important;
    border-radius: 0.75rem !important;
  }
  
  /* Smaller gaps */
  .gap-8 {
    gap: 1rem !important;
  }
  
  .gap-6 {
    gap: 0.75rem !important;
  }
  
  /* Button padding */
  .btn-grad {
    padding: 0.75rem 1.5rem !important;
    font-size: 0.875rem !important;
  }
  
  /* Logo size */
  .h-10.w-10 {
    height: 2rem !important;
    width: 2rem !important;
  }
  
  /* Text adjustments */
  .text-xl {
    font-size: 1.125rem !important;
  }
  
  .text-lg {
    font-size: 1rem !important;
  }
  
  /* Emergency alert */
  .emergency-alert {
    padding: 1rem !important;
  }
  
  /* Service icons */
  .service-icon {
    width: 60px !important;
    height: 60px !important;
  }
  
  /* Resource icons */
  .resource-icon {
    width: 50px !important;
    height: 50px !important;
    font-size: 1.25rem !important;
  }
}

/* ===== 360px - Small Phone Portrait ===== */
@media (max-width: 360px) {
  /* Minimal spacing */
  .content {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  /* Smallest typography */
  h1 {
    font-size: 1.5rem !important;
  }
  
  h2 {
    font-size: 1.25rem !important;
  }
  
  /* Very tight padding */
  .card {
    padding: 0.75rem !important;
  }
  
  .px-6, .px-8 {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
  
  /* Button adjustments */
  .btn-grad {
    padding: 0.625rem 1rem !important;
    font-size: 0.813rem !important;
  }
  
  /* Smaller icons */
  .service-icon,
  .resource-icon {
    width: 40px !important;
    height: 40px !important;
    font-size: 1rem !important;
  }
  
  /* Navigation text */
  .nav-link {
    font-size: 0.875rem;
  }
}

/* ===== FIX SPECIFIC ISSUES ===== */

/* Fix overlapping headers on mobile */
@media (max-width: 768px) {
  .nav-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
  }
  
  #content {
    padding-top: 4rem;
  }
}

/* Fix misaligned buttons */
@media (max-width: 768px) {
  .flex.items-center.space-x-6 {
    flex-direction: column;
    space-x: 0;
    gap: 1rem;
  }
  
  .flex.items-center.gap-4 {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Fix broken card spacing */
@media (max-width: 768px) {
  .grid {
    gap: 1rem;
  }
  
  .space-y-2 > * + * {
    margin-top: 0.5rem;
  }
  
  .space-y-3 > * + * {
    margin-top: 0.75rem;
  }
}

/* Fix text overflow */
@media (max-width: 768px) {
  * {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  pre, code {
    white-space: pre-wrap;
    word-break: break-all;
  }
}

/* Fix navbar collapsing */
@media (max-width: 768px) {
  #mobileMenu {
    background: rgba(10, 10, 15, 0.98);
    backdrop-filter: blur(10px);
    padding: 1rem;
    border-top: 1px solid rgba(0, 212, 255, 0.2);
  }
  
  #mobileMenu a {
    padding: 0.75rem 1rem;
    display: block;
    border-radius: 0.5rem;
  }
  
  #mobileMenu a:hover {
    background: rgba(0, 212, 255, 0.1);
  }
}

/* Fix image scaling */
@media (max-width: 768px) {
  img {
    max-width: 100%;
    height: auto;
  }
  
  .profile-image {
    max-width: 250px;
    margin: 0 auto;
  }
}

/* Fix footer on mobile */
@media (max-width: 768px) {
  footer .grid {
    text-align: center;
  }
  
  footer .flex.items-start {
    justify-content: center;
  }
  
  footer .social-icon {
    width: 2rem;
    height: 2rem;
  }
}
