/* =========================================================
   CATATKU — RESPONSIVE.CSS
   Mobile-first adjustments.
   Breakpoint: mobile < 768px, tablet 768–1024px, desktop > 1024px
   ========================================================= */

/* ---------------------------------------------------------
   TABLET & MOBILE (< 1024px): sidebar berubah jadi drawer
   --------------------------------------------------------- */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 21, 32, 0.45);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
  }

  .sidebar-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  #menuToggleBtn {
    display: flex;
  }
}

/* ---------------------------------------------------------
   MOBILE (< 768px)
   --------------------------------------------------------- */
@media (max-width: 767px) {
  .app-header {
    padding: 0 16px;
  }

  .page-title {
    font-size: 17px;
  }

  .header-right {
    gap: 8px;
  }

  .user-name {
    display: none;
  }

  .user-chip {
    padding: 6px;
  }

  .month-picker span,
  .month-picker select {
    font-size: 13px;
  }

  .app-content {
    padding: 16px;
    padding-bottom: calc(var(--bottom-nav-height) + 20px);
  }

  .welcome-card {
    padding: 22px;
  }

  /* Bottom navigation menggantikan sebagian fungsi sidebar di mobile */
  .bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    z-index: 500;
    padding: 4px 8px;
  }

  .bottom-nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
  }

  .bottom-nav-item svg {
    width: 20px;
    height: 20px;
  }

  .bottom-nav-item.is-active {
    color: var(--color-primary);
  }

  .bottom-nav-fab {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-primary-gradient);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -22px;
    box-shadow: var(--shadow-md);
  }

  .bottom-nav-fab svg {
    width: 22px;
    height: 22px;
  }
}

/* ---------------------------------------------------------
   TABLET (768px – 1024px)
   --------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 1024px) {
  .app-content {
    padding: 20px;
  }

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

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

/* ---------------------------------------------------------
   DASHBOARD grid — mobile: satu/dua kolom sesuai spesifikasi
   --------------------------------------------------------- */
@media (max-width: 767px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
    gap: 10px;
  }

  .stat-value {
    font-size: 15.5px;
  }

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

  .chart-wrap-line {
    height: 220px;
  }

  /* ---------- Toolbar & tabel transaksi -> card list ---------- */
  .page-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: none;
  }

  .filter-select {
    width: 100%;
  }

  .table-card {
    padding: 8px 14px 16px;
  }

  .trx-table-header {
    display: none;
  }

  .trx-row {
    min-width: 0;
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 14px 4px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
  }

  .trx-row:last-child {
    margin-bottom: 0;
  }

  .trx-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .trx-cell-amount {
    text-align: left;
  }

  .trx-cell-actions {
    justify-content: flex-start;
    padding-top: 6px;
    border-top: 1px dashed var(--border-color);
    margin-top: 4px;
  }

  .cell-label {
    display: inline-block;
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 600;
  }

  .pagination-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .pagination-controls {
    justify-content: space-between;
  }

  .pagination-controls .btn {
    flex: 1;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .icon-picker,
  .color-picker {
    grid-template-columns: repeat(5, 1fr);
  }

  .segmented-control-tabs {
    max-width: none;
    width: 100%;
  }
}

/* ---------------------------------------------------------
   DESKTOP (> 1024px): pastikan drawer styling tidak aktif
   --------------------------------------------------------- */
@media (min-width: 1025px) {
  .bottom-nav {
    display: none !important;
  }
}
