/* ============================================================
   Agrobiz — Responsive Overrides
   Breakpoints: 360, 375, 390, 414, 768, 820, 1024, 1280, 1440
   ============================================================ */

/* ─── Small tablets / large phones (≤ 991px) ─────────────── */
@media (max-width: 991.98px) {
  .ag-hero { min-height: 420px; padding: 40px 0; }
  .ag-hero-title { font-size: 2rem; }
  .ag-search-wrap { margin-top: -30px; }
  .ag-section { padding: 40px 0; }
  .ag-nav-actions { margin-top: 14px; }
  .ag-nav-actions .btn { width: 100%; justify-content: center; }
  .ag-navbar .nav-link { padding: 10px 12px; border-radius: 6px; }
  .ag-navbar .navbar-nav { padding-top: 10px; }

  .ag-seller-panel,
  .ag-tips-panel,
  .ag-settings-nav {
    position: static !important;
    margin-bottom: 20px;
  }
  .ag-conv-wrap { max-height: none; }

  .ag-stat-tile { padding: 12px; }
  .ag-stat-body strong { font-size: 1.2rem; }

  .ag-profile-head { padding: 18px; gap: 16px; }
  .ag-profile-avatar { width: 72px; height: 72px; }
  .ag-profile-avatar-fallback { font-size: 28px; }
  .ag-profile-name { font-size: 1.25rem; }
}

/* ─── Phones (≤ 767.98px) ────────────────────────────────── */
@media (max-width: 767.98px) {
  .ag-header .ag-logo-text { display: none; }

  .ag-hero { min-height: 380px; }
  .ag-hero-title { font-size: 1.75rem; }
  .ag-hero-sub { font-size: 0.95rem; }
  .ag-hero-cta .btn { flex: 1; min-width: 0; }
  .ag-search-box { padding: 14px; }

  .ag-stats .col-6 { padding-left: 6px; padding-right: 6px; }
  .ag-stat { padding: 10px 12px; gap: 8px; }
  .ag-stat i { font-size: 1.3rem; }
  .ag-stat strong { font-size: 1.05rem; }

  .ag-section { padding: 32px 0; }
  .ag-section-title { font-size: 1.3rem; }

  .ag-dash-head { flex-direction: column; align-items: stretch; }
  .ag-dash-actions .btn { width: 100%; }

  .ag-ad-actions .btn { flex: 1; }

  .ag-gallery-main { aspect-ratio: 4/3; }
  .ag-thumb { flex-basis: 64px; height: 64px; }

  .ag-detail-title { font-size: 1.25rem; }
  .ag-detail-meta { font-size: 0.8rem; gap: 10px; }

  .ag-facts .col-6 { padding-left: 6px; padding-right: 6px; }

  .ag-panel { padding: 16px; }
  .ag-auth-card { padding: 24px 18px; }
  .ag-auth-title { font-size: 1.25rem; }

  .ag-conv-bubble { max-width: 88%; }
  .ag-conv-body { padding: 14px 12px; }
  .ag-conv-compose { padding: 10px 12px; }

  .ag-thread-delete { padding: 0 8px; }

  .ag-profile-head { flex-direction: column; align-items: stretch; text-align: left; }
  .ag-profile-actions { width: 100%; }
  .ag-profile-actions .btn { width: 100%; }

  .ag-settings-nav {
    flex-direction: row;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 6px;
  }
  .ag-settings-link { white-space: nowrap; padding: 9px 12px; font-size: 0.85rem; }

  .ag-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0; }
  .ag-tab { white-space: nowrap; flex-shrink: 0; }

  .ag-toolbar { padding: 10px 12px; font-size: 0.85rem; }
  .ag-toolbar form { width: 100%; }
  .ag-toolbar form .form-select { width: 100%; }

  .ag-footer-top { padding: 34px 0 20px; }
  .ag-footer-title { margin-top: 8px; }
}

