/* ============================================================
   Kims Health Care HMS — layout.css
   App shell: sidebar, topbar, content, responsive behaviour
   ============================================================ */

.app { min-height: 100vh; }

/* ---------------- Sidebar ---------------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 60;
  transition: transform .22s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
}
.sidebar-brand img, .sidebar-brand svg { width: 34px; height: 34px; }
.brand-name { font-size: 15px; font-weight: 750; letter-spacing: -0.01em; line-height: 1.1; }
.brand-name em { font-style: normal; color: var(--red-600); }
.brand-sub { font-size: 10.5px; color: var(--gray-500); letter-spacing: .04em; text-transform: uppercase; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.nav-section { margin-top: 14px; padding: 0 8px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gray-400); }
.nav-section:first-child { margin-top: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 1px;
  border-radius: var(--r-sm);
  color: var(--gray-700); font-size: 13.5px; font-weight: 500;
  text-decoration: none;
}
.nav-item:hover { background: var(--gray-50); color: var(--gray-900); text-decoration: none; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--gray-400); }
.nav-item:hover svg { color: var(--gray-500); }
.nav-item.active { background: var(--red-50); color: var(--red-700); font-weight: 650; }
.nav-item.active svg { color: var(--red-600); }
.nav-item .nav-badge {
  margin-left: auto; font-size: 10.5px; font-weight: 700;
  background: var(--red-600); color: #fff;
  border-radius: var(--r-full); padding: 1px 7px; min-width: 18px; text-align: center;
}

.sidebar-foot { border-top: 1px solid var(--border); padding: 10px; }
.sidebar-user {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: var(--r-sm); text-align: left;
}
.sidebar-user:hover { background: var(--gray-50); }
.sidebar-user .t-ell { line-height: 1.25; }
.sidebar-user > svg { width: 16px; height: 16px; color: var(--gray-400); flex-shrink: 0; }
.gsearch-row > svg { width: 16px; height: 16px; color: var(--gray-300); flex-shrink: 0; }

/* Sidebar overlay (mobile) */
.scrim {
  position: fixed; inset: 0; background: rgba(23,27,32,.42);
  z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
body.nav-open .scrim { opacity: 1; pointer-events: auto; }

/* ---------------- Main column ---------------- */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

/* ---------------- Topbar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
}
.topbar-title { font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; }
.hamburger { display: none; }

/* Global search */
.gsearch { position: relative; width: 330px; }
.gsearch input {
  width: 100%; height: 38px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--gray-50); font-size: 13.5px;
}
.gsearch input:focus { background: var(--surface); border-color: var(--red-300); box-shadow: var(--focus-ring); outline: none; }
.gsearch > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--gray-400); pointer-events: none; }
.gsearch-pop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); max-height: 380px; overflow-y: auto; z-index: 70;
}
.gsearch-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; }
.gsearch-row:hover { background: var(--gray-50); }
.gsearch-row + .gsearch-row { border-top: 1px solid var(--gray-100); }

/* Topbar icon buttons */
.tb-btn {
  position: relative; width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-md); color: var(--gray-500);
  border: 1px solid transparent;
}
.tb-btn:hover { background: var(--gray-50); color: var(--gray-700); }
.tb-btn svg { width: 19px; height: 19px; }
.tb-dot {
  position: absolute; top: 8px; right: 9px; width: 8px; height: 8px;
  background: var(--red-600); border-radius: 50%; border: 2px solid var(--surface);
}

/* ---------------- Content ---------------- */
.content { flex: 1; padding: 22px 24px 48px; width: 100%; max-width: var(--content-max); margin: 0 auto; }

/* Page header */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; letter-spacing: -0.015em; }
.page-head .t-sub { margin-top: 2px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Breadcrumb */
.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--gray-500); margin-bottom: 6px; }
.crumbs a { color: var(--gray-500); }
.crumbs a:hover { color: var(--red-600); text-decoration: none; }
.crumbs .sep { color: var(--gray-300); }
.crumbs .cur { color: var(--gray-700); font-weight: 600; }

/* ---------------- Auth (login) layout ---------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 560px) 1fr; }
.auth-panel { background: var(--surface); display: flex; flex-direction: column; padding: 34px 48px; overflow-y: auto; }
.auth-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, var(--red-800), var(--red-600) 48%, #C93140);
  color: #fff; display: flex; flex-direction: column; justify-content: flex-end; padding: 56px;
}
.auth-hero::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(560px 380px at 85% 8%, rgba(255,255,255,.14), transparent 60%),
    radial-gradient(460px 420px at 8% 92%, rgba(0,0,0,.14), transparent 55%);
}
.auth-hero > * { position: relative; }
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-panel { padding: 28px 20px 40px; }
}

/* ---------------- Kiosk / queue board (fullscreen pages) ---------------- */
.board { min-height: 100vh; background: #14171B; color: #fff; display: flex; flex-direction: column; }

/* ---------------- Responsive shell ---------------- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-102%); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: translateX(0); }
  .main { margin-left: 0; }
  .hamburger { display: inline-flex; }
  .gsearch { width: min(46vw, 300px); }
}
@media (max-width: 768px) {
  .content { padding: 16px 14px 90px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-title { font-size: 15px; }
  .gsearch { width: 100%; max-width: none; flex: 1; }
  .page-head h1 { font-size: 19px; }
}

/* Bottom tab bar (patient portal, mobile) */
.tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 5px 2px; font-size: 10.5px; font-weight: 600; color: var(--gray-500);
  border-radius: var(--r-sm); text-decoration: none;
}
.tabbar a svg { width: 21px; height: 21px; }
.tabbar a.active { color: var(--red-600); }
@media (max-width: 768px) {
  .tabbar { display: flex; }
}
