/* ============================================================================
 *  Sistema DESTREZAS — assets/css/style.css
 *  Hoja de estilos maestra · Tokens de tema (claro/oscuro) · Mobile-First
 *  Replica EXACTA del diseño de los HTML modelo (teal/marino).
 *  Fase 1 — Esqueleto visual compartido
 * ============================================================================ */

/* ---------------------------------------------------------------------------
 * 1) TOKENS DE COLOR — TEMA CLARO (por defecto)
 *    Mismos valores que los HTML modelo.
 * ------------------------------------------------------------------------- */
:root,
[data-theme="light"] {
  --bg:        #F4F6FA;
  --surface:   #FFFFFF;
  --text:      #1F2937;
  --text2:     #6B7280;
  --border:    #EAECEF;
  --hover:     #F4F6FA;
  --sidebar:   #16213E;
  --sb-text:   #AEB8CC;
  --sb-hover:  #22315A;
  --topbar:    #FFFFFF;
  --shadow:    0 1px 3px rgba(16,24,40,.07), 0 1px 2px rgba(16,24,40,.04);

  /* Marca */
  --teal:      #0DCAA8;
  --teal-2:    #00B894;
  --navy:      #16213E;
  --navy-2:    #1B2A4A;

  /* Estados */
  --success:   #10B981;
  --warning:   #F59E0B;
  --danger:    #EF4444;
  --info:      #0EA5E9;
  --muted:     #5B6B8C;
}

/* ---------------------------------------------------------------------------
 * 2) TOKENS DE COLOR — TEMA OSCURO
 * ------------------------------------------------------------------------- */
[data-theme="dark"] {
  --bg:        #0B1220;
  --surface:   #16213E;
  --text:      #F1F5F9;
  --text2:     #94A3B8;
  --border:    #243049;
  --hover:     #1E2A45;
  --sidebar:   #0E1830;
  --sb-text:   #AEB8CC;
  --sb-hover:  #1E2A45;
  --topbar:    #16213E;
  --shadow:    0 1px 3px rgba(0,0,0,.35);
}

/* ---------------------------------------------------------------------------
 * 3) RESET Y BASE
 * ------------------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .25s ease, color .25s ease;
}

a { color: inherit; }
img { max-width: 100%; }

/* Scrollbar discreta acorde al tema */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--text2); }
::-webkit-scrollbar-track { background: transparent; }

/* Animación flotante (usada en login y badges) */
@keyframes flo { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes dzfade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------------------
 * 4) LAYOUT MAESTRO
 * ------------------------------------------------------------------------- */
.dz-app {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.dz-main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dz-content {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: dzfade .25s ease;
}

/* ---------------------------------------------------------------------------
 * 5) SIDEBAR (264px) — idéntico a los HTML
 * ------------------------------------------------------------------------- */
.dz-sidebar {
  width: 264px;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 40;
}

.dz-sb-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
}
.dz-sb-logo {
  width: 42px; height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--teal), var(--teal-2));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 18px rgba(13,202,168,.4);
}
.dz-sb-logo i { color: #fff; font-size: 22px; }
.dz-sb-name { color: #fff; font-weight: 800; font-size: 17px; letter-spacing: -.3px; }
.dz-sb-tag  { color: var(--teal); font-weight: 700; font-size: 10px; letter-spacing: 1.3px; }

.dz-nav { flex: 1; overflow-y: auto; padding: 4px 12px 24px; }
.dz-nav-sec {
  padding: 16px 12px 8px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 1.4px;
  color: var(--muted);
}

.dz-nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  margin-bottom: 3px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 14px; font-weight: 600;
  color: var(--sb-text);
  border-left: 3px solid transparent;
  transition: background .16s ease, color .16s ease;
}
.dz-nav-link i { width: 20px; text-align: center; font-size: 16px; }
.dz-nav-link:hover { background: var(--sb-hover); color: #fff; }

.dz-nav-link.active {
  color: #fff;
  font-weight: 700;
  background: rgba(13,202,168,.16);
  border-left: 3px solid var(--teal);
  padding-left: 9px;
}
.dz-nav-link.active i { color: var(--teal); }

/* ---------------------------------------------------------------------------
 * 6) TOPBAR (66px) — idéntico a los HTML
 * ------------------------------------------------------------------------- */
.dz-topbar {
  height: 66px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--topbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
}

.dz-burger {
  display: none;
  align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border: none; border-radius: 10px;
  background: var(--hover); color: var(--text);
  cursor: pointer; font-size: 18px;
}

.dz-search {
  display: flex; align-items: center; gap: 10px;
  background: var(--hover);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 9px 14px;
  width: 340px; max-width: 34vw;
}
.dz-search input {
  border: none; background: transparent; outline: none;
  width: 100%; font-family: inherit; font-size: 13.5px; color: var(--text);
}

.dz-icon-btn {
  position: relative;
  width: 40px; height: 40px;
  border: none; border-radius: 10px;
  background: var(--hover); color: var(--text);
  cursor: pointer; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .16s ease;
}
.dz-icon-btn:hover { background: var(--border); }

.dz-badge-count {
  position: absolute; top: 6px; right: 6px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.dz-btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--teal), var(--teal-2));
  color: #fff; text-decoration: none; border: none;
  font-weight: 700; font-size: 13.5px;
  padding: 10px 16px; border-radius: 11px;
  box-shadow: 0 8px 16px rgba(13,202,168,.32);
  cursor: pointer; font-family: inherit;
}
.dz-btn-primary:hover { filter: brightness(1.03); }

.dz-user { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.dz-avatar {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--teal), var(--teal-2));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
}

