/* ================================================================
   TalentLane — main.css
   Design system: tokens, resets, typography, layout, utilities
   ================================================================ */

/* ── Custom properties ─────────────────────────────────────────── */
:root {
  /* Brand */
  --color-primary:      #1B4FD8;
  --color-primary-dk:   #1540B0;
  --color-primary-lt:   #EEF2FF;
  --color-primary-mid:  #3B6EE8;

  /* Surfaces */
  --color-surface:        #ffffff;
  --color-surface-alt:    #F8F9FC;
  --color-surface-raised: #ffffff;
  --color-surface-sunken: #F1F3F9;

  /* Borders */
  --color-border:        #E4E7EF;
  --color-border-strong: #CBD3E3;

  /* Text */
  --color-text:        #1A1D23;
  --color-text-muted:  #6B7385;
  --color-text-subtle: #9AA3B2;

  /* Status */
  --color-success:     #0D7A5F;
  --color-success-lt:  #ECFDF5;
  --color-success-mid: #A7F3D0;
  --color-warning:     #B45309;
  --color-warning-lt:  #FFFBEB;
  --color-warning-mid: #FDE68A;
  --color-danger:      #DC2626;
  --color-danger-lt:   #FEF2F2;
  --color-danger-mid:  #FECACA;
  --color-info:        #1B4FD8;
  --color-info-lt:     #EEF2FF;

  /* Layout */
  --sidebar-width:  240px;
  --header-height:  56px;
  --content-max:    1200px;

  /* Shadows — warm-tinted for depth */
  --shadow-sm:  0 1px 2px rgba(26,29,35,.05);
  --shadow-md:  0 1px 3px rgba(26,29,35,.06), 0 4px 12px rgba(26,29,35,.08);
  --shadow-lg:  0 4px 8px rgba(26,29,35,.05), 0 14px 32px rgba(26,29,35,.10);
  --shadow-xl:  0 8px 16px rgba(26,29,35,.07), 0 28px 56px rgba(26,29,35,.14);

  /* Border radius */
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans:    'DM Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing (4px base) */
  --space-1:   4px;
  --space-2:   8px;
  --space-3:   12px;
  --space-4:   16px;
  --space-5:   20px;
  --space-6:   24px;
  --space-8:   32px;
  --space-10:  40px;
  --space-12:  48px;
  --space-16:  64px;

  /* Z-index layers */
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-modal:    300;
  --z-toast:    400;

  /* Transitions */
  --t-fast: 120ms cubic-bezier(.4,0,.2,1);
  --t:      200ms cubic-bezier(.4,0,.2,1);
  --t-slow: 300ms cubic-bezier(.4,0,.2,1);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-surface-alt);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg          { display: block; max-width: 100%; }
button            { cursor: pointer; font-family: inherit; }
a                 { color: var(--color-primary); text-decoration: none; }
a:hover           { text-decoration: underline; }
input, textarea,
select            { font-family: inherit; font-size: inherit; }
ul, ol            { list-style: none; }

/* ── Typography ─────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.0625rem; }
h5 { font-size: .9375rem; }
h6 { font-size: .875rem; }

/* Type scale utilities */
.text-xs   { font-size: .75rem;  line-height: 1.4; }
.text-sm   { font-size: .875rem; line-height: 1.5; }
.text-base { font-size: 1rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }
.text-2xl  { font-size: 1.5rem; }
.text-3xl  { font-size: 1.875rem; }

.text-muted   { color: var(--color-text-muted); }
.text-subtle  { color: var(--color-text-subtle); }
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-mono    { font-family: var(--font-mono); font-feature-settings: 'tnum'; }

.font-normal   { font-weight: 400; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

.text-center { text-align: center; }
.text-right  { text-align: right; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: .06em; }

/* ── Layout ──────────────────────────────────────────────────────── */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

/* Dashboard layout */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

.dashboard-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  z-index: var(--z-sticky);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.dashboard-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  background: var(--color-surface-alt);
}

