/* ========================================================
   Earth Fibrex Infra Private Limited - Responsive Stylesheet
   Mobile First & Cross-Device Optimization
   ======================================================== */

/* Mobile Nav Drawer & Overlay */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  height: 100%;
  background: var(--dark-slate);
  z-index: 1999;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.mobile-nav-drawer.open {
  right: 0;
}

.mobile-drawer-header {
  padding: 20px;
  border-bottom: 1px solid var(--dark-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-drawer-header .mobile-logo img {
  height: 40px;
}

.mobile-close-btn {
  background: none;
  border: none;
  color: var(--gray-300);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

.mobile-drawer-body {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-grow: 1;
}

.mobile-nav-link {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: #f1f5f9;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  color: var(--primary);
  padding-left: 6px;
}

.mobile-drawer-footer {
  padding: 20px;
  border-top: 1px solid var(--dark-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Sticky Bottom Action Bar for Mobile Devices */
.mobile-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--dark-slate);
  border-top: 1px solid var(--dark-border);
  z-index: 1500;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.2);
}

.mobile-bottom-inner {
  display: flex;
  height: 100%;
}

.mobile-action-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px;
}

.mobile-action-tab:last-child {
  border-right: none;
}

.mobile-action-tab.call-tab {
  background: #1e293b;
}

.mobile-action-tab.wa-tab {
  background: #25D366;
}

.mobile-action-tab.quote-tab {
  background: var(--primary);
}

.mobile-action-tab .tab-icon {
  font-size: 1.1rem;
  margin-bottom: 2px;
}

/* Media Queries */
@media (max-width: 1024px) {
  .nav-menu {
    gap: 18px;
  }
  
  .hero-title {
    font-size: clamp(2rem, 4vw, 2.7rem);
  }
  
  .calc-grid {
    grid-template-columns: 1fr;
  }
  
  .calc-results-pane {
    border-top: 1px solid var(--gray-200);
  }
  
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* Product Detail Layout Responsive */
  .product-detail-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  
  .product-gallery-card {
    position: static;
    max-width: 680px;
    margin: 0 auto;
    width: 100%;
  }

  .catalog-filter-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }
}

