/**
 * Elio Design System - shared CSS for all Elio apps.
 * Used by: app.getelio.co, admin.getelio.co
 * Fonts loaded separately via Google Fonts link tag.
 */

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

/* ---- Design Tokens ---- */
:root {
  /* Brand palette */
  --night: #06080F; --deep: #0D1117; --twilight: #161B33;
  --predawn: #2D1B4E; --horizon: #6B2D5B; --first-light: #D94F2B;
  --sunrise: #FF6B2C; --solar: #FF9F1C; --golden: #FFD166;
  --daylight: #FFF8F0; --pure: #FFFFFF;

  /* Neutrals */
  --n900: #06080F; --n800: #13161F; --n700: #1A1D2E; --n600: #2E3148;
  --n500: #525570; --n400: #8B8B9E; --n300: #B4B4C4; --n200: #D6D4DE;
  --n100: #F2F0F6; --n50: #FAF8FC; --n0: #FFFFFF;

  /* Typography */
  --font-display: 'Sora', sans-serif;
  --font: 'Inter', -apple-system, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Gradients */
  --sunrise-gradient: linear-gradient(135deg, var(--first-light), var(--sunrise), var(--solar));
  --awakening-gradient: linear-gradient(90deg, var(--predawn), var(--horizon), var(--first-light), var(--sunrise), var(--solar), var(--golden));

  /* Shadows */
  --sh-xs: 0 1px 2px rgba(6,8,15,0.05), 0 0 0 1px rgba(6,8,15,0.02);
  --sh-sm: 0 2px 10px rgba(6,8,15,0.06), 0 1px 3px rgba(6,8,15,0.04);
  --sh-md: 0 6px 24px rgba(6,8,15,0.08), 0 2px 8px rgba(6,8,15,0.05);
  --sh-lg: 0 20px 56px rgba(6,8,15,0.12), 0 6px 16px rgba(6,8,15,0.06);

  /* Layout */
  --sidebar-w: 260px;

  /* Radii */
  --radius-sm: 8px; --radius-md: 14px; --radius-lg: 20px; --radius-xl: 24px;
}

/* ---- Base ---- */
html, body { height: 100%; }
body {
  font-family: var(--font); -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale; background: var(--pure);
  color: var(--night); letter-spacing: -0.01em;
}

/* ---- Shared Components ---- */

/* Google Sign-In button */
.elio-google-btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 28px;
  border-radius: 999px; background: var(--pure); color: var(--night);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  text-decoration: none; border: 1px solid var(--n200);
  box-shadow: var(--sh-sm); transition: all 0.2s; cursor: pointer;
}
.elio-google-btn:hover { box-shadow: var(--sh-md); transform: translateY(-1px); }

/* Primary button */
.elio-btn {
  padding: 8px 20px; border-radius: var(--radius-sm); border: none;
  background: var(--sunrise-gradient); color: #fff;
  font-family: var(--font-display); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; letter-spacing: 0.02em;
}
.elio-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(255,107,44,0.3); }
.elio-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Outline button */
.elio-btn-outline {
  padding: 8px 20px; border-radius: var(--radius-sm);
  border: 1px solid var(--n200); background: var(--pure); color: var(--n600);
  font-family: var(--font); font-size: 12px; font-weight: 500; cursor: pointer;
  transition: all 0.15s;
}
.elio-btn-outline:hover { border-color: var(--n300); background: var(--n50); }

/* Cards */
.elio-card {
  background: var(--pure); border-radius: var(--radius-md);
  border: 1px solid var(--n100); box-shadow: var(--sh-sm);
}

/* Stat cards */
.elio-stat-card {
  background: var(--pure); border-radius: var(--radius-md); padding: 20px;
  border: 1px solid var(--n100); box-shadow: var(--sh-sm);
}
.elio-stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--night); }
.elio-stat-label { font-size: 12px; color: var(--n400); margin-top: 4px; font-weight: 500; }

/* Avatar */
.elio-avatar {
  border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 700; color: #fff;
  background: var(--sunrise-gradient); overflow: hidden; flex-shrink: 0;
}
.elio-avatar img { width: 100%; height: 100%; object-fit: cover; }
.elio-avatar-sm { width: 28px; height: 28px; font-size: 11px; vertical-align: middle; margin-right: 8px; }
.elio-avatar-md { width: 48px; height: 48px; font-size: 18px; }
.elio-avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.elio-avatar-xl { width: 80px; height: 80px; font-size: 28px; box-shadow: 0 4px 20px rgba(255,107,44,0.3); }

