/* ==========================================================================
   TODAYEGGPRICE.IN - COMPLETE RESPONSIVE & MOBILE-FRIENDLY STYLESHEET
   100% Mobile, Tablet, Laptop & Web Optimized (Preserves Original Aesthetics)
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. GENERAL TOUCH & VIEWPORT OPTIMIZATIONS
   -------------------------------------------------------------------------- */
* {
  -webkit-tap-highlight-color: rgba(251, 191, 36, 0.15);
}

html, body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* Prevent text overflow on narrow screens */
h1, h2, h3, h4, p, span, a {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Smooth Touch Scrolling for Horizontal Containers (Tables & Filter Button Trays) */
.overflow-x-auto {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(251, 191, 36, 0.4) rgba(23, 31, 51, 0.6);
}

.overflow-x-auto::-webkit-scrollbar {
  height: 5px;
}

.overflow-x-auto::-webkit-scrollbar-track {
  background: rgba(23, 31, 51, 0.5);
  border-radius: 4px;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
  background: rgba(251, 191, 36, 0.4);
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   1. TABLET & SMALL LAPTOP BREAKPOINTS (max-width: 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  /* Hero section adjustments */
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  /* Interactive Map & State Breakdown stacking */
  .map-cities-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  /* Ensure SVG India map fits screen width on tablet */
  .india-svg-map-container svg {
    max-width: 100%;
    height: auto;
    max-height: 520px;
  }

  /* Footer grid adjustment */
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }
}

/* --------------------------------------------------------------------------
   2. TABLET & MOBILE BREAKPOINTS (max-width: 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Navbar & Mobile Menu adjustments */
  .nav-links-desktop {
    display: none !important;
  }

  /* Ensure mobile hamburger menu button is accessible & touch friendly */
  #mobile-menu-btn {
    display: inline-flex !important;
    min-height: 42px;
    min-width: 42px;
    align-items: center;
    justify-content: center;
  }

  #mobile-menu {
    border-radius: 1rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  }

  /* Top Ticker Bar stacking */
  .ticker-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  /* Interactive Map section */
  #map-section, #cities-section, #chart-section, #calculator-section {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Make SVG map touch-responsive and easy to tap */
  .india-state-path {
    cursor: pointer;
    touch-action: manipulation;
  }

  /* Top Cities Table Controls layout */
  #cities-section input#city-search-input {
    width: 100%;
  }

  /* Time range tabs & filter buttons scrollable tray */
  #chart-tabs, .region-filter-btn, .price-mode-btn {
    white-space: nowrap;
  }

  /* Adjust Chart Canvas Container height for Tablet */
  #priceHistoryChart, #delhiPriceChart {
    max-height: 260px !important;
  }

  /* Calculator Quick Quantity Buttons wrap evenly */
  .calc-preset-btn, .delhi-quick-btn {
    flex: 1 1 auto;
    min-width: 70px;
    text-align: center;
  }
}

/* --------------------------------------------------------------------------
   3. SMALL MOBILE BREAKPOINTS (max-width: 640px)
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  /* Hero title font size scaling for small phone screens */
  h1 {
    font-size: 2.25rem !important;
    line-height: 1.15 !important;
  }

  h2 {
    font-size: 1.85rem !important;
    line-height: 1.2 !important;
  }

  /* Reduce padding on Glass Cards for extra screen real-estate */
  .glass-card {
    padding: 1.25rem !important;
  }

  /* SVG India Map sizing for phone */
  #india-svg-map {
    width: 100% !important;
    height: auto !important;
    max-height: 400px !important;
  }

  /* Top Cities Today Table compact padding for mobile */
  table th, table td {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    padding-top: 0.85rem !important;
    padding-bottom: 0.85rem !important;
    font-size: 0.825rem !important;
  }

  /* Ensure Table Status badges don't overflow */
  table td span {
    white-space: nowrap;
  }

  /* Price History Chart height on mobile */
  #priceHistoryChart, #delhiPriceChart {
    height: 220px !important;
    max-height: 220px !important;
  }

  /* Calculator Results layout */
  #calc-est-price, #delhi-calc-wholesale, #delhi-calc-retail {
    font-size: 1.75rem !important;
  }

  /* News & FAQ grids single column */
  .grid-cols-2, .grid-cols-3 {
    grid-template-columns: 1fr !important;
  }

  /* Keep 2-column stats row intact on mobile */
  .grid-cols-2.sm\:grid-cols-3, .grid-cols-2.sm\:grid-cols-4 {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Footer bottom copyright stacking */
  footer .flex-col.sm\:flex-row {
    flex-direction: column !important;
    text-align: center !important;
    gap: 1rem !important;
  }
}

/* --------------------------------------------------------------------------
   4. EXTRA SMALL MOBILE BREAKPOINTS (max-width: 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  /* Tighten navigation spacing */
  nav {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  /* Buttons touch target minimum height */
  button, input[type="text"], input[type="number"], select {
    min-height: 42px;
  }

  /* Make sure footer columns stack vertically */
  .footer-grid {
    grid-template-columns: 1fr !important;
    text-align: center;
  }
}
