/* =====================================================
   Ask Diego Admin — Design System (light mode)
   ===================================================== */

/* RESET */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* TOKENS */
:root {
  /* Backgrounds */
  --bg-app: #FAFAFA;
  --bg-surface: #FFFFFF;
  --bg-surface-hover: #F9FAFB;
  --bg-input: #FFFFFF;
  --bg-overlay: rgba(17, 24, 39, 0.6);

  /* Borders */
  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  --border-focus: #184070;

  /* Text */
  --text-primary: #111827;
  --text-secondary: #6B7280;
  --text-tertiary: #9CA3AF;
  --text-on-primary: #FFFFFF;
  --text-link: #184070;

  /* Accents */
  --primary: #184070;
  --primary-hover: #102B4F;
  --primary-soft: #EFF3F8;
  --gold: #B8932E;
  --gold-soft: #FBF6E5;

  /* Severity */
  --alert: #DC2626;
  --alert-soft: #FEF2F2;
  --alert-border: #FCA5A5;
  --warning: #D97706;
  --warning-soft: #FFFBEB;
  --warning-border: #FCD34D;
  --info: #2563EB;
  --info-soft: #EFF6FF;
  --info-border: #93C5FD;
  --success: #059669;
  --success-soft: #ECFDF5;
  --success-border: #6EE7B7;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(17,24,39,.04);
  --shadow-md: 0 1px 3px rgba(17,24,39,.06), 0 1px 2px rgba(17,24,39,.04);
  --shadow-lg: 0 4px 6px -1px rgba(17,24,39,.08), 0 2px 4px -2px rgba(17,24,39,.06);
  --shadow-xl: 0 20px 25px -5px rgba(17,24,39,.10), 0 8px 10px -6px rgba(17,24,39,.04);

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-full: 9999px;

  /* Spacing scale (used in components below) */
  --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;

  /* Typography */
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* TYPOGRAPHY */
body {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-app);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 1px;
  color: var(--text-primary);
}

h1 { font-size: 32px; line-height: 1.1; }
h2 { font-size: 24px; line-height: 1.2; letter-spacing: 1.5px; }
h3 { font-size: 18px; line-height: 1.3; letter-spacing: 1px; }
h4 { font-size: 14px; line-height: 1.4; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-secondary); }

.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-mono { font-family: var(--font-mono); font-size: 12px; }

/* LAYOUT — App shell */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: var(--space-6) 0;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 0 var(--space-6) var(--space-8);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-brand-mark {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0;
}

.sidebar-brand-name {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 1.5px;
  color: var(--text-primary);
}

.sidebar-brand-sub {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--gold);
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 0 var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar-link {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all .15s;
}

.sidebar-link:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-footer {
  padding: var(--space-6) var(--space-6) 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-footer-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--gold-soft);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.sidebar-footer-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}

.sidebar-footer-role {
  font-size: 10px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.main {
  padding: var(--space-8) var(--space-10);
  max-width: 1400px;
  width: 100%;
}

.page-header {
  margin-bottom: var(--space-8);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-6);
}

.page-header h1 { margin-bottom: var(--space-2); }
.page-header-sub { color: var(--text-secondary); font-size: 13px; }

/* CARDS */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-primary);
}

/* STAT CARDS (dashboard) */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stat-card-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.stat-card-value {
  font-family: var(--font-display);
  font-size: 36px;
  letter-spacing: 0;
  line-height: 1;
  color: var(--text-primary);
}

.stat-card-meta {
  font-size: 12px;
  color: var(--text-tertiary);
}

.stat-card.is-alert .stat-card-value { color: var(--alert); }
.stat-card.is-warning .stat-card-value { color: var(--warning); }
.stat-card.is-info .stat-card-value { color: var(--info); }
.stat-card.is-success .stat-card-value { color: var(--success); }

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  border: 1px solid transparent;
}

.badge-alert { background: var(--alert-soft); color: var(--alert); border-color: var(--alert-border); }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }
.badge-info { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }
.badge-success { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.badge-neutral { background: var(--bg-surface-hover); color: var(--text-secondary); border-color: var(--border); }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .3px;
  transition: all .15s;
  border: 1px solid transparent;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--text-on-primary);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-surface-hover); border-color: var(--text-secondary); }

.btn-danger {
  background: var(--alert);
  color: white;
}
.btn-danger:hover:not(:disabled) { background: #B91C1C; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-surface-hover); color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }

.btn:disabled { opacity: .5; cursor: not-allowed; }

/* INPUTS */
.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-primary);
  transition: all .15s;
}

.input:hover { border-color: var(--text-secondary); }
.input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(24, 64, 112, .12);
}
.input::placeholder { color: var(--text-tertiary); }

.input-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .5px;
  margin-bottom: var(--space-2);
  color: var(--text-primary);
  text-transform: uppercase;
}

.input-group { margin-bottom: var(--space-4); }

.input-help { margin-top: var(--space-2); font-size: 12px; color: var(--text-secondary); }

/* TABLES */
.table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: var(--space-3) var(--space-5);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg-surface-hover);
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13px;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover { background: var(--bg-surface-hover); }
.table .col-actions { text-align: right; white-space: nowrap; }

/* AUTH PAGE */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-6);
  background: linear-gradient(180deg, var(--bg-app) 0%, #F3F4F6 100%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  box-shadow: var(--shadow-xl);
}

.auth-brand {
  text-align: center;
  margin-bottom: var(--space-8);
}

.auth-brand-mark {
  width: 64px;
  height: 64px;
  background: var(--primary);
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: var(--font-display);
  font-size: 32px;
  margin-bottom: var(--space-4);
}

.auth-brand-name {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 2px;
  color: var(--text-primary);
}

.auth-brand-sub {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--gold);
  text-transform: uppercase;
  margin-top: var(--space-1);
}

.auth-title {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 1.5px;
  margin-bottom: var(--space-2);
  text-transform: uppercase;
}

.auth-desc {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: var(--space-6);
}

/* ALERTS / MESSAGES */
.alert {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  border: 1px solid transparent;
}

.alert-info { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }
.alert-error { background: var(--alert-soft); color: var(--alert); border-color: var(--alert-border); }

.alert-title { font-weight: 700; margin-bottom: 2px; }
.alert-body { line-height: 1.5; }

/* LOADING */
.loader {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-surface-hover) 0%, var(--border) 50%, var(--bg-surface-hover) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* UTILS */
.hidden { display: none !important; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.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); }
.w-full { width: 100%; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    padding: var(--space-3) var(--space-4);
    align-items: center;
    justify-content: space-between;
  }
  .sidebar-brand { padding: 0; }
  .sidebar-nav { display: none; }
  .sidebar-footer { padding: 0; border: none; }
  .main { padding: var(--space-6) var(--space-4); }
  .auth-card { padding: var(--space-6); }
}