/* Badges */
.elio-badge {
  display: inline-block; padding: 3px 8px; border-radius: 99px; font-size: 11px; font-weight: 600;
}
.elio-badge-active { background: rgba(34,197,94,0.1); color: #16a34a; }
.elio-badge-draft { background: rgba(139,139,158,0.1); color: var(--n500); }
.elio-badge-accent { background: rgba(255,107,44,0.1); color: var(--sunrise); }
.elio-badge-purple { background: rgba(107,45,91,0.1); color: var(--horizon); }

/* Tables */
.elio-table { width: 100%; border-collapse: collapse; }
.elio-table th {
  text-align: left; padding: 10px 16px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--n400);
  border-bottom: 1px solid var(--n100); background: var(--n50);
}
.elio-table td {
  padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--n100); color: var(--n600);
}
.elio-table tr:last-child td { border-bottom: none; }
.elio-table tr:hover td { background: rgba(255,107,44,0.02); }

/* Form fields */
.elio-form-label {
  display: block; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--n400); margin-bottom: 6px;
  font-family: var(--font-display);
}
.elio-form-input {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--n200); background: var(--pure); font-family: var(--font);
  font-size: 14px; color: var(--night); outline: none; transition: border-color 0.2s;
}
.elio-form-input:focus { border-color: var(--sunrise); box-shadow: 0 0 0 3px rgba(255,107,44,0.08); }
.elio-form-select {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--n200); background: var(--pure); font-family: var(--font);
  font-size: 14px; color: var(--night); outline: none; cursor: pointer;
}
.elio-form-select:focus { border-color: var(--sunrise); }

/* Modal */
.elio-modal-overlay {
  position: fixed; inset: 0; background: rgba(6,8,15,0.4); z-index: 100;
  display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.elio-modal-overlay.show { display: flex; }
.elio-modal {
  background: var(--pure); border-radius: var(--radius-lg); padding: 32px;
  max-width: 480px; width: 90%; box-shadow: 0 24px 80px rgba(6,8,15,0.2);
}
.elio-modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin-bottom: 20px; }

/* Empty state */
.elio-empty {
  text-align: center; padding: 60px 20px; color: var(--n400);
}
.elio-empty-text { font-size: 14px; }

/* Page title */
.elio-page-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin-bottom: 24px; }

/* Login screen */
.elio-login-screen {
  display: flex; align-items: center; justify-content: center; height: 100vh;
  background: linear-gradient(160deg, var(--daylight) 0%, #fff5ed 50%, var(--daylight) 100%);
}
.elio-login-card {
  text-align: center; padding: 48px 40px; background: var(--pure);
  border-radius: var(--radius-lg); box-shadow: var(--sh-md); max-width: 400px; width: 90%;
}
.elio-login-logo {
  font-family: var(--font-display); font-size: 28px; font-weight: 700;
  background: var(--sunrise-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}
.elio-login-subtitle { color: var(--n400); font-size: 14px; margin-bottom: 32px; }
.elio-login-error {
  background: #fff0f0; color: #d32f2f; border-radius: var(--radius-sm);
  padding: 10px 16px; margin-bottom: 20px; font-size: 13px; display: none;
}

/* Inline edit */
.elio-inline-edit {
  background: none; border: none; border-bottom: 1px dashed var(--n200); font-family: inherit;
  font-size: inherit; color: inherit; padding: 0 2px; outline: none; width: auto; min-width: 40px;
}
.elio-inline-edit:focus { border-bottom-color: var(--sunrise); }

/* Code */
.elio-code {
  font-family: var(--font-mono); font-size: 12px; background: var(--n50);
  padding: 2px 6px; border-radius: 4px;
}

/* ---- App Layout ---- */
.app-layout { display: flex; height: 100%; }

/* Gradient text */
.gt {
  background: var(--awakening-gradient); background-size: 200% 100%;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Main content area */
.main-content { flex: 1; overflow-y: auto; z-index: 1; position: relative; }
.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.06); border-radius: 3px; }
.main-content::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.1); }

/* Grain overlay - applied to main-content */
.main-content::after {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 180px; opacity: 0.025; mix-blend-mode: overlay;
}

