/* =========================================================
   mobile.css — Responsive cho Admin Panel
   Tối ưu cho điện thoại và tablet
   ========================================================= */

/* ── Bottom Navigation (thay Sidebar trên mobile) ───────── */
@media (max-width: 768px) {

  /* Ẩn sidebar desktop */
  .sidebar {
    display: none !important;
  }

  /* Main chiếm toàn màn hình */
  .main {
    margin-left: 0 !important;
    width: 100% !important;
    padding-bottom: 70px; /* chỗ cho bottom nav */
  }

  /* Topbar mobile */
  .main-topbar {
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .main-topbar-title {
    font-size: 16px !important;
  }

  .main-topbar-sub {
    font-size: 11px !important;
  }

  /* ── Bottom Navigation ─────────────────────────────────── */
  .bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 200;
    align-items: stretch;
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-dim);
    font-size: 10px;
    font-family: var(--sans);
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: color .2s;
  }

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

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

  .bottom-nav-item .nav-badge {
    position: absolute;
    top: 6px;
    margin-left: 14px;
    min-width: 16px;
    height: 16px;
    font-size: 9px;
    padding: 0 4px;
  }

  /* ── Stats cards ─────────────────────────────────────────  */
  .stats-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .stat-card {
    padding: 12px !important;
  }

  .stat-card-value {
    font-size: 24px !important;
  }

  /* Quick links grid */
  [style*="grid-template-columns:repeat(auto-fill,minmax(200px"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* ── Panel header ─────────────────────────────────────── */
  .panel-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px !important;
  }

  .panel-header-title {
    font-size: 14px !important;
    width: 100%;
  }

  .search-box {
    flex: 1;
    min-width: 0;
  }

  .search-box input {
    font-size: 14px;
  }

  .btn-add {
    padding: 8px 12px !important;
    font-size: 12px !important;
    white-space: nowrap;
  }

  /* ── Tables ──────────────────────────────────────────── */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 500px;
  }

  th, td {
    padding: 10px 8px !important;
    font-size: 12px !important;
  }

  /* Ẩn cột ít quan trọng trên mobile */
  th:nth-child(4), td:nth-child(4),  /* Ngày tạo */
  th:nth-child(5), td:nth-child(5) { /* Đăng nhập cuối */
    display: none;
  }

  /* ── Modals ──────────────────────────────────────────── */
  .modal {
    width: calc(100vw - 24px) !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    overflow-y: auto;
    margin: 0 !important;
  }

  .modal-backdrop {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .modal {
    border-radius: 16px 16px 0 0 !important;
    width: 100% !important;
  }

  .modal-body {
    padding: 16px !important;
  }

  .modal-footer {
    padding: 12px 16px !important;
  }

  .modal-row {
    flex-direction: column !important;
  }

  /* ── Buttons lớn hơn cho touch ───────────────────────── */
  .btn-modal-primary,
  .btn-modal-cancel,
  .btn-modal-danger {
    min-height: 44px !important;
    font-size: 14px !important;
  }

  .btn-page {
    min-height: 36px !important;
    padding: 0 12px !important;
  }

  /* ── Panel body padding ──────────────────────────────── */
  .panel-body {
    padding: 12px !important;
  }

  /* ── Login card ──────────────────────────────────────── */
  .login-card {
    width: calc(100vw - 32px) !important;
    padding: 24px 20px !important;
  }

  /* ── Toast ───────────────────────────────────────────── */
  #toast-container {
    bottom: 70px !important; /* Trên bottom nav */
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
  }
}

/* Tablet */
@media (min-width: 769px) {
  .bottom-nav {
    display: none !important;
  }
}

/* ── Tablet landscape ────────────────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar {
    width: 200px !important;
  }

  .main {
    margin-left: 200px !important;
  }

  .stats-row {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}