.dashboard-header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  z-index: calc(var(--z-sticky) - 1);
  display: flex;
  align-items: center;
  padding-inline: var(--space-6);
  gap: var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.page-content {
  flex: 1;
  padding: var(--space-6);
}

/* ── Grid utilities ──────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── Flex utilities ──────────────────────────────────────────────── */
.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-end   { justify-content: flex-end; }
.flex-wrap     { flex-wrap: wrap; }
.flex-1        { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.min-w-0       { min-width: 0; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ── Spacing utilities ───────────────────────────────────────────── */
.p-4   { padding: var(--space-4); }
.p-6   { padding: var(--space-6); }
.px-4  { padding-inline: var(--space-4); }
.py-2  { padding-block: var(--space-2); }
.py-3  { padding-block: var(--space-3); }
.mt-2  { margin-top: var(--space-2); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mb-2  { margin-bottom: var(--space-2); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.ml-auto { margin-left: auto; }
.w-full  { width: 100%; }

/* ── Visibility ──────────────────────────────────────────────────── */
.hidden    { display: none !important; }
.invisible { visibility: hidden; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

[x-cloak] { display: none !important; }

/* ── Section helpers ─────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  gap: var(--space-3);
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -.015em;
}

.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin-block: var(--space-4);
}

/* ── Empty state ─────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-16) var(--space-6);
  text-align: center;
}

.empty-state-icon {
  width: 48px; height: 48px;
  margin-bottom: var(--space-4);
  color: var(--color-text-subtle);
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  font-size: .875rem;
  color: var(--color-text-muted);
  max-width: 320px;
  margin-bottom: var(--space-5);
  line-height: 1.6;
}

/* ── Public nav ──────────────────────────────────────────────────── */
.public-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.public-nav-inner {
  height: 60px;
  gap: var(--space-6);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo:hover { text-decoration: none; }

.nav-logo-mark {
  width: 32px; height: 32px;
  background: var(--color-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-logo-text {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -.02em;
}
.nav-logo-text span { color: var(--color-primary); }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
}

.nav-link {
  padding: .375rem .75rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--color-text-muted);
  border-radius: var(--radius);
  transition: color var(--t-fast), background var(--t-fast);
}
.nav-link:hover { color: var(--color-text); background: var(--color-surface-alt); text-decoration: none; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* User menu in nav */
.nav-user { position: relative; }

.nav-user-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: .3125rem .5rem .3125rem .3125rem;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: .875rem;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.nav-user-btn:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-sm); }

.nav-avatar {
  width: 26px; height: 26px;
  border-radius: var(--radius-full);
  background: var(--color-primary-lt);
  color: var(--color-primary);
  font-size: .7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-dropdown {
  display: none; /* Alpine x-show overrides this via inline style */
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1);
  z-index: var(--z-dropdown);
  transform-origin: top right;
}

.nav-dropdown-item {
  display: block;
  padding: .5rem .75rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--color-text);
  border-radius: var(--radius);
  transition: background var(--t-fast);
}
.nav-dropdown-item:hover { background: var(--color-surface-alt); text-decoration: none; }
.nav-dropdown-item-danger { color: var(--color-danger); }
.nav-dropdown-item-danger:hover { background: var(--color-danger-lt); }

.nav-dropdown-divider {
  height: 1px;
  background: var(--color-border);
  margin-block: var(--space-1);
}

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  padding: var(--space-2);
  color: var(--color-text-muted);
  border-radius: var(--radius);
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-hamburger:hover { background: var(--color-surface-alt); color: var(--color-text); }

/* Mobile menu */
.mobile-menu {
  display: none; /* Alpine x-show overrides this via inline style */
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4) var(--space-4);
}

.mobile-nav-link {
  display: block;
  padding: .625rem var(--space-2);
  font-size: .9375rem;
  font-weight: 500;
  color: var(--color-text-muted);
  border-radius: var(--radius);
  transition: background var(--t-fast), color var(--t-fast);
}
.mobile-nav-link:hover { background: var(--color-surface-alt); color: var(--color-text); text-decoration: none; }
.mobile-nav-link-danger { color: var(--color-danger); }
.mobile-nav-link-danger:hover { background: var(--color-danger-lt); }

.mobile-nav-divider {
  height: 1px;
  background: var(--color-border);
  margin-block: var(--space-2);
}

/* Footer */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-12) var(--space-6);
  margin-top: var(--space-16);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-10);
  margin-bottom: var(--space-10);
}

