
/* responsive.css — mobile-first layout bootstrap (no dependencies)
   Drop this in /assets/css/responsive.css (or any path) and include it in your layout head.
   It adds:
   - Mobile-first stacking
   - Bottom tab bar on phones
   - Collapsible sidebar
   - Responsive tables that auto-label cells
*/

/* 1) Base reset & variables */
*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
:root {
  --container: 1120px;
  --gutter: 16px;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0,0,0,.06);
  --muted: #6b7280; /* gray-500 */
  --border: #e5e7eb; /* gray-200 */
  --bg: #f8fafc;     /* gray-50 */
  --fg: #0f172a;     /* slate-900 */
  --brand: #0ea5e9;  /* sky-500 */
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--fg);
  background: var(--bg);
  line-height: 1.45;
}

/* 2) Container + grid helpers */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

/* 3) Header & nav */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.header .row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}
.header .brand { font-weight: 700; }
.header .nav { display: none; gap: 12px; }
.header .nav a { text-decoration: none; color: inherit; padding: 8px 10px; border-radius: 10px; }
.header .nav a.active { background: #f1f5f9; }

/* 4) Sidebar (hidden on mobile by default) */
.sidebar {
  display: none;
  position: sticky;
  top: 64px;
}
.sidebar .menu { display: grid; gap: 6px; }
.sidebar a {
  color: inherit; text-decoration: none;
  padding: 10px 12px; border-radius: 10px; display: block;
}
.sidebar a:hover { background: #f8fafc; }

/* 5) Bottom mobile tabbar */
.mobile-tabbar {
  position: sticky;
  bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  background: #fff;
  border-top: 1px solid var(--border);
}
.mobile-tabbar a {
  text-decoration: none; color: inherit;
  padding: 10px 6px;
  text-align: center;
  font-size: 12px;
}
.mobile-tabbar a .icon { display: block; font-size: 18px; margin-bottom: 2px; }
.mobile-tabbar a.active { color: var(--brand); font-weight: 600; }

/* 6) Tables → auto stack on phones */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }

/* Mobile stacked table */
@media (max-width: 767.98px) {
  table.responsive { border: 0; }
  table.responsive thead { display: none; }
  table.responsive tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
  }
  table.responsive td {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 6px;
    border: 0;
    padding: 0;
  }
  table.responsive td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
  }
}

/* 7) Forms */
.input, select, textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; text-decoration: none; color: inherit; cursor: pointer;
}
.button.primary { background: var(--brand); color: #fff; border-color: var(--brand); }

/* 8) Desktop overrides */
@media (min-width: 768px) {
  .header .nav { display: flex; margin-left: auto; }
  .main-grid { grid-template-columns: 260px 1fr; }
  .sidebar { display: block; }
  .mobile-tabbar { display: none; }
  .content-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
  .content-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
}

/* 9) Utility helpers */
.hide-on-mobile { display: none; }
@media (min-width: 768px) { .hide-on-mobile { display: initial; } .show-on-mobile { display: none !important; } }
.show-on-mobile { display: initial; }

/* 10) Optional: shrink dense lists on mobile */
.list-dense li { padding: 8px 0; border-bottom: 1px solid var(--border); }
