/* ============================================================
   Protinex Diabetes Care — Responsive Stylesheet
   Breakpoints: 1200px | 1024px | 768px | 480px | 360px
   ============================================================ */

/* ── Large Desktop: ≤ 1200px ───────────────────────────────── */
@media (max-width: 1200px) {
  .container { max-width: 100%; padding: 0 1.5rem; }
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; }
}

/* ── Tablet: ≤ 1024px ──────────────────────────────────────── */
@media (max-width: 1024px) {
  /* Typography */
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.875rem; }

  /* Header */
  .main-nav { display: none; }
  .hamburger { display: flex; }
  .header-actions .btn-outline-sm { display: none; }

  /* Hero */
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
  }
  .hero-image-wrap { order: -1; }
  .hero-image-wrap img { max-height: 320px; }
  .hero-actions { justify-content: center; }
  .hero-stats { justify-items: center; }
  .hero-desc { margin-left: auto; margin-right: auto; }
  .hero-tag { display: none; }

  /* Benefits */
  .benefits-grid { grid-template-columns: repeat(2, 1fr); }

  /* Product */
  .product-inner { grid-template-columns: 1fr; gap: 2.5rem; }
  .product-gallery { position: static; }

  /* Product preview section (index.php inline grid) */
  .product-preview-section > .container > div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  /* How to use */
  .steps-grid { grid-template-columns: repeat(2, 1fr); }
  .steps-grid::before { display: none; }

  /* Nutrition */
  .nutrition-inner { grid-template-columns: 1fr; }

  /* Testimonials */
  .testimonials-grid { grid-template-columns: repeat(2, 1fr); }

  /* Checkout */
  .checkout-grid { grid-template-columns: 1fr; }
  .order-summary { position: static; }

  /* Account */
  .account-inner { grid-template-columns: 1fr; }
  .account-sidebar { position: static; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
  .footer-brand { grid-column: 1 / -1; }

  /* Product detail images grid (product.php) */
  .product-detail-imgs { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ── Mobile: ≤ 768px ───────────────────────────────────────── */
@media (max-width: 768px) {
  /* Base */
  body { font-size: 15px; }

  /* Typography */
  h1 { font-size: 1.875rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.125rem; }
  .section-pad { padding: 3rem 0; }
  .section-title { font-size: 1.5rem; }
  .section-subtitle { font-size: .9375rem; margin-bottom: 2rem; }

  /* Header */
  .header-inner { height: 60px; }
  .logo-sub { display: none; }
  /* Keep Order Now button visible on mobile — just hide the text, show icon */
  .header-actions .btn-primary-sm { display: inline-flex !important; }
  .logo-brand { font-size: 1rem; }

  /* Announcement bar */
  .announcement-bar { font-size: .75rem; padding: .4rem .75rem; }
  .announcement-bar p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Hero */
  .hero-section { padding: 2.5rem 0 2rem; }
  .hero-image-wrap img { max-height: 240px; }
  .hero-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
    padding-top: 1.25rem;
  }
  .hero-stat-num { font-size: 1.375rem; }
  .hero-stat-label { font-size: .75rem; }
  .hero-actions { flex-direction: column; align-items: center; gap: .75rem; }
  .hero-actions .btn-primary,
  .hero-actions .btn-outline { width: 100%; max-width: 320px; justify-content: center; }
  .hero-desc { font-size: .9375rem; }

  /* Trust bar */
  .trust-bar-inner { gap: 1rem; justify-content: flex-start; padding: 0 .5rem; }
  .trust-divider { display: none; }
  .trust-item { font-size: .8125rem; }
  .trust-bar { overflow-x: auto; }

  /* Benefits */
  .benefits-grid { grid-template-columns: 1fr; gap: 1rem; }
  .benefit-card { padding: 1.5rem 1.25rem; }
  .benefit-icon { width: 52px; height: 52px; font-size: 1.375rem; }

  /* Steps */
  .steps-grid { grid-template-columns: 1fr; gap: 1rem; }
  .step-card { padding: 1.25rem 1rem; }

  /* Testimonials */
  .testimonials-grid { grid-template-columns: 1fr; gap: 1rem; }

  /* Product page */
  .product-main-img { min-height: 280px; }
  .product-thumbs { flex-wrap: wrap; }
  .pack-options { gap: .5rem; }
  .pack-option { padding: .4rem .875rem; font-size: .8125rem; }
  .product-actions { flex-direction: column; }
  .product-actions .btn-primary,
  .product-actions .btn-outline { width: 100%; }
  .price-current { font-size: 1.75rem; }

  /* Product detail images (product.php) */
  .product-detail-imgs { grid-template-columns: repeat(2, 1fr) !important; gap: .75rem !important; }

  /* Product preview section (index.php) */
  .product-preview-section > .container > div { grid-template-columns: 1fr !important; gap: 2rem !important; }
  .product-preview-section > .container > div > div:first-child { grid-template-columns: 1fr 1fr !important; }

  /* Nutrition */
  .nutrition-inner { gap: 1.5rem; }
  .nutrition-table { font-size: .8125rem; }
  .nutrition-table th, .nutrition-table td { padding: .625rem .75rem; }

  /* Forms */
  .form-row { grid-template-columns: 1fr; gap: 0; }

  /* Auth */
  .auth-page { padding: 1.5rem 1rem; align-items: flex-start; padding-top: 2rem; }
  .auth-card { padding: 1.75rem 1.25rem; }

  /* Checkout */
  .checkout-page { padding: 1.5rem 0 3rem; }
  .checkout-form-wrap { padding: 1.25rem; }
  .checkout-section-title { font-size: .9375rem; }
  .order-summary { padding: 1.25rem; }
  .checkout-grid { gap: 1.25rem; }

  /* Account */
  .account-page { padding: 1.5rem 0 3rem; }
  .account-inner { gap: 1rem; }
  .account-content { padding: 1.25rem; }
  .account-content-title { font-size: 1.125rem; }
  .orders-table { font-size: .8125rem; }
  .orders-table th, .orders-table td { padding: .625rem .75rem; }
  .orders-table th:nth-child(4),
  .orders-table td:nth-child(4) { display: none; } /* hide qty col */

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; gap: 1.75rem; }
  .footer-brand { grid-column: auto; }
  .footer-bottom { flex-direction: column; text-align: center; gap: .5rem; }
  .footer-bottom-links { justify-content: center; flex-wrap: wrap; gap: .75rem; }
  .social-links { justify-content: flex-start; }
  .site-footer { padding: 2.5rem 0 0; }

  /* FAQ */
  .faq-question { font-size: .875rem; padding: 1rem 1.25rem; }
  .faq-list { gap: .5rem; }

  /* CTA */
  .cta-banner { padding: 2.5rem 0; }
  .cta-banner h2 { font-size: 1.5rem; }
  .cta-banner p { font-size: .9375rem; }
  .cta-banner .btn-secondary { width: 100%; max-width: 300px; }

  /* Order success page */
  .order-success-grid { grid-template-columns: 1fr !important; }

  /* Payment options */
  .payment-methods { gap: .5rem; }
  .payment-option { padding: .75rem; }

  /* Mobile nav */
  .mobile-nav { width: 100%; right: -100%; }
  .mobile-nav.open { right: 0; }
}

