/* ============================================================
   ZhuMobile Connect — App Shell & Components
   ============================================================ */

/* ── Reset & Base (mirrors zhumobile/css/styles.css conventions) ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  background: var(--clr-bg);
  color: var(--clr-text);
  font-family: var(--f-body);
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }

::selection { background: var(--clr-orange); color: #fff; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--clr-bg); }
::-webkit-scrollbar-thumb { background: var(--clr-border-strong); border-radius: var(--radius-pill); }

:focus-visible {
  outline: 2px solid var(--clr-orange);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3, h4 { font-family: var(--f-heading); font-weight: 700; letter-spacing: -0.01em; }

.hidden { display: none !important; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius);
  font-family: var(--f-body);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background var(--dur-fast) var(--ease2), border-color var(--dur-fast) var(--ease2), opacity var(--dur-fast);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--clr-orange); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--clr-orange-dark); }
.btn--secondary { background: transparent; border: 1px solid var(--clr-border-strong); color: var(--clr-text); }
.btn--secondary:hover:not(:disabled) { border-color: var(--clr-orange); color: var(--clr-orange); }
.btn--ghost { background: transparent; color: var(--clr-text-muted); height: auto; padding: 4px 8px; }
.btn--ghost:hover:not(:disabled) { color: var(--clr-text); }
.btn--danger { background: var(--clr-danger); color: #fff; }
.btn--full { width: 100%; }

/* ── Form fields ── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label { font-size: 0.8rem; font-weight: 600; color: var(--clr-text-muted); }
.input {
  height: 42px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--clr-input-border);
  background: var(--clr-input-bg);
  color: var(--clr-text);
  font-size: 0.92rem;
  transition: border-color var(--dur-fast) var(--ease2), box-shadow var(--dur-fast) var(--ease2);
}
.input:focus { outline: none; border-color: var(--clr-orange); box-shadow: 0 0 0 3px var(--clr-input-focus); }
textarea.input { min-height: 110px; padding: 12px 14px; resize: vertical; }

.error-text { color: var(--clr-danger); font-size: 0.85rem; min-height: 1.2em; }

/* ── Card ── */
.card {
  background: var(--clr-card-bg);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--clr-card-shadow);
  padding: 24px;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge--orange   { background: var(--clr-orange-a10); color: var(--clr-orange); }
.badge--success  { background: var(--clr-success-a15); color: var(--clr-success); }
.badge--danger   { background: var(--clr-danger-a15); color: var(--clr-danger); }
.badge--warning  { background: var(--clr-warning-a15); color: var(--clr-warning); }
.badge--muted    { background: var(--clr-bg3); color: var(--clr-text-muted); }

/* ── Auth (login) page ── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, var(--clr-orange-a10), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(11, 112, 112, 0.12), transparent 50%),
    var(--clr-bg);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 40px 32px;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--clr-card-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.auth-logo img { width: 36px; height: 36px; border-radius: 8px; }
.auth-logo span { font-family: var(--f-brand); font-weight: 700; font-size: 1.05rem; }

.auth-title { font-size: 1.3rem; margin-bottom: 4px; }
.auth-subtitle { color: var(--clr-text-muted); font-size: 0.88rem; margin-bottom: 28px; }
.turnstile-field { min-height: 65px; margin: 0 0 18px; display: flex; justify-content: center; }

/* ── App Shell ── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--clr-surface);
  border-right: 1px solid var(--clr-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: var(--z-nav);
}

.sidebar-brand {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid var(--clr-border);
  flex-shrink: 0;
}
.sidebar-brand img { width: 30px; height: 30px; border-radius: 7px; }
.sidebar-brand span { font-family: var(--f-brand); font-weight: 700; font-size: 0.98rem; }

.nav-list { flex: 1; overflow-y: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--clr-text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease2), color var(--dur-fast) var(--ease2);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--clr-bg2); color: var(--clr-text); }
.nav-item.is-active { background: var(--clr-orange-a10); color: var(--clr-orange); }
.nav-item.is-disabled { opacity: 0.4; cursor: default; pointer-events: none; }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--clr-border); }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--nav-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--clr-border);
  background: var(--clr-nav-scrolled, var(--clr-surface));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title { font-size: 1.05rem; font-weight: 700; font-family: var(--f-heading); }

.user-menu { display: flex; align-items: center; gap: 12px; }
.user-menu .user-name { font-size: 0.85rem; font-weight: 600; }
.user-menu .user-role { font-size: 0.72rem; color: var(--clr-text-muted); }

.content { flex: 1; padding: 28px; max-width: var(--max-w); width: 100%; }

.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 1.5rem; margin-bottom: 4px; }
.page-header p { color: var(--clr-text-muted); font-size: 0.9rem; }

/* ── Dashboard stat cards ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { display: flex; flex-direction: column; gap: 8px; }
.stat-card .stat-label { font-size: 0.78rem; color: var(--clr-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.stat-card .stat-value { font-family: var(--f-heading); font-size: 1.8rem; font-weight: 800; }

/* ── Coming soon placeholder ── */
.coming-soon { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 80px 24px; color: var(--clr-text-muted); gap: 8px; }
.coming-soon svg { width: 40px; height: 40px; color: var(--clr-orange); margin-bottom: 8px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: var(--z-modal);
}

.modal-card {
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--clr-card-shadow);
  padding: 24px;
}

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-header h2 { font-size: 1.1rem; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform var(--dur-mid) var(--ease2); }
  .sidebar.is-open { transform: translateX(0); }
  .main { margin-left: 0; }
}
