/* ═══════════════════════════════════════════════════
   katva-design.css — Diseño global KATVA CRM v427

   Corrige y estandariza:
   ✓ Emil Kowalski — transiciones específicas (no `all`)
   ✓ Animación fadeUp en todos los módulos
   ✓ Table row hover universal
   ✓ Button press feedback (.btn:active)
   ✓ Card hover lift en KPIs y cards
   ✓ Tipografía Plus Jakarta Sans en títulos
   ✓ prefers-reduced-motion respetado

   Cargado DESPUÉS del <style> inline de cada página
   → gana en cascade sin necesitar !important.
═══════════════════════════════════════════════════ */

/* ── VARIABLES DE TIMING (fallback global) ── */
:root {
  --t:        180ms cubic-bezier(.23,1,.32,1);
  --t-slow:   320ms cubic-bezier(.23,1,.32,1);
  --t-spring: cubic-bezier(.23,1,.32,1);
  --t-fast:   100ms cubic-bezier(.23,1,.32,1);
}

/* ═══════════════════════════════════════════════════
   ANIMACIONES
═══════════════════════════════════════════════════ */

/* Keyframe global fadeUp (override de definiciones inline) */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Entrada de contenido principal — aplica a módulos que lo tenían y a los que faltaba */
.content {
  animation: fadeUp 300ms cubic-bezier(.23,1,.32,1) both;
}

/* ═══════════════════════════════════════════════════
   BOTONES — Emil Kowalski: transición específica + press
═══════════════════════════════════════════════════ */

/* Reemplaza transition:all con propiedades exactas (anti-pattern fix) */
.btn {
  transition: transform 160ms cubic-bezier(.23,1,.32,1),
              background 160ms ease,
              box-shadow 160ms ease,
              opacity 160ms ease,
              color 160ms ease,
              border-color 160ms ease;
}

/* Press feedback */
.btn:active {
  transform: scale(.97);
  transition-duration: 100ms;
}

/* Botón destructivo */
.btnd {
  transition: transform 160ms cubic-bezier(.23,1,.32,1),
              background 160ms ease,
              border-color 160ms ease,
              color 160ms ease;
}
.btnd:active {
  transform: scale(.97);
  transition-duration: 100ms;
}

/* ═══════════════════════════════════════════════════
   INPUTS Y SELECTORES — transición específica
═══════════════════════════════════════════════════ */

.fi,
.fimod,
.qinp {
  transition: border-color 160ms ease,
              box-shadow 160ms ease,
              background 160ms ease;
}

.sel {
  transition: border-color 160ms ease,
              background 160ms ease,
              color 160ms ease;
}

/* ═══════════════════════════════════════════════════
   KPIs Y CARDS — hover lift (desktop)
═══════════════════════════════════════════════════ */

@media (min-width: 769px) {
  .kpi {
    transition: transform 200ms cubic-bezier(.23,1,.32,1),
                box-shadow 200ms ease;
  }
  .kpi:hover {
    transform: translateY(-2px);
    box-shadow: var(--sh-md, 0 8px 24px rgba(0,0,0,.12));
  }

  .mon-card {
    transition: transform 200ms cubic-bezier(.23,1,.32,1),
                box-shadow 200ms ease;
  }
  .mon-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sh-md, 0 8px 24px rgba(0,0,0,.12));
  }

  .hoy-card {
    transition: transform 200ms cubic-bezier(.23,1,.32,1),
                box-shadow 200ms ease;
  }
  .hoy-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sh-md, 0 8px 24px rgba(0,0,0,.12));
  }

  /* Cards genéricas */
  .card {
    transition: transform 200ms cubic-bezier(.23,1,.32,1),
                box-shadow 200ms ease;
  }
  .card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sh-md, 0 8px 24px rgba(0,0,0,.12));
  }
}

/* ═══════════════════════════════════════════════════
   TABLAS — row hover universal (desktop)
═══════════════════════════════════════════════════ */

@media (min-width: 769px) {
  tbody tr {
    transition: background 140ms ease;
  }

  tbody tr:hover td,
  tbody tr:hover th {
    background: var(--bg, #F4F5F8);
  }
}

/* ═══════════════════════════════════════════════════
   TIPOGRAFÍA — Plus Jakarta Sans en elementos clave
═══════════════════════════════════════════════════ */

/* Títulos de topbar (distintas clases usadas en distintas páginas) */
.tbtitle,
.topbar-title h1,
.topbar-title h2,
.tb-title,
.tbl-top-title,
.sb-word {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ═══════════════════════════════════════════════════
   SCROLLBARS — estilo global
═══════════════════════════════════════════════════ */

.content,
.nav,
.col-body,
.modal,
.ov,
.sidebar {
  scrollbar-width: thin;
  scrollbar-color: var(--brd2, rgba(0,0,0,.12)) transparent;
}

/* ═══════════════════════════════════════════════════
   SIDEBAR / NAV — transición específica
═══════════════════════════════════════════════════ */

.ni,
.nav-item {
  transition: background 140ms ease,
              color 140ms ease;
}

/* Sidebar icons — blanco solo en la sección activa */
.ni.on i {
  color: #fff;
}

/* ═══════════════════════════════════════════════════
   CUSTOM SELECT ARROW — spring easing
═══════════════════════════════════════════════════ */

.ksel-trigger .ksel-arrow {
  transition: transform 200ms cubic-bezier(.23,1,.32,1);
}

/* ═══════════════════════════════════════════════════
   REDUCED MOTION — accesibilidad
═══════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════
   TOAST — diseño premium KATVA (aplica a todas las páginas)
═══════════════════════════════════════════════════ */

.toastx {
  background: var(--surface) !important;
  border: .5px solid var(--brd) !important;
  border-left: 3.5px solid var(--burg) !important;
  border-radius: 10px !important;
  padding: 12px 16px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.18) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--txt) !important;
  gap: 10px !important;
}

.toastx i {
  font-size: 16px !important;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════
   MOBILE WHITE BAR FIX — aplica a TODAS las páginas
   Elimina la franja blanca en la parte inferior móvil
═══════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .app {
    height: 100dvh !important;
    overflow: hidden !important;
  }
  .main {
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
  }
  .content {
    flex: 1 !important;
    overflow-y: auto !important;
    min-height: 0 !important;
  }
}

/* iOS Safari: 100dvh no respeta la barra inferior del browser.
   -webkit-fill-available cubre exactamente el viewport visible. */
@supports (-webkit-touch-callout: none) {
  .app {
    height: -webkit-fill-available !important;
    min-height: -webkit-fill-available !important;
  }
  html, body {
    height: -webkit-fill-available !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .content {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .kpi,
  .kpi:hover,
  .mon-card,
  .mon-card:hover,
  .hoy-card,
  .hoy-card:hover,
  .card,
  .card:hover {
    transform: none;
    transition: none;
  }

  .btn,
  .btnd,
  .fi,
  .sel {
    transition: none;
  }
}