/* Orbs */
.orb {
  position: fixed; border-radius: 50%; pointer-events: none; z-index: 0;
  animation: orbPulse 10s ease-in-out infinite;
}
.orb-1 {
  width: 600px; height: 600px; top: -15%; right: -8%;
  background: radial-gradient(circle, rgba(255,107,44,0.08) 0%, rgba(255,107,44,0) 70%);
  filter: blur(80px);
}
.orb-2 {
  width: 500px; height: 500px; bottom: -12%; left: 12%;
  background: radial-gradient(circle, rgba(255,159,28,0.06) 0%, rgba(255,159,28,0) 70%);
  filter: blur(80px); animation-delay: -4s;
}
.orb-3 {
  width: 300px; height: 300px; top: 40%; left: 45%;
  background: radial-gradient(circle, rgba(255,209,102,0.04) 0%, rgba(255,209,102,0) 70%);
  filter: blur(60px); animation-delay: -7s;
}
@keyframes orbPulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.12); }
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w); height: 100%;
  background: var(--daylight);
  display: flex; flex-direction: column; flex-shrink: 0; z-index: 10;
  position: relative;
}
.sidebar::after {
  content: '';
  position: absolute; right: 0; top: 0; bottom: 0; width: 1px;
  background: var(--n100);
}
.sidebar-header { padding: 32px 28px 28px; position: relative; }
.sidebar-logo {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.4rem; letter-spacing: 0.05em; color: var(--night);
  position: relative;
}
.sidebar-logo::after {
  content: '';
  position: absolute; bottom: -14px; left: 0; right: 0; height: 1px;
  background: var(--n100);
}
.sidebar-label {
  font-size: 10px; color: var(--n400); font-weight: 500;
  letter-spacing: 0.08em; margin-top: 22px; text-transform: uppercase;
}
.sidebar-nav {
  flex: 1; padding: 16px 14px; display: flex; flex-direction: column; gap: 1px;
  overflow-y: auto;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.06); border-radius: 3px; }
.sidebar-section-label {
  padding: 14px 16px 6px; font-family: var(--font-display);
  font-size: 9px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--n400);
}
.sidebar-section-label:first-child { padding-top: 4px; }

/* Nav items */
.nav-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; flex-shrink: 0; opacity: 0.55;
  transition: opacity 0.15s ease;
}
.nav-icon svg { width: 16px; height: 16px; }
.nav-item:hover .nav-icon, .nav-item.active .nav-icon { opacity: 1; }
.nav-children { padding-left: 18px; display: flex; flex-direction: column; gap: 0; }
.nav-cat-item { padding: 7px 16px; font-size: 12px; gap: 8px; border-radius: 10px; }
.nav-cat-item .nav-icon { width: 16px; height: 16px; opacity: 0.4; }
.nav-cat-item .nav-icon svg { width: 14px; height: 14px; }
.nav-cat-item.active {
  background: rgba(255,107,44,0.06); color: var(--first-light);
  border-color: rgba(255,107,44,0.1);
}
.nav-item {
  padding: 11px 16px; border-radius: 12px; font-size: 13px; font-weight: 500;
  color: var(--n500); cursor: pointer; transition: all 0.2s ease;
  display: flex; align-items: center; gap: 12px;
  border: 1px solid transparent; background: none; width: 100%; text-align: left;
  font-family: var(--font); letter-spacing: 0.01em;
}
.nav-item:hover { background: var(--n50); color: var(--n700); border-color: transparent; }
.nav-item.active {
  background: rgba(255,107,44,0.06); border-color: rgba(255,107,44,0.1);
  color: var(--night);
}
.nav-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--n200); flex-shrink: 0; transition: all 0.2s ease;
}
.nav-item:hover .nav-dot { background: var(--n400); }
.nav-item.active .nav-dot {
  background: var(--sunrise); box-shadow: 0 0 8px rgba(255,107,44,0.4);
}

/* Sidebar user */
.sidebar-user {
  padding: 20px 24px; border-top: 1px solid var(--n100);
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  transition: background 0.2s ease;
}
.sidebar-user:hover { background: var(--n50); }
.sidebar-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--sunrise), var(--solar));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  font-family: var(--font-display); color: #fff;
  box-shadow: 0 2px 12px rgba(255,107,44,0.25);
  overflow: hidden; position: relative;
}
.sidebar-avatar img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.sidebar-avatar-ring {
  padding: 2px; border-radius: 50%;
  background: linear-gradient(135deg, var(--first-light), var(--sunrise), var(--solar));
}
.user-name { font-size: 13px; font-weight: 600; color: var(--night); }
.user-role { font-size: 11px; color: var(--n400); letter-spacing: 0.02em; margin-top: 1px; }
