/* ==========================================================================
   Meraki — Shell, Tactile Sidebar with Course Rail, Topbar, Drawers & Login
   ========================================================================== */

.app-root { min-height: 100vh; }

/* --- Architectural Split Login (Visual Specimen + Crisp Sign-In) --- */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  background: var(--bg-canvas);
}

.login-visual-pane {
  position: relative;
  padding: 36px 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: var(--bg-rail);
  background-image: radial-gradient(var(--dot-grid) 1.25px, transparent 1.25px);
  background-size: 20px 20px;
  border-right: 1px solid var(--border-subtle);
  overflow: hidden;
}

.specimen-stack {
  margin: auto 0;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.specimen-headline {
  font-family: var(--font-serif);
  font-size: clamp(36px, 4.2vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin: 0 0 8px;
}

.specimen-headline span {
  color: var(--accent);
  font-style: italic;
}

/* Miniature live-feeling studio desk preview card */
.specimen-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-md), var(--border-highlight);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.specimen-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
}

.specimen-meter {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: var(--bg-subtle);
  overflow: hidden;
  max-width: 140px;
}

.specimen-meter > i {
  display: block;
  height: 100%;
  border-radius: 99px;
}

.login-form-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 36px 24px;
}

.login-topbar-tools {
  position: absolute;
  top: 18px;
  right: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-card {
  width: 100%;
  max-width: 392px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  padding: 32px 30px 28px;
  box-shadow: var(--shadow-md), var(--border-highlight);
  animation: slideUp var(--t-slow) var(--ease-out);
}

.login-card h2 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 500;
  margin: 0 0 4px;
  line-height: 1.15;
}

.login-card .subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 0 0 22px;
}

/* --- Main App Shell --- */
.shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-rail);
  border-right: 1px solid var(--border-subtle);
  padding: 14px 12px 12px;
  overflow-y: auto;
  z-index: 30;
}

.rail-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--text-primary);
  color: var(--bg-canvas);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

.brand-mark::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--accent);
  border: 2px solid var(--bg-rail);
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.brand-name {
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -0.025em;
}

.brand-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.rail-nav {
  flex: 1;
  padding: 6px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.nav-group-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 9px 4px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
  text-align: left;
}

.nav-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.72;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-xs), var(--border-highlight);
}

.nav-item.active svg {
  color: var(--accent);
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--bg-active);
  color: var(--text-secondary);
}

.nav-item.active .nav-badge {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-badge.danger {
  background: var(--red-soft);
  color: var(--red);
}

/* Quick-jump course strip in sidebar */
.rail-courses {
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rail-course-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  border-radius: var(--r-xs);
  font-size: 12px;
  color: var(--text-secondary);
  text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}

.rail-course-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.rail-course-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-footer {
  padding-top: 10px;
  margin-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: var(--r-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--text-primary);
  color: var(--bg-canvas);
  font-weight: 700;
  font-size: 11.5px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.profile-meta { min-width: 0; flex: 1; }
.profile-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-sub { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Main Column & Topbar --- */
.main-col { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 20;
}

.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }

.mobile-menu-btn {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.topbar-title {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.cmd-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  width: 270px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
  color: var(--text-muted);
  font-size: 12.5px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.cmd-trigger:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  color: var(--text-secondary);
}

.cmd-trigger kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.topbar-right { display: flex; align-items: center; gap: 6px; }

/* Accent Swatch Bar */
.swatch-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch-dot {
  width: 18px;
  height: 18px;
  border-radius: 99px;
  border: 2px solid transparent;
  transition: transform var(--t-fast), border-color var(--t-fast);
}

.swatch-dot:hover { transform: scale(1.14); }
.swatch-dot.active { border-color: var(--text-primary); transform: scale(1.1); }

.content {
  flex: 1;
  padding: 26px 30px 60px;
  max-width: 1260px;
  width: 100%;
  margin: 0 auto;
  animation: viewIn var(--t-med) var(--ease-out);
}

/* --- Slide-Over Drawer --- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-backdrop);
  backdrop-filter: blur(4px);
  z-index: 60;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn var(--t-fast) var(--ease-out);
}

.drawer-panel {
  width: min(var(--drawer-w), 100vw);
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideInRight var(--t-med) var(--ease-spring);
}

.drawer-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.drawer-header h3 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.25; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* --- Command Palette & Modal --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-backdrop);
  backdrop-filter: blur(5px);
  z-index: 80;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 11vh 16px 24px;
  animation: fadeIn var(--t-fast) var(--ease-out);
}

.palette-box {
  width: 100%;
  max-width: 560px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: scaleIn var(--t-fast) var(--ease-out);
}

.modal-card {
  width: 100%;
  max-width: 470px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  animation: scaleIn var(--t-fast) var(--ease-out);
}

/* --- Toasts --- */
.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 250px;
  max-width: 390px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  animation: slideUp var(--t-med) var(--ease-spring);
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.warn    { border-left: 3px solid var(--amber); }
.toast.info    { border-left: 3px solid var(--accent); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { transform: translateX(28px); opacity: 0.8; } to { transform: translateX(0); opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 960px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-visual-pane { display: none; }
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform var(--t-med) var(--ease-out);
    box-shadow: var(--shadow-lg);
  }
  .rail.open { transform: translateX(0); }
  .rail-mobile-backdrop { position: fixed; inset: 0; background: var(--bg-backdrop); z-index: 25; }
  .mobile-menu-btn { display: inline-flex; }
  .topbar { padding: 0 14px; }
  .cmd-trigger { width: auto; min-width: 140px; }
  .content { padding: 18px 16px 48px; }
}