/* ── Small Mobile: ≤ 480px ─────────────────────────────────── */
@media (max-width: 480px) {
  /* Typography */
  h1 { font-size: 1.625rem; }
  h2 { font-size: 1.3125rem; }
  h3 { font-size: 1rem; }

  /* Container */
  .container { padding: 0 .875rem; }

  /* Hero */
  .hero-section { padding: 2rem 0 1.75rem; }
  .hero-badge { font-size: .75rem; padding: .3rem .75rem; }
  .hero-stats { gap: .5rem; }
  .hero-stat-num { font-size: 1.25rem; }
  .hero-stat-label { font-size: .6875rem; }
  .hero-image-wrap img { max-height: 200px; }

  /* Buttons */
  .btn-primary, .btn-secondary, .btn-outline {
    padding: .6875rem 1.25rem;
    font-size: .9375rem;
  }

  /* Trust bar */
  .trust-bar-inner { flex-direction: column; gap: .625rem; align-items: flex-start; padding: 0 .875rem; }
  .trust-item .trust-icon { width: 30px; height: 30px; font-size: .875rem; }

  /* Benefits */
  .benefits-section { padding: 2.5rem 0; }
  .benefit-card { padding: 1.25rem 1rem; }

  /* Product gallery */
  .product-main-img { min-height: 240px; padding: 1rem; }
  .product-thumbs { gap: .375rem; }
  .product-thumb { width: 56px; height: 56px; }
  .product-section { padding: 2.5rem 0; }

  /* Product detail images */
  .product-detail-imgs { grid-template-columns: 1fr 1fr !important; gap: .5rem !important; }

  /* Price */
  .price-current { font-size: 1.5rem; }
  .price-original { font-size: 1rem; }

  /* Pack options */
  .pack-options { flex-direction: column; gap: .5rem; }
  .pack-option { width: 100%; text-align: center; }

  /* Quantity */
  .quantity-selector { flex-wrap: wrap; gap: .5rem; }

  /* Auth */
  .auth-card { padding: 1.5rem .875rem; border-radius: var(--radius-md); }
  .auth-title { font-size: 1.25rem; }
  .auth-subtitle { font-size: .875rem; }

  /* Checkout */
  .checkout-form-wrap { padding: 1rem .875rem; }
  .order-summary { padding: 1rem .875rem; }
  .checkout-section-title { font-size: .875rem; }
  .order-item-img { width: 48px; height: 48px; }

  /* Account */
  .account-content { padding: 1rem .875rem; }
  .orders-table th:nth-child(3),
  .orders-table td:nth-child(3) { display: none; }
  .account-avatar { width: 52px; height: 52px; font-size: 1.25rem; }

  /* Mobile nav */
  .mobile-nav { width: 100%; padding: 1.25rem 1rem; }

  /* Nutrition table */
  .nutrition-table th, .nutrition-table td { padding: .5rem .625rem; font-size: .75rem; }
  .nutrition-table th:last-child,
  .nutrition-table td:last-child { display: none; } /* hide % DV on tiny screens */

  /* Footer */
  .footer-badges { gap: .375rem; }
  .footer-badge { font-size: .6875rem; padding: .3rem .5rem; }
  .footer-col h4 { font-size: .875rem; }
  .footer-col ul li a { font-size: .8125rem; }
  .footer-contact-item { font-size: .8125rem; }

  /* FAQ */
  .faq-question { font-size: .8125rem; padding: .875rem 1rem; }
  .faq-answer-inner { font-size: .875rem; }

  /* CTA */
  .cta-banner { padding: 2rem 0; }
  .cta-banner h2 { font-size: 1.25rem; }

  /* Steps */
  .how-to-use { padding: 2.5rem 0; }
  .step-number { width: 40px; height: 40px; font-size: 1rem; }

  /* Testimonials */
  .testimonials-section { padding: 2.5rem 0; }
  .testimonial-card { padding: 1.25rem; }
  .testimonial-card::before { font-size: 3rem; }

  /* Announcement bar — hide on very small */
  .announcement-bar { display: none; }
}

