/* ─────────────────────────────────────────────────────
   KELDIVO — RESPONSIVE CSS
   Breakpoints: sm=640, md=768, lg=1024, xl=1280
───────────────────────────────────────────────────── */

/* ── Mobile-first: sidebar off-canvas ─────────────── */
@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,0.5);
  }
  .main-content {
    margin-left: 0 !important;
  }
  .hamburger {
    display: flex !important;
  }
  .topbar-search {
    display: none;
  }

  /* Hero: two columns -> stacked, re-centered */
  .hero-content {
    flex-direction: column;
    text-align: center;
  }
  .hero-text-col {
    text-align: center;
  }
  .hero-subtitle {
    margin-left: auto;
    margin-right: auto;
  }
  .hero-actions {
    justify-content: center;
  }
  .kv-hero-trust {
    justify-content: center !important;
  }
}

/* ── Tablet (768–1023px) ─────────────────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
  .page-content {
    padding: 1.5rem;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .charts-row {
    grid-template-columns: 1fr !important;
  }
  .bottom-grid {
    grid-template-columns: 1fr !important;
  }
  .deal-detail-grid {
    grid-template-columns: 1fr !important;
  }
  .two-col-form {
    grid-template-columns: 1fr !important;
  }
  .wallet-stats {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .deals-stats {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .reviews-stats {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ── Mobile (< 768px) ───────────────────────────── */
@media (max-width: 767px) {
  .page-content {
    padding: 1rem;
  }

  /* Stats: 2 columns on mobile */
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.75rem !important;
  }
  .stat-value {
    font-size: 1.5rem;
  }

  /* Charts: single column */
  .charts-row {
    grid-template-columns: 1fr !important;
  }

  /* Bottom grid: single column */
  .bottom-grid {
    grid-template-columns: 1fr !important;
  }

  /* Deal detail: single column */
  .deal-detail-grid {
    grid-template-columns: 1fr !important;
  }

  /* Wizard two-col: single */
  .two-col-form {
    grid-template-columns: 1fr !important;
  }

  /* Topbar */
  .topbar {
    padding: 0 1rem;
    gap: 0.75rem;
  }
  .topbar-search {
    display: none;
  }

  /* Hero layout */
  .hero-title {
    font-size: 2.5rem;
  }
  .hero-subtitle {
    font-size: 1rem;
  }
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
  .hero-shield-wrap {
    height: 260px;
  }
  .hero-bubble {
    font-size: 0.75rem;
    padding: 0.375rem 0.625rem;
  }

  /* Landing nav: collapse middle links */
  .landing-nav-links {
    display: none;
  }
  .landing-nav {
    padding: 0.875rem 1.25rem;
  }

  /* Features grid: 1 column */
  .features-grid {
    grid-template-columns: 1fr !important;
  }

  /* Steps grid: 1 column */
  .steps-grid {
    grid-template-columns: 1fr !important;
  }

  /* Stats display: 2 col */
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Auth: full width */
  .auth-form-side {
    padding: 1.5rem 1rem;
  }
  .auth-form-inner {
    max-width: 100%;
  }

  /* Wallet hero: stack */
  .wallet-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }

  /* Escrow hero: wrap */
  .escrow-hero-card {
    gap: 1.25rem;
  }
  .escrow-hero-stats {
    gap: 1rem;
    width: 100%;
    justify-content: space-around;
  }

  /* Messages: show only list pane or chat */
  .msgs-sidebar {
    width: 100%;
    flex-shrink: 0;
  }
  .msgs-chat {
    display: none;
  }

  /* Settings: tabs become scrollable row */
  .settings-grid {
    grid-template-columns: 1fr !important;
  }
  #settings-nav {
    flex-direction: row !important;
    overflow-x: auto;
    gap: 0.375rem;
    padding-bottom: 0.25rem;
  }
  .settings-tab {
    white-space: nowrap;
    width: auto;
  }

  /* Dispute steps: 2×2 */
  .dispute-steps {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Modal: full width on small screens */
  .modal-box {
    max-width: 100% !important;
    border-radius: 1rem 1rem 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  /* Wizard steps: compact */
  .wizard-steps {
    gap: 0;
  }
  .step-label {
    display: none;
  }

  /* Escrow stats row */
  .escrow-stats-row {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Payments stats */
  .payments-stats {
    grid-template-columns: 1fr !important;
  }

  /* Wallet stats */
  .wallet-stats {
    grid-template-columns: 1fr !important;
  }
  .deals-stats {
    grid-template-columns: 1fr 1fr !important;
  }
  .wallet-bottom-grid {
    grid-template-columns: 1fr !important;
  }

  /* Reviews top */
  .reviews-top {
    grid-template-columns: 1fr !important;
  }
  .reviews-stats {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Table: allow horizontal scroll */
  .table-wrap {
    margin: 0 -1.375rem;
  }
  .table-wrap table {
    min-width: 560px;
  }

  /* Onboarding grid: single col */
  .onboarding-grid {
    grid-template-columns: 1fr !important;
  }

  /* Account type grid: single col on very small */
  @media (max-width: 380px) {
    .account-type-grid {
      grid-template-columns: 1fr;
    }
  }

  /* Toast: bottom-center */
  #toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }
  .toast {
    min-width: unset;
    max-width: 100%;
    width: 100%;
  }
}

/* ── Small mobile (< 480px) ─────────────────────── */
@media (max-width: 479px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
  .hero-title {
    font-size: 2rem;
  }
  .landing-nav-actions .btn-ghost {
    display: none;
  }
}