.footer-brand { display: flex; flex-direction: column; gap: var(--space-4); }

.footer-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}
.footer-logo:hover { text-decoration: none; }

.footer-tagline {
  font-size: .9rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

.footer-col-title {
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.footer-links { display: flex; flex-direction: column; gap: var(--space-3); }
.footer-links a { font-size: .875rem; color: var(--color-text-muted); transition: color var(--t-fast); }
.footer-links a:hover { color: var(--color-text); text-decoration: none; }

.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  font-size: .8125rem;
  color: var(--color-text-subtle);
}

.footer-bar-links { display: flex; gap: var(--space-6); }
.footer-bar-links a { color: var(--color-text-subtle); transition: color var(--t-fast); }
.footer-bar-links a:hover { color: var(--color-text); text-decoration: none; }

/* ── Responsive: mobile sidebar ──────────────────────────────────── */
@media (max-width: 768px) {
  .dashboard-sidebar {
    transform: translateX(-100%);
    transition: transform var(--t-slow);
    box-shadow: none;
  }
  .dashboard-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }
  .dashboard-main { margin-left: 0; }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: calc(var(--z-sticky) - 1);
  }
  .sidebar-backdrop.open { display: block; }

  .nav-links         { display: none; }
  .nav-hamburger     { display: flex; }
  .nav-actions .btn  { display: none; }
  .nav-user          { display: none; }

  .footer-grid { grid-template-columns: 1fr; gap: var(--space-8); }
}

@media (max-width: 640px) {
  .container { padding-inline: var(--space-4); }
  .page-content { padding: var(--space-4); }
  .hidden-mobile { display: none !important; }
}

@media (max-width: 480px) {
  /* Clamp nav dropdown so it never overflows the viewport */
  .nav-dropdown {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    min-width: min(180px, calc(100vw - 2rem));
  }

  /* Tighten page header on very small screens */
  .page-header { padding: var(--space-4) var(--space-4) 0; }
  .page-title  { font-size: 1.25rem; }
}

/* Form elements (shared) */
.form-group   { margin-bottom: var(--space-5); }

.form-label {
  display: block;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-2);
  letter-spacing: -.01em;
}

.form-label.required::after { content: ' *'; color: var(--color-danger); }

.form-input, .form-select, .form-textarea {
  display: block;
  width: 100%;
  padding: .5rem .75rem;
  font-size: .9375rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
  line-height: 1.5;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--color-text-subtle); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(27,79,216,.12);
}

.form-input.error,
.form-select.error,
.form-textarea.error { border-color: var(--color-danger); }

.form-error { font-size: .8125rem; color: var(--color-danger); margin-top: var(--space-1); }
.form-hint  { font-size: .8125rem; color: var(--color-text-muted); margin-top: var(--space-1); }
.form-textarea { resize: vertical; min-height: 100px; }

/* Alert banners */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  border: 1px solid;
  font-size: .875rem;
  line-height: 1.5;
}

.alert-success { background: var(--color-success-lt); border-color: var(--color-success-mid); color: var(--color-success); }
.alert-error   { background: var(--color-danger-lt);  border-color: var(--color-danger-mid);  color: var(--color-danger); }
.alert-warning { background: var(--color-warning-lt); border-color: var(--color-warning-mid); color: var(--color-warning); }
.alert-info    { background: var(--color-info-lt);    border-color: #BFDBFE;                  color: var(--color-info); }
