/* ═══════════════════════════════════════════════════════════
   TABLET.CSS — iPad & Tablet Responsive Layout (≥768px)
   ═══════════════════════════════════════════════════════════ */

/* ─── Tablet Breakpoint ──────────────────────────────────── */
@media (min-width: 768px) {

  /* ── Override CSS variables for larger screens ──────── */
  :root {
    --nav-height: 64px;
    --sidebar-width: 220px;
  }

  /* ── Reset body & html for full-screen tablet layout ── */
  body {
    overflow: auto;
  }

  /* ── App Shell: full-screen with sidebar ────────────── */
  #app {
    max-width: 100%;
    height: 100svh;
    height: 100dvh;
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-areas:
      "sidebar top-stripe"
      "sidebar screens";
    padding-bottom: 0;
    overflow: hidden;
  }

  /* ── Top Stripe spans only the content area ──────────── */
  #top-stripe {
    grid-area: top-stripe;
    height: 3px;
  }

  /* ── Screen Container ─────────────────────────────────── */
  #screens {
    grid-area: screens;
    overflow: hidden;
    position: relative;
  }

  /* ── Sidebar Navigation (replaces bottom nav) ─────────── */
  #bottom-nav {
    grid-area: sidebar;
    position: static !important;
    width: var(--sidebar-width);
    height: 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding-bottom: 0;
    border-top: none;
    border-right: 1px solid var(--border);
    background: rgba(13, 13, 13, 0.97) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding-top: 24px;
    gap: 4px;
    overflow-y: auto;
  }

  /* Sidebar brand logo area */
  #bottom-nav::before {
    content: 'TrueCost';
    display: block;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
    color: var(--orange);
    padding: 0 20px 24px;
    letter-spacing: -0.5px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
    flex-shrink: 0;
  }

  /* ── Sidebar Nav Tabs ─────────────────────────────────── */
  .nav-tab {
    flex: 0;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 20px;
    border-radius: 10px;
    margin: 0 8px;
    text-align: left;
    transition: all var(--transition-fast);
    position: relative;
  }

  .nav-tab .tab-icon {
    font-size: 20px;
    width: 28px;
    flex-shrink: 0;
    text-align: center;
  }

  .nav-tab .tab-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
    text-transform: none;
    color: var(--text-muted);
    transition: color var(--transition-fast);
  }

  .nav-tab.active {
    background: var(--orange-glow);
    border: 1px solid rgba(255, 107, 0, 0.25);
  }

  .nav-tab.active .tab-label {
    color: var(--orange);
  }

  /* Remove bottom dot indicator — not needed for sidebar */
  .nav-tab.active::after {
    display: none;
  }

  /* Active left bar indicator */
  .nav-tab.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    border-radius: 0 2px 2px 0;
    background: var(--orange);
  }

  /* ── FAB repositioned for tablet ──────────────────────── */
  .fab {
    bottom: 32px !important;
    right: 32px !important;
  }

  /* ── Screen Header ────────────────────────────────────── */
  .screen-header {
    padding: 24px 32px 16px;
  }

  .screen-header h1 {
    font-size: 28px;
  }

  /* ── Screen Content: wider padding ────────────────────── */
  .screen-content {
    padding: 24px 32px;
    padding-bottom: 100px;
  }

  /* ── 2-Column Grid Layouts for content cards ──────────── */
  #product-list,
  #halfproduct-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
  }

  /* Products & half-products: each card fills its grid cell */
  #product-list .card,
  #halfproduct-list .card {
    margin-bottom: 0;
  }

  /* ── Dish List: 2-column grid ─────────────────────────── */
  #dish-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
  }

  #dish-list .dish-card {
    margin-bottom: 0;
  }

  /* ── Dashboard: 4-column summary cards ───────────────── */
  .dashboard-cards {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }

  .dc-value {
    font-size: 20px;
  }

  /* ── Dashboard 2-col layout: chart + simulator side by side */
  #screen-dashboard .screen-content {
    display: flex;
    flex-direction: column;
  }

  .chart-wrap {
    margin-bottom: 20px;
  }

  /* ── Overhead: 2-col tab content ─────────────────────── */
  #staff-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
  }

  .staff-card {
    margin-bottom: 0;
  }

  #packaging-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
  }

  .packaging-card {
    margin-bottom: 0;
  }

  /* ── Dish Detail: wider tabs ──────────────────────────── */
  .dish-detail-header {
    padding: 24px 32px;
  }

  .tab-bar {
    padding: 0 16px;
  }

  .tab-pill {
    padding: 14px 20px;
    font-size: 14px;
  }

  /* ── Modals: centered dialog instead of bottom sheet ──── */
  .modal-overlay {
    align-items: center;
    justify-content: center;
  }

  .modal-sheet {
    border-radius: var(--radius-xl);
    max-width: 560px;
    max-height: 85vh;
    border: 1px solid var(--border);
    animation: modalFadeScale var(--transition-med);
  }

  @keyframes modalFadeScale {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
  }

  .modal-handle {
    display: none;
  }

  .modal-footer {
    padding-bottom: var(--space-lg);
  }

  /* ── Settings: 2-column grid using .settings-block wrappers ── */
  #settings-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
  }

  /* Prevent section-titles and sections from ever being direct grid children */
  #settings-content .settings-section-title,
  #settings-content .settings-section {
    /* These live inside .settings-block, not direct children */
  }

  /* Global Defaults block spans full width (it has more fields) */
  #settings-content .settings-block:first-child {
    grid-column: 1 / -1;
  }

  /* ── Toast: top-right position on tablet ─────────────── */
  #toast-container {
    bottom: auto !important;
    top: 20px;
    right: 24px;
    left: auto;
    transform: none;
    width: 320px;
    max-width: 320px;
  }

  /* ── Tab content: larger padding ─────────────────────── */
  .tab-content {
    padding: 24px 32px;
    padding-bottom: 32px;
  }

  /* ── Energy Tier Row ──────────────────────────────────── */
  .energy-tier-row {
    max-width: 400px;
  }

  /* ── Form rows: 3-col on wider screens ───────────────── */
  .form-row {
    gap: 16px;
  }

  /* ── Section labels: slightly larger ─────────────────── */
  .section-label {
    font-size: 12px;
  }
}

/* ─── Large Tablet / Desktop (≥1024px) ──────────────────── */
@media (min-width: 1024px) {

  :root {
    --sidebar-width: 240px;
  }

  /* 3-column grids on large tablets */
  #product-list,
  #halfproduct-list {
    grid-template-columns: repeat(3, 1fr);
  }

  #dish-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal-sheet {
    max-width: 620px;
  }

  .screen-content {
    max-width: 1100px;
  }

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