/* Menú desplegable del usuario */
.dz-user-menu {
  position: absolute; top: 60px; right: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 8px;
  min-width: 210px;
  display: none;
  z-index: 50;
  animation: dzfade .15s ease;
}
.dz-user-menu.open { display: block; }
.dz-user-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  text-decoration: none; font-size: 13.5px; font-weight: 600;
  color: var(--text);
}
.dz-user-menu a:hover { background: var(--hover); }
.dz-user-menu a.danger { color: var(--danger); }
.dz-user-menu hr { border: none; border-top: 1px solid var(--border); margin: 6px 0; }

.dz-divider-v { width: 1px; height: 30px; background: var(--border); }

/* ---------------------------------------------------------------------------
 * 7) ENCABEZADO DE PÁGINA, TARJETAS Y FOOTER
 * ------------------------------------------------------------------------- */
.dz-page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
}
.dz-page-head h1 {
  margin: 0; font-size: 25px; font-weight: 800;
  letter-spacing: -.5px; color: var(--text);
}
.dz-page-head p {
  margin: 5px 0 0; font-size: 14px; color: var(--text2); font-weight: 500;
}

.dz-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.dz-footer {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
  padding: 8px 4px 4px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
  font-size: 12.5px; color: var(--text2);
}
.dz-footer strong { color: var(--text); }

/* ---------------------------------------------------------------------------
 * 8) BADGES DE ESTADO (mismos colores que los HTML)
 * ------------------------------------------------------------------------- */
.dz-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 700; font-size: 12px;
  padding: 4px 10px; border-radius: 9px;
}
.dz-badge.success  { background: rgba(16,185,129,.13); color: var(--success); }
.dz-badge.warning  { background: rgba(245,158,11,.14);  color: var(--warning); }
.dz-badge.danger   { background: rgba(239,68,68,.13);   color: var(--danger); }
.dz-badge.info     { background: rgba(14,165,233,.13);  color: var(--info); }
.dz-badge.secondary{ background: rgba(107,114,128,.14); color: var(--text2); }

/* Botón secundario / contorno reutilizable */
.dz-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-weight: 700; font-size: 13.5px;
  padding: 10px 16px; border-radius: 11px; cursor: pointer; font-family: inherit;
  text-decoration: none; transition: background .16s ease;
}
.dz-btn:hover { background: var(--hover); }

.dz-backdrop { display: none; }

.dz-hide-sm { display: initial; }

/* ---------------------------------------------------------------------------
 * 9) RESPONSIVE — MOBILE-FIRST (la app se ve como móvil en pantallas chicas)
 *    Idéntico a los breakpoints de los HTML modelo.
 * ------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .dz-charts, .dz-lists, .dz-row2 { flex-direction: column !important; }
  .dz-col { width: 100% !important; flex: 1 1 auto !important; }
}
@media (max-width: 980px) {
  .dz-kpis { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 760px) {
  .dz-mini, .dz-ter { grid-template-columns: repeat(2, 1fr) !important; }
  .dz-sidebar {
    position: fixed !important; top: 0; left: 0; z-index: 60;
    transform: translateX(-100%); transition: transform .26s ease;
  }
  .dz-sidebar.open { transform: translateX(0); }
  .dz-burger { display: inline-flex !important; }
  .dz-search { display: none !important; }
  .dz-backdrop.open {
    display: block; position: fixed; inset: 0;
    background: rgba(8,12,24,.45); z-index: 55;
  }
  .dz-hide-sm { display: none !important; }
  .dz-content { padding: 16px; }
}
@media (max-width: 480px) {
  .dz-kpis, .dz-mini, .dz-ter { grid-template-columns: 1fr !important; }
}

/* ---------------------------------------------------------------------------
 * 10) OVERRIDES DE LIBRERÍAS (tema oscuro/claro coherente)
 *     Select2, DataTables y Toastify deben respetar el tema.
 * ------------------------------------------------------------------------- */

/* Select2 */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  background: var(--surface) !important;
  border: 1.5px solid var(--border) !important;
  border-radius: 11px !important;
  min-height: 44px !important;
  color: var(--text) !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text) !important; line-height: 42px !important; padding-left: 12px !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 42px !important; }
.select2-dropdown {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background: var(--teal) !important; color: #fff !important;
}
.select2-search--dropdown .select2-search__field {
  background: var(--bg) !important; border: 1px solid var(--border) !important; color: var(--text) !important;
}

/* DataTables */
table.dataTable { color: var(--text) !important; border-color: var(--border) !important; }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: var(--surface) !important; border: 1px solid var(--border) !important;
  border-radius: 9px !important; color: var(--text) !important; padding: 6px 10px !important;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate .paginate_button { color: var(--text2) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--teal) !important; color: #fff !important; border-radius: 8px !important; border: none !important;
}
table.dataTable thead th { border-bottom: 1px solid var(--border) !important; color: var(--text2) !important; }
table.dataTable tbody td { border-top: 1px solid var(--border) !important; }
.dt-buttons .dt-button {
  background: var(--surface) !important; border: 1px solid var(--border) !important;
  color: var(--text) !important; border-radius: 9px !important; font-size: 12.5px !important;
}

/* Toastify (toasts) */
.toastify {
  border-radius: 12px !important; font-family: inherit !important; font-weight: 600 !important;
  box-shadow: var(--shadow) !important;
}

/* SweetAlert2 acorde al tema */
.swal2-popup { border-radius: 18px !important; font-family: inherit !important; }

/* Inputs base de formularios del sistema */
.dz-field {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
}
.dz-field:focus-within { border-color: var(--teal); }
.dz-field input, .dz-field select, .dz-field textarea {
  flex: 1; border: none; background: transparent; outline: none;
  font-family: inherit; font-size: 14px; color: var(--text);
}
.dz-label { font-size: 12.5px; font-weight: 700; color: var(--text); }

/* Utilidades */
.dz-spin { animation: rot 1s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