/* ─── Small phones (≤ 575.98px) ──────────────────────────── */
@media (max-width: 575.98px) {
  .ag-hero { min-height: 340px; padding: 30px 0; }
  .ag-hero-badge { font-size: 0.72rem; padding: 5px 10px; }
  .ag-hero-title { font-size: 1.5rem; }
  .ag-hero-tagline { font-size: 1rem; }
  .ag-hero-cta { flex-direction: column; }
  .ag-hero-cta .btn { width: 100%; }

  .ag-section { padding: 26px 0; }
  .ag-section-title { font-size: 1.15rem; }

  .ag-page-title { font-size: 1.25rem; }

  .ag-ad-body { padding: 12px; }
  .ag-ad-title { font-size: 0.92rem; }
  .ag-ad-actions .btn { font-size: 0.76rem; padding: 5px 8px; }

  .ag-badge { font-size: 0.62rem; padding: 3px 8px; }
  .ag-fav-btn { width: 32px; height: 32px; font-size: 0.9rem; }

  .ag-cat-card { padding: 14px 10px; }
  .ag-cat-icon { width: 44px; height: 44px; font-size: 20px; margin-bottom: 8px; }
  .ag-cat-name { font-size: 0.85rem; }

  .ag-stat-tile { padding: 10px; gap: 8px; }
  .ag-stat-icon { width: 36px; height: 36px; font-size: 16px; }
  .ag-stat-body strong { font-size: 1.05rem; }
  .ag-stat-body span { font-size: 0.72rem; }

  .ag-quick-btn { padding: 10px; font-size: 0.82rem; }

  .ag-mini-item { padding: 8px 10px; gap: 10px; }
  .ag-mini-thumb { width: 40px; height: 40px; }
  .ag-mini-title { font-size: 0.85rem; }
  .ag-mini-price { font-size: 0.82rem; }

  .ag-auth-card { padding: 20px 14px; border-radius: 10px; }
  .ag-auth-title { font-size: 1.15rem; }
  .ag-form-section-title { font-size: 0.78rem; letter-spacing: 0.7px; }

  .ag-hiw-panel { padding: 18px; }
  .ag-benefit { padding: 16px; }
  .ag-benefit i { width: 40px; height: 40px; font-size: 18px; }

  .ag-cta-band { padding: 40px 0; }
  .ag-cta-band h2 { font-size: 1.25rem; }

  .ag-mob-ad-thumb { width: 72px; height: 72px; }
  .ag-mob-ad-title { font-size: 0.88rem; }

  .ag-conv-head { padding: 10px 12px; gap: 8px; }
  .ag-thread-avatar { width: 38px; height: 38px; font-size: 14px; }
  .ag-conv-ad { padding: 8px 12px; font-size: 0.78rem; }

  .ag-profile-head { padding: 14px; }
  .ag-profile-avatar { width: 60px; height: 60px; }
  .ag-profile-avatar-fallback { font-size: 22px; }
  .ag-profile-name { font-size: 1.1rem; }

  .ag-error-code { font-size: 4rem; }
  .ag-error-title { font-size: 1.15rem; }

  .ag-table-wrap { border-radius: 0; border-left: 0; border-right: 0; }
  .ag-table { font-size: 0.82rem; }
  .ag-table thead th { padding: 8px; font-size: 0.7rem; }
  .ag-table tbody td { padding: 8px; }
  .ag-table-thumb { width: 38px; height: 38px; }

  .ag-search-box .form-control,
  .ag-search-box .form-select,
  .ag-search-box .btn { height: 44px; font-size: 0.9rem; }
}

/* ─── Extra small phones (≤ 399px) ───────────────────────── */
@media (max-width: 399.98px) {
  .ag-hero-title { font-size: 1.35rem; }
  .ag-hero-tagline { font-size: 0.92rem; }

  .ag-brand { font-size: 1.15rem; }
  .ag-brand-mark { width: 32px; height: 32px; font-size: 18px; }

  .ag-stats .col-6 { padding-left: 4px; padding-right: 4px; }
  .ag-stat i { display: none; }
  .ag-stat { justify-content: center; text-align: center; }

  .ag-cat-name { font-size: 0.8rem; }
  .ag-cat-count { font-size: 0.7rem; }

  .ag-profile-stats strong { font-size: 1.3rem; }
}

/* ─── Tablets (768 – 991px) ──────────────────────────────── */
@media (min-width: 768px) and (max-width: 991.98px) {
  .ag-hero { min-height: 480px; }
  .ag-hero-title { font-size: 2.4rem; }
  .ag-seller-panel { position: static; margin-top: 20px; }
}

/* ─── Landscape phones ───────────────────────────────────── */
@media (max-width: 767.98px) and (orientation: landscape) {
  .ag-hero { min-height: 320px; }
}

/* ─── Large desktops (≥ 1280px) ──────────────────────────── */
@media (min-width: 1280px) {
  .container { max-width: 1200px; }
  .ag-hero-title { font-size: 3.4rem; }
}

@media (min-width: 1440px) {
  .container { max-width: 1320px; }
  .ag-hero { min-height: 560px; }
}

/* ─── Print ──────────────────────────────────────────────── */
@media print {
  .ag-header,
  .ag-footer,
  .ag-search-box,
  .ag-hero-cta,
  .ag-ad-actions,
  .ag-seller-panel,
  .ag-fav-btn { display: none !important; }

  body { background: #fff; color: #000; }
  a { color: #000; text-decoration: underline; }

  .ag-detail-title { font-size: 1.4rem; }
  .ag-gallery-main { border: 1px solid #ccc; }
  .ag-panel { border: 1px solid #ccc; box-shadow: none; }
}

/* ─── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─── Dark mode (optional, respects OS) ──────────────────── */
@media (prefers-color-scheme: dark) {
  /* Only subtle adjustments — Agrobiz stays light-first */
  .ag-footer { background: #0a1d15; }
}