@media (max-width: 868px) {
  .nav-menu,
  .phone-quick-link {
    display: none;
  }
  
  .hamburger-btn {
    display: flex;
  }

  .nav-wrapper {
    height: 68px;
  }

  .site-logo img {
    height: 40px;
    max-width: 175px;
    width: auto;
  }

  .nav-actions {
    gap: 10px;
  }

  .nav-actions .btn-primary {
    padding: 8px 14px;
    font-size: 0.84rem;
  }
  
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  
  .hero-trust-metrics {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
  
  .about-grid {
    grid-template-columns: 1fr;
  }

  .application-detail-card {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px 20px;
  }

  .application-detail-card.reverse > div:first-child {
    order: 1;
  }

  .application-detail-card.reverse > div:last-child {
    order: 2;
  }

  .application-detail-card .app-detail-img-box {
    height: 240px;
  }
  
  .floating-actions-desktop {
    display: none; /* replaced by mobile-bottom-bar */
  }
  
  .mobile-bottom-bar {
    display: block;
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(62px + env(safe-area-inset-bottom));
  }
  
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }

  .top-bar {
    padding: 6px 0;
  }

  .top-bar-content {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
  }
  
  .top-bar-left {
    display: flex;
    justify-content: center;
    gap: 12px;
    font-size: 0.78rem;
    flex-wrap: wrap;
  }
  
  .top-bar-right {
    display: flex;
    justify-content: center;
  }
  
  .top-social-icon {
    width: 26px;
    height: 26px;
  }

  .top-slider-arrow {
    width: 36px;
    height: 36px;
  }
  .top-slider-arrow svg {
    width: 18px;
    height: 18px;
  }
  .top-slider-prev {
    left: 8px;
  }
  .top-slider-next {
    right: 8px;
  }
  .top-slider-dots {
    bottom: 8px;
    padding: 4px 10px;
    gap: 6px;
  }
  .top-slider-dot {
    width: 7px;
    height: 7px;
  }
  .top-slider-dot.active {
    width: 20px;
  }

  .hero-section {
    padding: 36px 0 44px;
  }
  
  .hero-title {
    font-size: clamp(1.75rem, 6vw, 2.2rem);
    line-height: 1.2;
    margin-bottom: 16px;
  }
  
  .hero-subtitle {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 24px;
  }

  .hero-cta-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
    margin-bottom: 24px;
  }

  .hero-cta-group .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
  
  .hero-trust-metrics {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 16px;
  }

  .metric-item {
    text-align: center;
  }

  .metric-number {
    font-size: 1.8rem;
  }
  
  .products-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .app-grid {
    grid-template-columns: 1fr;
  }

  .trust-strip-inner {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  
  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .res-breakdown-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .footer-bottom,
  .footer-bottom-inner {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
  
  .section-title {
    font-size: clamp(1.6rem, 5vw, 2rem);
  }

  .section-desc {
    font-size: 0.92rem;
  }
  
  .calc-inputs-pane,
  .calc-results-pane {
    padding: 22px 16px;
  }

  .res-main-number {
    font-size: 2.2rem;
  }

  /* Comparison & TDS Tables Touch Scroll */
  .comparison-table-wrapper,
  .tds-table-wrapper,
  .tds-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    border-radius: var(--radius-sm);
  }

  .comparison-table,
  .tds-table {
    min-width: 520px;
  }

  /* Product Detail Mobile Specifics */
  .product-detail-hero {
    padding: 18px 0 32px;
  }

  .product-gallery-main {
    height: 250px;
  }

  .product-feature-list {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .product-actions-bar {
    flex-direction: column;
    gap: 10px;
  }

  .btn-catalogue-download,
  .btn-catalogue-secondary,
  .btn-whatsapp-detail {
    font-size: 0.88rem;
    padding: 12px 14px;
    width: 100%;
    justify-content: center;
  }

  .detail-inquiry-box {
    padding: 20px 14px;
  }

  .tds-table th,
  .tds-table td {
    padding: 10px 12px;
    font-size: 0.82rem;
  }

  .tds-table td.property-col {
    width: 45%;
  }

  /* Custom Modals on Mobile */
  .custom-modal-dialog {
    max-width: 95vw;
    margin: 10px auto;
    max-height: 90vh;
    border-radius: var(--radius-md);
  }

  .custom-modal-dialog .modal-header {
    padding: 14px 16px;
  }

  .custom-modal-dialog .modal-body {
    padding: 16px 14px;
  }

  /* International Phone Mobile Styling */
  .country-flag-img {
    width: 20px;
    height: 14px;
  }
  .intl-phone-wrapper .country-picker {
    padding: 0;
  }
  .country-picker-btn {
    padding: 10px 6px;
    font-size: 0.84rem;
    gap: 4px;
  }
  .intl-phone-wrapper .phone-input-ctrl {
    padding: 10px 8px !important;
    font-size: 0.88rem !important;
  }

  /* Captcha Mobile Styling - Responsive Wrap */
  .captcha-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
  }
  .captcha-challenge-badge {
    flex: 1 1 auto;
    min-width: 130px;
    padding: 7px 10px;
    font-size: 0.95rem;
  }
  .captcha-question-text {
    font-size: 0.95rem;
  }
  .captcha-input {
    flex: 1 1 90px;
    max-width: 100%;
    min-width: 90px;
    font-size: 0.95rem !important;
    padding: 8px 10px;
  }
}

/* Ultra-compact Mobile Viewports (< 420px: iPhone SE, Galaxy Fold, etc.) */
@media (max-width: 420px) {
  .container {
    padding: 0 12px;
  }

  .nav-wrapper {
    height: 60px;
  }

  .site-logo img {
    height: 34px;
    max-width: 140px;
  }

  .nav-actions .btn-primary {
    display: none; /* User has bottom bar with quote tab */
  }

  .hero-badge-pill {
    font-size: 0.75rem;
    padding: 4px 10px;
  }

  .top-slider-arrow {
    width: 28px;
    height: 28px;
  }

  .top-slider-arrow svg {
    width: 14px;
    height: 14px;
  }

  .top-slider-prev {
    left: 4px;
  }

  .top-slider-next {
    right: 4px;
  }

  .top-slider-dots {
    bottom: 6px;
    padding: 3px 8px;
    gap: 5px;
  }

  .top-slider-dot {
    width: 6px;
    height: 6px;
  }

  .top-slider-dot.active {
    width: 16px;
  }

  .trust-strip-inner {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .product-gallery-main {
    height: 210px;
  }

  .product-card-footer {
    flex-direction: column;
    gap: 8px;
  }

  .product-card-footer .btn {
    width: 100%;
  }

  .mobile-action-tab {
    font-size: 0.7rem;
    padding: 2px;
  }

  .mobile-action-tab .tab-icon {
    font-size: 1rem;
  }
}
