/**
 * assets/css/base.css
 * Reset, tipografía base y estilos globales del CRM.
 * Depende de: variables.css
 */

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

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

body {
  font-family:      var(--font-body);
  font-size:        var(--text-base);
  font-weight:      var(--weight-normal);
  line-height:      1.6;
  color:            var(--color-text);
  background-color: var(--color-bg);
  min-height:       100vh;
  overflow-x:       hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl);  }
h4 { font-size: var(--text-lg);  }
h5 { font-size: var(--text-base);}
h6 { font-size: var(--text-sm);  }

p {
  line-height: 1.7;
  color: var(--color-text-muted);
}

a {
  color:           var(--color-accent);
  text-decoration: none;
  transition:      color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-dark);
}

/* ── Texto de ayuda ──────────────────────────────────────────────────────── */
.text-muted  { color: var(--color-text-muted) !important; }
.text-dim    { color: var(--color-text-dim)   !important; }
.text-accent { color: var(--color-accent)     !important; }
.text-danger { color: var(--color-danger)     !important; }
.text-warn   { color: var(--color-warning)    !important; }
.text-info   { color: var(--color-info)       !important; }

.text-sm  { font-size: var(--text-sm) !important; }
.text-xs  { font-size: var(--text-xs) !important; }
.text-lg  { font-size: var(--text-lg) !important; }

.fw-medium { font-weight: var(--weight-medium) !important; }
.fw-semi   { font-weight: var(--weight-semi)   !important; }
.fw-bold   { font-weight: var(--weight-bold)   !important; }

/* ── Scrollbar personalizada ──────────────────────────────────────────────── */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: var(--color-primary); }
::-webkit-scrollbar-thumb  { background: var(--color-border);  border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-border-light); }

/* ── Selección de texto ───────────────────────────────────────────────────── */
::selection {
  background-color: var(--color-accent-glow);
  color:            var(--color-text);
}

/* ── Focus visible accesible ──────────────────────────────────────────────── */
:focus-visible {
  outline:        2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ── Imágenes responsivas ─────────────────────────────────────────────────── */
img {
  max-width: 100%;
  height:    auto;
  display:   block;
}

/* ── Utilidades de espaciado ──────────────────────────────────────────────── */
.mt-4     { margin-top: var(--space-4) !important; }
.mt-auto  { margin-top: auto !important; }
.mb-auto  { margin-bottom: auto !important; }
.mb-4     { margin-bottom: var(--space-4) !important; }
.mb-6     { margin-bottom: var(--space-6) !important; }
.p-4      { padding: var(--space-4) !important; }
.px-6     { padding-left: var(--space-6) !important; padding-right: var(--space-6) !important; }
.py-4     { padding-top: var(--space-4) !important; padding-bottom: var(--space-4) !important; }
.p-8      { padding: var(--space-8) !important; }
.pl-10    { padding-left: var(--space-10) !important; }
.gap-1    { gap: var(--space-1) !important; }
.gap-2    { gap: var(--space-2) !important; }
.gap-3    { gap: var(--space-3) !important; }
.gap-4    { gap: var(--space-4) !important; }
.text-center { text-align: center !important; }
.text-right  { text-align: right !important; }
.pos-relative { position: relative !important; }
.pos-absolute { position: absolute !important; }
.d-none       { display: none !important; }
.d-flex       { display: flex !important; }
.flex-column  { flex-direction: column !important; }
.flex-between-wrap { display: flex !important; justify-content: space-between !important; align-items: center !important; flex-wrap: wrap !important; gap: var(--space-3) !important; }

/* ── Layout & Borders ────────────────────────────────────────────────────── */
.overflow-x-auto { overflow-x: auto !important; }
.border-top   { border-top: 1px solid var(--color-border) !important; }

/* ── Utilidades de texto ─────────────────────────────────────────────────── */
.text-right   { text-align: right !important; }
.text-left    { text-align: left !important; }

/* ── Utilidades de color ─────────────────────────────────────────────────── */
.text-accent  { color: var(--color-accent) !important; }
.text-success { color: var(--color-success) !important; }
.text-danger  { color: var(--color-danger) !important; }
.text-purple  { color: var(--color-purple) !important; }

/* ── Ocultar visualmente (accesible) ─────────────────────────────────────── */
.sr-only {
  position: absolute;
  width:    1px;
  height:   1px;
  padding:  0;
  margin:   -1px;
  overflow: hidden;
  clip:     rect(0,0,0,0);
  border:   0;
}

/* ── Truncar texto ────────────────────────────────────────────────────────── */
.text-truncate {
  overflow:      hidden;
  text-overflow: ellipsis;
  white-space:   nowrap;
}

/* ── Divisor ──────────────────────────────────────────────────────────────── */
.divider {
  border:  none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-4) 0;
}

/* ── Loading state ────────────────────────────────────────────────────────── */
.loading-overlay {
  position:   fixed;
  inset:      0;
  background: rgba(2, 6, 23, 0.8);
  display:    flex;
  align-items:    center;
  justify-content:center;
  z-index:    var(--z-overlay);
}
 
 . j s o n - p r e v i e w   {   b a c k g r o u n d :   v a r ( - - c o l o r - s e c o n d a r y ) ;   p a d d i n g :   v a r ( - - s p a c e - 3 ) ;   b o r d e r - r a d i u s :   v a r ( - - r a d i u s - m d ) ;   f o n t - s i z e :   1 0 p x ;   m a x - h e i g h t :   1 2 0 p x ;   o v e r f l o w - y :   a u t o ;   c o l o r :   v a r ( - - c o l o r - t e x t ) ;   }  
 . j s o n - t e x t a r e a   {   h e i g h t :   1 5 0 p x   ! i m p o r t a n t ;   f o n t - f a m i l y :   m o n o s p a c e ;   f o n t - s i z e :   1 2 p x   ! i m p o r t a n t ;   }  
 