/* ── Very Small: ≤ 360px ───────────────────────────────────── */
@media (max-width: 360px) {
  .container { padding: 0 .75rem; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.1875rem; }
  .hero-stat-num { font-size: 1.125rem; }
  .hero-stat-label { font-size: .625rem; }
  .btn-primary, .btn-secondary, .btn-outline { padding: .625rem 1rem; font-size: .875rem; }
  .product-thumb { width: 48px; height: 48px; }
  .auth-card { padding: 1.25rem .75rem; }
  .checkout-form-wrap { padding: .875rem .75rem; }
}

/* ── Landscape phone fix ────────────────────────────────────── */
@media (max-width: 768px) and (orientation: landscape) {
  .hero-section { padding: 1.5rem 0; }
  .hero-image-wrap img { max-height: 180px; }
  .auth-page { align-items: flex-start; padding-top: 1rem; }
}

/* ── Print styles ───────────────────────────────────────────── */
@media print {
  .site-header, .announcement-bar, .mobile-nav-overlay,
  .cta-banner, .site-footer, .hero-actions, .product-actions { display: none !important; }
  body { font-size: 12pt; color: #000; }
  .container { max-width: 100%; padding: 0; }
}

/* ── Preview section responsive ────────────────────────────── */
@media (max-width: 1024px) {
  .preview-inner { grid-template-columns: 1fr; gap: 2rem; }
}
@media (max-width: 768px) {
  .preview-imgs-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .preview-inner { gap: 1.5rem; }
}
@media (max-width: 480px) {
  .preview-imgs-grid { gap: .5rem; }
  .preview-content ul li { font-size: .875rem; }
}

/* ── Order success responsive ───────────────────────────────── */
@media (max-width: 600px) {
  .order-success-grid { grid-template-columns: 1fr; gap: 1rem; }
}

/* ── Trust badges responsive ────────────────────────────────── */
@media (max-width: 480px) {
  .trust-badges { gap: .375rem; }
  .trust-badges span { font-size: .6875rem; padding: .25rem .5rem; }
}

/* ── Admin responsive additions ─────────────────────────────── */
@media (max-width: 768px) {
  .admin-form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Mobile Header Button Fixes
   ============================================================ */

/* On mobile: hide login text, keep only icon + order btn compact */
@media (max-width: 768px) {
  .header-actions { gap: .5rem; align-items: center; }
  .header-login-btn { display: none; }
  .header-account-btn { display: flex; }
  /* Keep Order Now button visible — overrides any display:none */
  .header-actions .btn-primary-sm,
  .header-actions .header-order-btn { display: inline-flex !important; }
  .theme-toggle-btn { width: 34px; height: 34px; font-size: .875rem; }
}

@media (max-width: 480px) {
  .header-actions { gap: .375rem; }
  .theme-toggle-btn { width: 32px; height: 32px; font-size: .8125rem; }
  .hamburger { width: 28px; }
}

/* ============================================================
   Footer Mobile Improvements
   ============================================================ */

/* Desktop: show social in contact column, hide in brand */
.footer-social-mobile { display: none; }
.footer-social-desktop { display: flex; }

/* Footer links columns — 2-col grid on mobile */
@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem 2rem;
  }
  .footer-brand {
    grid-column: 1 / -1;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  /* Show social under brand on mobile, hide in contact */
  .footer-social-mobile { display: flex; gap: .625rem; flex-wrap: wrap; }
  .footer-social-desktop { display: none; }

  .social-link {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,.7);
    font-size: .9375rem;
    transition: all .25s ease;
    text-decoration: none;
  }
  .social-link:hover { background: #1a6b3c; color: #fff; }

  .footer-links h4, .footer-contact h4 {
    font-size: .875rem;
    margin-bottom: .75rem;
    color: #fff;
  }
  .footer-links ul li { margin-bottom: .375rem; }
  .footer-links ul li a { font-size: .8125rem; }
  .footer-contact ul li { font-size: .8125rem; margin-bottom: .5rem; }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: .375rem;
    padding: 1rem 0;
  }
  .footer-bottom p { font-size: .75rem; }
  .disclaimer { font-size: .6875rem !important; color: rgba(255,255,255,.4) !important; }
  .trust-badges { gap: .375rem; margin-top: .875rem; }
  .trust-badges span { font-size: .6875rem; padding: .25rem .5rem; }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem 1.5rem;
  }
  .footer-brand { grid-column: 1 / -1; }
  .site-footer { padding: 2rem 0 0; }
}

