/* ============================================
   Wub — Estilos Responsive
   Paleta: Dark + Púrpura (Archivist / ListView)
   ============================================ */

/* ========== TABLET (max 1024px) ========== */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 200px;
  }

  #page-content {
    padding: 1.25rem 1.5rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .accounts-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

/* ========== MOBILE (max 768px) ========== */
@media (max-width: 768px) {

  /* Ocultar sidebar y top-bar desktop → mostrar mobile header + bottom nav */
  #sidebar       { display: none; }
  #top-bar       { display: none; }
  #mobile-header { display: flex; }
  #bottom-nav    { display: flex; }

  #main-content {
    margin-left: 0;
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    padding-top: 52px;
    min-height: 100vh;
    overflow-x: hidden;
  }

  #page-content {
    padding: 1rem;
  }

  /* ── Stats grid ── */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.625rem;
  }

  /* ── Cards ── */
  .card {
    padding: 0.875rem;
    border-radius: var(--radius-md);
  }

  .card-header  { margin-bottom: 0.5rem; }
  .card-title   { font-size: 0.7rem; }
  .card-value   { font-size: 1.125rem; }

  .card-icon {
    width: 36px;
    height: 36px;
  }

  .card-icon .material-symbols-rounded { font-size: 18px; }

  /* ── Account cards ── */
  .accounts-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .account-card {
    min-height: 110px;
    padding: 1.125rem;
    border-radius: var(--radius-lg);
  }

  .account-card .account-balance { font-size: 1.375rem; }

  /* ── Lists ── */
  .list-item {
    padding: 0.75rem;
    gap: 0.75rem;
    border-radius: var(--radius-md);
  }

  .list-item-icon    { width: 36px; height: 36px; }
  .list-item-title   { font-size: 0.875rem; }
  .list-item-subtitle{ font-size: 0.72rem; }
  .list-item-amount  { font-size: 0.875rem; }

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

  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; justify-content: center; }

  .form-input,
  .form-select {
    padding: 0.5625rem 0.75rem;
    font-size: 0.875rem;
  }

  /* ── Profile ── */
  .profile-header {
    flex-direction: row;
    text-align: left;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 1.5rem;
  }

  .profile-avatar { width: 54px; height: 54px; flex-shrink: 0; }
  .profile-name   { font-size: 1.1rem; }
  .profile-email  { font-size: 0.8rem; }

  /* ── Modal → slide up desde abajo ── */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
    z-index: 2000;
  }

  .modal-container {
    max-width: 100%;
    width: 100%;
    max-height: 88vh;
    height: auto;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    animation: slideUp 0.28s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .modal-container .modal-body {
    overflow-y: auto;
    flex: 1;
    max-height: calc(88vh - 60px);
    padding: 1rem 1.25rem calc(1rem + env(safe-area-inset-bottom, 0px));
  }

  @keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  .modal-header {
    padding: 1rem 1.25rem;
    flex-shrink: 0;
  }

  /* ── Bottom nav ── */
  #bottom-nav {
    display: flex !important;
    justify-content: space-around;
    padding: 0.375rem 0.125rem;
    padding-bottom: calc(0.375rem + env(safe-area-inset-bottom, 0px));
    height: auto;
    min-height: 60px;
  }

  .bottom-nav-item {
    font-size: 0.6rem;
    padding: 0.25rem;
    min-width: 0;
    flex: 1;
  }

  .bottom-nav-item .material-symbols-rounded { font-size: 20px; }

  .bottom-nav-fab {
    width: 46px;
    height: 46px;
    margin-top: -18px;
    flex-shrink: 0;
  }

  .bottom-nav-fab .material-symbols-rounded { font-size: 22px; }

  /* ── Accounts mini grid ── */
  .accounts-mini-grid { gap: 0.4375rem; padding: 0.25rem 0 0.625rem; }
  .account-mini-card  { min-width: 68px; padding: 0.5rem; }
  .account-mini-card .material-symbols-rounded { font-size: 18px; }
  .account-mini-name  { font-size: 0.6625rem; max-width: 58px; }
  .account-mini-type  { font-size: 0.5875rem; }

  /* ── Active filters ── */
  .active-filters     { gap: 0.3125rem; margin-bottom: 0.625rem; }
  .active-filter-tag  { padding: 0.225rem 0.5rem; font-size: 0.6625rem; }

  /* ── Filter bar → scroll horizontal ── */
  .filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
    gap: 0.3125rem;
    scrollbar-width: none;
    align-items: center;
  }

  .filter-bar::-webkit-scrollbar { display: none; }

  .filter-bar > div[style*="margin-left:auto"] {
    margin-left: auto;
    display: flex;
    gap: 0.3125rem;
    flex-shrink: 0;
  }

  .filter-chip {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.375rem 0.625rem;
    font-size: 0.72rem;
  }

  .filter-chip .material-symbols-rounded { font-size: 0.875rem; }

  /* ── Section headers ── */
  .section-header   { flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
  .section-title    { font-size: 0.9rem; }

  /* ── Progress bar ── */
  .progress-bar { height: 3px; }

  /* ── Toast ── */
  .toast-container {
    left: 0.75rem;
    right: 0.75rem;
    top: 4rem;
    z-index: 3000;
  }

  .toast {
    min-width: auto;
    font-size: 0.8125rem;
  }

  /* ── Empty states ── */
  .empty-state { padding: 2rem 1rem; }
  .empty-state .material-symbols-rounded { font-size: 38px; }
  .empty-state p { font-size: 0.875rem; }

  /* ── Badges ── */
  .badge { font-size: 0.6625rem; padding: 0.175rem 0.5rem; }

  /* ── Buttons ── */
  .btn-sm  { padding: 0.375rem 0.625rem; font-size: 0.75rem; }
  .btn-icon{ width: 30px; height: 30px; }
}

/* ========== SMALL MOBILE (max 420px) ========== */
@media (max-width: 420px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .login-card { padding: 2rem 1.375rem; }

  .card-value { font-size: 1rem; }
  .card-icon  { width: 32px; height: 32px; }
  .card-icon .material-symbols-rounded { font-size: 16px; }

  .account-card .account-balance { font-size: 1.25rem; }

  .bottom-nav-fab {
    width: 44px;
    height: 44px;
    margin-top: -20px;
  }

  .bottom-nav-fab .material-symbols-rounded { font-size: 22px; }

  .bottom-nav-item { font-size: 0.5875rem; }
  .bottom-nav-item .material-symbols-rounded { font-size: 20px; }
}

/* ========== LARGE DESKTOP (min 1440px) ========== */
@media (min-width: 1440px) {
  #page-content {
    padding: 2rem 3rem;
    max-width: 1200px;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
