/* ================================================================
   Skillplan Auth — Material Design 3
   Modeled after the Skillplan CVE reference design.
   ================================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:              #003344;
  --on-primary:           #ffffff;
  --primary-container:    #d4e8f0;
  --on-primary-container: #001f28;
  --secondary:            #268f97;
  --on-secondary:         #ffffff;
  --error:                #c9493b;
  --on-error:             #ffffff;
  --error-container:      #fce8e6;
  --on-error-container:   #611a15;
  --surface:              #f8f9fa;
  --on-surface:           #202124;
  --surface-variant:      #f1f3f4;
  --on-surface-variant:   #5f6368;
  --outline:              #dadce0;
  --outline-variant:      #e8eaed;
  --inverse-surface:      #303134;
  --shadow-1: 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
  --shadow-2: 0 1px 3px 0 rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15);
  --shadow-3: 0 4px 8px 3px rgba(60,64,67,.15), 0 1px 3px rgba(60,64,67,.3);
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Roboto Mono', 'SF Mono', 'Consolas', monospace;
  --topbar-h: 56px;
  --rail-w: 72px;
}

html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); color: var(--on-surface); background: var(--surface); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography ────────────────────────────────────────────────── */
h4 { font-size: 1.5rem; font-weight: 400; }
h5 { font-size: 1.25rem; font-weight: 500; }
h6 { font-size: 1rem; font-weight: 500; }
code { font-family: var(--font-mono); font-size: .857em; background: var(--surface-variant); padding: 2px 6px; border-radius: 3px; }

/* ── Material Symbols (self-hosted) ──────────────────────────── */
@font-face {
  font-family: 'Material Symbols Outlined';
  font-style: normal;
  font-weight: 100 700;
  font-display: block;
  src: url(/static/material-symbols.woff2) format('woff2');
}
i {
  font-family: 'Material Symbols Outlined' !important;
  font-weight: normal !important;
  font-style: normal !important;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  vertical-align: middle;
}

/* ================================================================
   TOP BAR — matches reference: brand left, controls right
   ================================================================ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--primary);
  color: var(--on-primary);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 110;
  box-shadow: var(--shadow-1);
}
.topbar-brand {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--on-primary);
  text-decoration: none;
  white-space: nowrap;
}
.topbar-spacer { flex: 1; }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--secondary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  position: relative;
}
.topbar-link {
  color: rgba(255,255,255,.85);
  font-size: 13px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.topbar-link:hover { color: #fff; text-decoration: none; }
.topbar-link i { font-size: 20px; }

/* Portal/public top bar nav links */
.topbar-nav { display: flex; gap: 2px; margin-left: 24px; }
.topbar-nav a {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  transition: background .15s;
}
.topbar-nav a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.topbar-nav a.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }

/* ================================================================
   NAVIGATION RAIL — matches reference: white, icons+labels, pill
   ================================================================ */
.rail {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  width: var(--rail-w);
  height: calc(100vh - var(--topbar-h));
  background: #fff;
  border-right: 1px solid var(--outline);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 12px;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}
.rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0 4px;
  text-decoration: none;
  color: var(--on-surface-variant);
  width: 100%;
  cursor: pointer;
}
.rail-item:hover { text-decoration: none; }
.rail-item:hover .rail-icon { background: var(--surface-variant); }
.rail-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 32px;
  border-radius: var(--radius-full);
  transition: background .15s;
}
.rail-icon i { font-size: 24px; color: var(--on-surface-variant); }
.rail-item.active .rail-icon {
  background: var(--primary-container);
}
.rail-item.active .rail-icon i {
  color: var(--primary);
  font-variation-settings: 'FILL' 1;
}
.rail-item.active .rail-label {
  color: var(--primary);
  font-weight: 700;
}
.rail-label {
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  color: var(--on-surface-variant);
}
.rail-spacer { flex: 1; }

/* ================================================================
   ADMIN CONTENT AREA — below topbar, right of rail
   ================================================================ */
.admin-main {
  margin-top: var(--topbar-h);
  margin-left: var(--rail-w);
  padding: 24px;
  min-height: calc(100vh - var(--topbar-h));
  background: var(--surface);
}

/* Portal content area — below topbar, no rail */
.portal-main {
  margin-top: var(--topbar-h);
  padding: 24px;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
  min-height: calc(100vh - var(--topbar-h) - 60px);
}

/* ================================================================
   MOBILE BOTTOM NAV
   ================================================================ */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--outline);
  z-index: 100;
  padding: 4px 0 2px;
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
  font-size: 11px;
  color: var(--on-surface-variant);
  text-decoration: none;
  flex: 1;
}
.mobile-nav-item.active { color: var(--primary); font-weight: 600; }
.mobile-nav-item i { font-size: 22px; }

/* ================================================================
   BUTTONS
   ================================================================ */
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 20px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, box-shadow .15s;
  background: var(--primary);
  color: var(--on-primary);
  white-space: nowrap;
  line-height: 1.4;
}
button:hover, .button:hover { box-shadow: var(--shadow-1); text-decoration: none; }
button:disabled { opacity: .38; cursor: not-allowed; box-shadow: none; }
button i, .button i { font-size: 18px; }

