/* ═══════════════════════════════════════════════════════════════
   CCTV Planner — Estilos globales de la aplicación
═══════════════════════════════════════════════════════════════ */
:root {
  --bg0: #0d1117;
  --bg1: #161b22;
  --bg2: #1e2530;
  --bg3: #252d3a;
  --border: rgba(255,255,255,0.08);
  --border-md: rgba(255,255,255,0.13);
  --text0: #f0f4f8;
  --text1: #a8b5c4;
  --text2: #64748b;
  --blue: #3b82f6;
  --blue-h: #2563eb;
  --blue-l: rgba(59,130,246,0.14);
  --green: #22c55e;
  --green-h: #16a34a;
  --orange: #f59e0b;
  --red: #ef4444;
  --r: 8px;
  --r-lg: 12px;
}

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

html, body {
  font-family: -apple-system, 'Segoe UI', Helvetica, sans-serif;
  font-size: 13px;
  background: var(--bg0);
  color: var(--text0);
  line-height: 1.5;
}

/* ── Botones ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; font-size: 13px; font-weight: 500;
  border-radius: var(--r); cursor: pointer; border: 1px solid transparent;
  font-family: inherit; transition: background .14s, transform .1s;
  text-decoration: none; white-space: nowrap; line-height: 1;
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue-h); }
.btn-primary:hover { background: var(--blue-h); }
.btn-success { background: var(--green); color: #fff; border-color: var(--green-h); }
.btn-success:hover { background: var(--green-h); }
.btn-ghost { background: transparent; color: var(--text1); border-color: var(--border-md); }
.btn-ghost:hover { background: var(--bg3); color: var(--text0); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Formularios ── */
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 12px; color: var(--text2); font-weight: 500; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; background: var(--bg2); border: 1px solid var(--border-md);
  border-radius: var(--r); color: var(--text0); font-size: 13px;
  padding: 8px 12px; font-family: inherit; outline: none; transition: border-color .14s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
input::placeholder { color: var(--text2); }
select option { background: var(--bg1); }
.select-sm { padding: 5px 8px; font-size: 12px; }

/* ── Alertas ── */
.alert { padding: 10px 14px; border-radius: var(--r); font-size: 12px; margin-bottom: 14px; }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.25); color: #86efac; }

/* ── Badges ── */
.badge { font-size: 10px; padding: 2px 7px; border-radius: 20px; font-weight: 600; }
.badge-blue { background: var(--blue-l); color: #93c5fd; }
.status-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.status-draft    { background: rgba(255,255,255,0.06); color: var(--text2); }
.status-active   { background: rgba(34,197,94,0.14); color: #86efac; }
.status-archived { background: rgba(245,158,11,0.12); color: #fcd34d; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal {
  background: var(--bg1); border: 1px solid var(--border-md);
  border-radius: var(--r-lg); min-width: 400px; max-width: 500px; width: 90%;
  animation: modalIn .18s ease;
}
@keyframes modalIn { from { opacity:0; transform:scale(.96); } to { opacity:1; transform:scale(1); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text2); font-size: 20px; cursor: pointer; padding: 0 4px; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); }

/* ── Mode selector en modal ── */
.mode-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-option {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 14px 10px; border: 1px solid var(--border); border-radius: var(--r);
  cursor: pointer; transition: all .14s; text-align: center;
}
.mode-option:hover { border-color: var(--border-md); background: var(--bg2); }
.mode-option.active { border-color: var(--blue); background: var(--blue-l); }
.mode-option span { font-size: 13px; font-weight: 600; color: var(--text0); }
.mode-option small { font-size: 10px; color: var(--text2); }

/* ═══════════════════════════════════════════════════════════════
   LOGIN
═══════════════════════════════════════════════════════════════ */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: var(--bg0); }
.login-card { background: var(--bg1); border: 1px solid var(--border-md); border-radius: var(--r-lg); padding: 40px; width: 100%; max-width: 400px; }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.login-logo-title { font-size: 18px; font-weight: 400; color: var(--text1); }
.login-logo-title strong { color: var(--text0); font-weight: 700; }
.login-logo-sub { font-size: 11px; color: var(--text2); margin-top: 1px; }
.login-form .btn { margin-top: 6px; }

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD
═══════════════════════════════════════════════════════════════ */
.dash-body { min-height: 100vh; background: var(--bg0); }
.dash-nav {
  height: 54px; background: var(--bg1); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 14px;
}
.dash-nav__brand { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text1); font-weight: 500; }
.dash-nav__brand strong { color: var(--text0); }
.dash-nav__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.dash-nav__user { font-size: 12px; color: var(--text2); display: flex; align-items: center; gap: 6px; }
.dash-main { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }
.dash-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.dash-header h1 { font-size: 22px; font-weight: 600; }
.dash-header p { font-size: 12px; color: var(--text2); margin-top: 3px; }
.dash-empty { text-align: center; padding: 80px 20px; }
.dash-empty svg { color: var(--text2); opacity: 0.3; margin-bottom: 16px; }
.dash-empty h2 { font-size: 18px; margin-bottom: 8px; }
.dash-empty p { color: var(--text2); margin-bottom: 20px; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.project-card {
  background: var(--bg1); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px; transition: border-color .14s;
}
.project-card:hover { border-color: var(--border-md); }
.project-card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.project-mode-icon { font-size: 18px; }
.project-card__name { font-size: 14px; font-weight: 600; color: var(--text0); margin-bottom: 4px; }
.project-card__owner { font-size: 11px; color: var(--text2); margin-bottom: 3px; }
.project-card__date { font-size: 11px; color: var(--text2); margin-bottom: 12px; }
.project-card__actions { display: flex; gap: 6px; }

/* ═══════════════════════════════════════════════════════════════
   SPINNER
═══════════════════════════════════════════════════════════════ */
.spinner { width: 14px; height: 14px; border: 2px solid var(--border-md); border-top-color: var(--blue); border-radius: 50%; animation: spin .65s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state { display: flex; align-items: center; gap: 8px; color: var(--text2); padding: 16px 4px; font-size: 12px; }