@media (max-width: 360px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-links, .footer-contact { grid-column: auto; }
}

/* ============================================================
   Dark theme footer social fix
   ============================================================ */
[data-theme="dark"] .social-link {
  background: rgba(255,255,255,.06);
  color: rgba(230,237,243,.65);
}
[data-theme="dark"] .social-link:hover {
  background: #3fb950;
  color: #0d1117;
}
[data-theme="dark"] .footer-brand {
  border-bottom-color: rgba(48,54,61,.8);
}

/* ── Product detail grid: desktop-only images hidden on mobile ── */
.detail-mobile-only  { display: none !important; } /* completely removed */
.detail-desktop-only { display: block; }           /* visible on desktop */
@media (max-width: 768px) {
  .detail-desktop-only { display: none !important; } /* hidden on mobile */
}

/* ============================================================
   ISSUE 1 FIX — Account page: hide desktop sidebar on mobile,
   show mobile tab bar, fix orders table
   ============================================================ */

/* Account mobile tab bar — hidden by default, shown on mobile */
.account-mobile-tabs {
  display: none;
  gap: 0;
  background: var(--white, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.account-mobile-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  padding: .75rem .5rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  text-decoration: none;
  border-right: 1px solid var(--border, #e2e8f0);
  transition: background .2s, color .2s;
}
.account-mobile-tab:last-child { border-right: none; }
.account-mobile-tab i { font-size: 1rem; }
.account-mobile-tab.active,
.account-mobile-tab:hover { background: var(--primary-light, #e8f5ee); color: var(--primary, #1a6b3c); }
.account-mobile-logout { color: #ef4444 !important; }
.account-mobile-logout:hover { background: #fee2e2 !important; color: #dc2626 !important; }

@media (max-width: 1024px) {
  /* Hide desktop sidebar, show mobile tab bar */
  .account-sidebar-desktop { display: none !important; }
  .account-inner { grid-template-columns: 1fr !important; }
  .account-mobile-tabs { display: flex !important; }
}

/* Orders table responsive wrapper */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 6px;
}

@media (max-width: 600px) {
  /* Hide Pack (col 3) and Date (col 6) on small screens */
  .orders-table th:nth-child(3),
  .orders-table td:nth-child(3),
  .orders-table th:nth-child(6),
  .orders-table td:nth-child(6) { display: none; }
  .orders-table { font-size: .8125rem; min-width: 320px; }
  .orders-table th,
  .orders-table td { padding: .5rem .625rem; }
}

/* ── Very small screens: account mobile tabs 2×2 ── */
@media (max-width: 360px) {
  .account-mobile-tabs { flex-wrap: wrap; }
  .account-mobile-tab {
    flex: 0 0 50%;
    border-right: none;
    border-bottom: 1px solid var(--border, #e2e8f0);
  }
  .account-mobile-tab:nth-child(odd) { border-right: 1px solid var(--border, #e2e8f0); }
  .account-mobile-tab:nth-last-child(-n+2) { border-bottom: none; }
}

/* ============================================================
   ISSUE 2 FIX — Full site responsive audit additions
   ============================================================ */

/* ── Header: very small screens ── */
@media (max-width: 480px) {
  .header-actions { gap: .25rem; }
  .logo-brand {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ── Hero: 360px stats + badge ── */
@media (max-width: 360px) {
  .hero-stat-num { font-size: .9rem; }
  .hero-badge {
    white-space: normal;
    text-align: center;
    line-height: 1.4;
  }
}

/* ── Product page: full-width form elements on mobile ── */
@media (max-width: 480px) {
  .product-info .form-control,
  .product-info select,
  .product-info input { width: 100%; }
  .quantity-selector { flex-wrap: wrap; gap: .5rem; }
  /* Product benefits / stats grid: 2-col on ≤360px */
}
@media (max-width: 360px) {
  .product-benefits-stats { grid-template-columns: 1fr 1fr !important; }
}

/* ── Checkout: order summary no sticky on mobile ── */
@media (max-width: 1024px) {
  .order-summary { position: static !important; }
}

/* ── Auth pages: full width card on mobile ── */
@media (max-width: 480px) {
  .auth-card { max-width: 100%; }
  .auth-page .form-row { grid-template-columns: 1fr; gap: 0; }
}

/* ── Order success: full-width action buttons on mobile ── */
@media (max-width: 600px) {
  .success-actions { flex-direction: column; align-items: stretch; gap: .75rem; }
  .success-actions .btn-primary,
  .success-actions .btn-outline { width: 100%; justify-content: center; }
}

/* ── Footer: ensure social links centered on mobile ── */
@media (max-width: 480px) {
  .footer-social-mobile { justify-content: center; }
}

/* ── Admin: table horizontal scroll, card body padding, compact header ── */
@media (max-width: 768px) {
  .admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-card-body { padding: 1rem; }
  .admin-header { padding: 0 .875rem; }
  .admin-page-title { font-size: .9375rem; }
  .admin-breadcrumb { display: none; }
}
@media (max-width: 480px) {
  .admin-content { padding: .75rem; }
  .admin-card-body { padding: .75rem; }
  .admin-header { padding: 0 .75rem; }
  .stat-card { padding: 1rem 1.125rem; }
  .stat-card-value { font-size: 1.375rem; }
}
