/* =============================================================================
   base.css — Variables CSS, reset, tipografía y tokens de diseño
   SGSI-Proyectos · A LA PAR
   Fuente de tokens: CONTEXTO_IA.md §2 + sgsi_demo_alapar_v4_5.html
   ============================================================================= */

/* ---------------------------------------------------------------------------
   Importar tipografías (DT-UI-003)
   --------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---------------------------------------------------------------------------
   Tokens de diseño (DT-UI-002)
   --------------------------------------------------------------------------- */
:root {
  /* Colores primarios A LA PAR */
  --teal:        #2e99a1;
  --teal-dark:   #1e6e75;
  --teal-xdark:  #0f4a50;
  --teal-light:  #e1f5ee;
  --teal-mid:    #9fe1cb;

  /* Colores de estado */
  --green:       #059669;
  --green-light: #d1fae5;
  --amber:       #d97706;
  --amber-light: #fef3c7;
  --red:         #dc2626;
  --red-light:   #fee2e2;
  --blue:        #2563eb;
  --blue-light:  #dbeafe;
  --purple:      #7c3aed;
  --purple-light:#ede9fe;

  /* Texto */
  --text:        #1a1a2e;
  --text-muted:  #595970;
  --text-hint:   #9494aa;

  /* Superficies */
  --surface:     #ffffff;
  --surface-2:   #f8fafb;
  --bg:          #f0f4f5;

  /* Bordes */
  --border:      rgba(46, 153, 161, 0.14);
  --border-md:   rgba(46, 153, 161, 0.25);

  /* Radios */
  --r:           8px;
  --rl:          14px;

  /* Sombras */
  --shadow-sm:   0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:   0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:   0 10px 28px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.06);

  /* Tipografía */
  --font-base:   'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', monospace;

  /* Sidebar */
  --sidebar-w:   224px;
  --topbar-h:    54px;
}

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

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

body {
  font-family: var(--font-base);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--teal);
  text-decoration: none;
}
a:hover {
  color: var(--teal-dark);
  text-decoration: underline;
}

img, svg {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

ul, ol {
  list-style: none;
}

/* ---------------------------------------------------------------------------
   Tipografía
   --------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
}

/* ---------------------------------------------------------------------------
   Formularios base
   --------------------------------------------------------------------------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.form-input {
  padding: 9px 12px;
  border: 1.5px solid var(--border-md);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  width: 100%;
}

.form-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(46, 153, 161, .15);
}

.form-input::placeholder {
  color: var(--text-hint);
}

.form-input.error {
  border-color: var(--red);
}

.form-hint {
  font-size: 11px;
  color: var(--text-hint);
}

.form-error {
  font-size: 12px;
  color: var(--red);
}

/* ---------------------------------------------------------------------------
   Botones
   --------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, opacity .15s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

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

.btn-primary {
  background: var(--teal);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--teal-dark);
  color: #fff;
  text-decoration: none;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-md);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg);
  text-decoration: none;
}

.btn-danger {
  background: var(--red-light);
  color: var(--red);
}
.btn-danger:hover:not(:disabled) {
  background: var(--red);
  color: #fff;
  text-decoration: none;
}

.btn-full {
  width: 100%;
}

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

/* ---------------------------------------------------------------------------
   Alertas / banners
   --------------------------------------------------------------------------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r);
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-error {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid rgba(220,38,38,.2);
}

.alert-success {
  background: var(--green-light);
  color: var(--green);
  border: 1px solid rgba(5,150,105,.2);
}

.alert-info {
  background: var(--teal-light);
  color: var(--teal-dark);
  border: 1px solid var(--border-md);
}

.alert-warning {
  background: var(--amber-light);
  color: var(--amber);
  border: 1px solid rgba(217,119,6,.2);
}

/* ---------------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  box-shadow: var(--shadow-sm);
}

.card-body {
  padding: 20px;
}

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

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* ---------------------------------------------------------------------------
   Badges
   --------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green   { background: var(--green-light);  color: var(--green); }
.badge-amber   { background: var(--amber-light);  color: var(--amber); }
.badge-red     { background: var(--red-light);    color: var(--red); }
.badge-teal    { background: var(--teal-light);   color: var(--teal-dark); }
.badge-blue    { background: var(--blue-light);   color: var(--blue); }
.badge-purple  { background: var(--purple-light); color: var(--purple); }
.badge-gray    { background: var(--surface-2);    color: var(--text-muted); border: 1px solid var(--border-md); }

/* ---------------------------------------------------------------------------
   Utilidades
   --------------------------------------------------------------------------- */
.text-muted   { color: var(--text-muted); }
.text-hint    { color: var(--text-hint); }
.text-teal    { color: var(--teal); }
.text-green   { color: var(--green); }
.text-red     { color: var(--red); }
.text-amber   { color: var(--amber); }
.mono         { font-family: var(--font-mono); }
.fw-600       { font-weight: 600; }
.fw-500       { font-weight: 500; }
.fs-12        { font-size: 12px; }
.fs-11        { font-size: 11px; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.mb-16        { margin-bottom: 16px; }