button.border, .button.border { background: #fff; color: var(--primary); border: 1px solid var(--outline); }
button.border:hover { background: var(--surface-variant); box-shadow: none; }
button.error { background: var(--error); color: var(--on-error); }
button.border.error { background: #fff; color: var(--error); border-color: var(--error); }
button.border.error:hover { background: var(--error-container); }

button.responsive { width: 100%; }
button.small { padding: 6px 14px; font-size: 12px; }
button.small-round { padding: 6px 14px; font-size: 12px; }
button.circle { width: 36px; height: 36px; padding: 0; border-radius: 50%; }

/* ================================================================
   CHIPS
   ================================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-full);
  border: 1px solid var(--outline);
  background: #fff;
  color: var(--on-surface);
  text-decoration: none;
  cursor: pointer;
  transition: background .12s;
  white-space: nowrap;
}
.chip:hover { background: var(--surface-variant); text-decoration: none; }
.chip i { font-size: 16px; }
.chip.fill, .chip.fill.primary { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.chip.small { padding: 2px 8px; font-size: 11px; }
.chip.border { border: 1px solid var(--outline); }
.chip.circle { width: 36px; height: 36px; padding: 0; border-radius: 50%; justify-content: center; }

.status-active   { color: #137333; background: #e6f4ea; border-color: #ceead6; }
.status-expiring { color: #b06000; background: #fef7e0; border-color: #fde293; }
.status-expired  { color: #c5221f; background: #fce8e6; border-color: #f5c6c2; }

/* ================================================================
   CARDS
   ================================================================ */
article { background: #fff; border-radius: var(--radius-sm); padding: 16px; }
article.border { border: 1px solid var(--outline); }
article.round { border-radius: var(--radius-md); }

.primary-container   { background: var(--primary-container);   color: var(--on-primary-container); }
.error-container     { background: var(--error-container);     color: var(--on-error-container); }

/* ================================================================
   FORM FIELDS
   ================================================================ */
.field { position: relative; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 12px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--on-surface);
  background: #fff;
  border: 1px solid var(--outline);
  border-radius: var(--radius-xs);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.field input::placeholder { color: #9aa0a6; }
.field.round input { border-radius: var(--radius-sm); }

/* Switch / toggle */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  pointer-events: auto;
}
.switch input[type="checkbox"] {
  width: 36px;
  height: 20px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--outline);
  border: none;
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: background .2s;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}
.switch input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.switch input[type="checkbox"]:checked {
  background: var(--primary);
}
.switch input[type="checkbox"]:checked::after {
  transform: translateX(16px);
}
.field label.switch {
  position: static;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  background: none;
  padding: 0;
  pointer-events: auto;
  z-index: auto;
  line-height: inherit;
}

/* Field label — floating above the input border */
.field label {
  position: absolute;
  top: -8px;
  left: 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--on-surface-variant);
  background: #fff;
  padding: 0 4px;
  pointer-events: none;
  z-index: 1;
  line-height: 1;
}

/* Icon prefix */
.field > i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #9aa0a6; font-size: 20px; pointer-events: none; }
.field > i ~ input { padding-left: 36px; }

/* ================================================================
   TABLES
   ================================================================ */
table { width: 100%; border-collapse: collapse; }
table.border { border: 1px solid var(--outline); border-radius: var(--radius-sm); overflow: hidden; }
table thead { background: var(--surface-variant); }
table th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  color: var(--on-surface-variant);
  border-bottom: 1px solid var(--outline);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .05em;
}
table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--outline-variant);
  vertical-align: middle;
  font-size: 13px;
}
table tbody tr { transition: background .1s; }
table tbody tr:hover { background: rgba(0,0,0,.02); }
table tbody tr:last-child td { border-bottom: none; }
table tbody tr.active { background: var(--primary-container); }

/* ================================================================
   DIALOGS
   ================================================================ */
dialog {
  border: none;
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-3);
  max-width: 480px;
  width: calc(100% - 32px);
  background: #fff;
}
dialog::backdrop { background: rgba(0,0,0,.32); }
dialog h5 { margin-bottom: 16px; }

/* ================================================================
   MENUS
   ================================================================ */
menu {
  position: absolute;
  right: 0; top: 100%;
  list-style: none;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-2);
  padding: 8px 0;
  min-width: 180px;
  z-index: 200;
  display: none;
}
menu.active { display: block; }
menu li a { display: flex; align-items: center; gap: 8px; padding: 8px 16px; font-size: 13px; color: var(--on-surface); text-decoration: none; }
menu li a:hover { background: var(--surface-variant); }
menu li.divider { height: 1px; background: var(--outline-variant); margin: 4px 0; }

/* ================================================================
   SNACKBAR
   ================================================================ */
.snackbar {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--inverse-surface);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  box-shadow: var(--shadow-2);
  z-index: 9999;
  opacity: 0;
  transition: transform .25s, opacity .25s;
  pointer-events: none;
}
.snackbar.active { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }

/* ================================================================
   UTILITIES
   ================================================================ */
.max { flex: 1; min-width: 0; }
.right-align { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.brand-logo { font-weight: 700; letter-spacing: .02em; text-decoration: none; }
.tooltip { display: none; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(2,1fr); }

/* ================================================================
   FOOTER
   ================================================================ */
.footer {
  border-top: 1px solid var(--outline);
  padding: 16px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--on-surface-variant);
  background: #fff;
}
.footer a { color: var(--secondary); }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
  .rail { display: none; }
  .mobile-nav { display: flex; }
  .admin-main { margin-left: 0; padding-bottom: 64px; }
  .grid { grid-template-columns: 1fr !important; }
}
@media (min-width: 769px) {
  .mobile-nav { display: none; }
}
