/* ============================================
   VARIABLES DE DISEÑO - SISTEMA REUTILIZABLE
   ============================================ */
:root {
  /* Colores Principales */
  --color-primary: #253758;
  --color-primary-dark: #282828;
  --color-primary-light: #3d5a7e;

  /* Colores de Estado */
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-info: #3b82f6;

  /* Colores Neutrales */
  --color-neutral: #6b7280;
  --color-neutral-light: #9ca3af;
  --color-neutral-dark: #4b5563;

  /* Fondos */
  --bg-primary: #f9fafb;
  --bg-secondary: #e3e6ed;
  --bg-surface: #ffffff;

  /* Textos */
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;

  /* Bordes */
  --border-color: #e5e7eb;
  --border-color-light: #f3f4f6;

  /* Bordes Redondeados */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.15);

  /* Transiciones */
  --transition-fast: all 0.15s ease;
  --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.5s ease;

  /* Espaciado */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 40px;

  /* Componentes Especi­ficos */
  --nav-width: 70px;
  --nav-bg: var(--bg-secondary);
  --header-height: 70px;
  --header-bg: var(--bg-surface);

  --nav-logo-bg: var(--color-primary);
  --nav-links-bg: var(--bg-secondary);
  --nav-footer-bg: var(--bg-secondary);
}

/* ============================================
   DARK MODE - VARIABLES
   Añadir después del bloque :root existente
   ============================================ */
html[data-theme="dark"] {
  /* Colores Principales - Mantener identidad */
  --color-primary: #698cb7;
  --color-primary-dark: #253758;
  --color-primary-light: #6789b6;

  /* Colores de Estado - Sin cambios */
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-info: #3b82f6;

  /* Colores Neutrales - Ajustados para dark */
  --color-neutral: #9ca3af;
  --color-neutral-light: #6b7280;
  --color-neutral-dark: #d1d5db;

  /* Fondos - Paleta oscura */
  --bg-primary: #1a1a1a;
  --bg-secondary: #d80427;
  --bg-surface: #212121;

  /* Textos - Invertidos */
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --text-inverse: #FFF;

  /* Bordes - Más oscuros */
  --border-color: #303030;
  --border-color-light: #353535;

  /* Sombras - Más sutiles en dark */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.6);

  /* Componentes Específicos */
  --nav-bg: var(--bg-secondary);
  --header-bg: var(--bg-surface);
  --nav-logo-bg: var(--color-primary-dark);
  --nav-links-bg: var(--bg-secondary);
  --nav-footer-bg: var(--bg-secondary);
}

/* ============================================
   DARK MODE - AJUSTES ESPECÍFICOS
   ============================================ */
html[data-theme="dark"] .admin-body {
  background: #1a1a1a;
}

html[data-theme="dark"] .admin-container {
  background: var(--bg-surface);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0);
}

html[data-theme="dark"] .admin-right {
  background: var(--bg-surface);
}

html[data-theme="dark"] .admin-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
}

html[data-theme="dark"] .admin-main {
  background: var(--bg-primary);
}

html[data-theme="dark"] .content-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
}

html[data-theme="dark"] .card-header {
  border-bottom: 1px solid var(--border-color);
}

html[data-theme="dark"] .header-action-btn {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

html[data-theme="dark"] .header-action-btn:hover {
  background: var(--bg-primary);
  border-color: var(--color-primary);
}

/* Tooltips en dark */
html[data-theme="dark"] .nav-icon::after {
  background: var(--bg-surface);
  color: var(--text-primary);
}

html[data-theme="dark"] .nav-icon::before {
  border-right-color: var(--bg-surface);
}

/* ============================================
     RESET
     ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  color: var(--text-primary);
  line-height: 1.5;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-headings);
}

/* ============================================
     LOGIN
     ============================================ */
body.text-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #253758 0%, #1a2a42 100%);
  padding: 20px;
}

.form-signin {
  max-width: 400px;
  padding: 40px;
  width: 100%;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.form-signin .form-floating:focus-within {
  z-index: 2;
}

.form-signin input[type="email"] {
  margin-bottom: -1px;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.form-signin input[type="password"] {
  margin-bottom: 10px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.logo {
  margin: 0 auto 40px auto;
  background: url(../img/logo.svg) center/contain no-repeat;
  width: 250px;
  height: 75px;
}

.btn-primary {
  background-color: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
  transition: var(--transition-base);
}

.btn-primary:hover {
  background-color: var(--color-primary-dark) !important;
  transform: translateY(-1px);
}

/* ============================================
     ADMIN PANEL - ESTRUCTURA
     ============================================ */

/* BODY FONDO GRIS */
.admin-body {
  background: #f8f9fa;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* WRAPPER FULL-WIDTH */
.admin-wrapper {
  width: 100%;
  min-height: 100vh;
  padding: 40px;
}

/* CONTENEDOR BLANCO CENTRADO */
.admin-container {
  max-width: 1150px;
  margin: 0 auto;
  background: white;
  border-radius: 24px;
  box-shadow: 50px 0px 90px rgba(0, 0, 0, 0.08);
  display: flex;
  overflow: hidden;
  /* CAMBIAR DE hidden A visible */
  min-height: calc(100vh - 160px);
  position: relative;
  /* AÃ±adir */
}


/* ============================================
     CONTENIDO DERECHA
     ============================================ */
.admin-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
  overflow: hidden;
  position: relative;
  /* AÃ±adir */
  z-index: 1;
  /* AÃ±adir - menor que el nav */
}

/* ============================================
     HEADER 70PX
     ============================================ */
.admin-header {
  height: 70px;
  padding: 0 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.page-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

.header-datetime {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}


.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-action-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-base);
  font-size: 1.1rem;
}

.header-action-btn:hover {
  background: var(--bg-primary);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

/* ============================================
     HEADER DINÁMICO - ESTILOS
     ============================================ */

/* Header con título e icono */
.header-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-icon {
  font-size: 1.4rem;
  color: var(--color-primary);
}

.header-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 2px;
}

/* Header en modo sección (no Dashboard) */
.admin-header.header-section .header-datetime {
  display: none;
}

.admin-header.header-section .header-title-group {
  gap: 15px;
}

.admin-header.header-section .page-title {
  font-size: 1.25rem;
}

/* Botón de acción principal (rojo) */
.header-action-primary {
  background: var(--color-danger) !important;
  border-color: var(--color-danger) !important;
  color: white !important;
}

.header-action-primary:hover {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Header en modo Dashboard */
.admin-header.header-dashboard .header-icon {
  display: none;
}

.admin-header.header-dashboard .header-subtitle {
  display: none;
}

/* ============================================
     CONTENIDO MAIN
     ============================================ */
.admin-main {
  flex: 1;
  padding: 0;
  background: var(--bg-surface);
  overflow-y: auto;
}

/* Contenedor de sección optimizado */
.section-container {
  padding: 30px 40px;
  min-height: 100%;
}

/* ============================================
     TABS
     ============================================ */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ============================================
     CONTENT CARDS
     ============================================ */
.content-card {
  background: white;
  border-radius: 16px;
  border: 1px solid #f3f4f6;
  overflow: hidden;
  margin-bottom: 30px;
}

.card-header {
  padding: 20px 25px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.card-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 25px;
}

/* ============================================
     UTILIDADES
     ============================================ */
.d-none {
  display: none !important;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-secondary);
}

/* ============================================
     RESPONSIVE
     ============================================ */
@media (max-width: 1024px) {
  .admin-wrapper {
    padding: 40px 15px;
  }

  .section-container {
    padding: 0;
  }
}

@media (max-width: 768px) {
  .admin-container {
    flex-direction: column;
  }

  .admin-nav {
    width: 100%;
    flex-direction: row;
    height: 70px;
  }

  .nav-logo {
    width: 70px;
  }

  .nav-links {
    flex-direction: row;
    padding: 0;
    justify-content: center;
  }

  .nav-logout {
    margin: 0 0 0 auto;
    margin-right: 10px;
  }

  .admin-header {
    flex-direction: column;
    height: auto;
    padding: 15px 20px;
    gap: 10px;
  }

  .header-user {
    width: 100%;
    justify-content: space-between;
  }

  .admin-main {
    padding: 30px 20px;
  }

  .section-container {
    padding: 0;
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 1.3rem;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-signin {
    margin: 20px !important;
  }
}



/* ============================================
     TOOLTIPS PERSONALIZADOS NAV
     ============================================ */
.nav-icon {
  position: relative;
}

.nav-icon::after {
  content: attr(title);
  position: absolute;
  left: 65px;
  top: 50%;
  transform: translateY(-50%);
  background: white;
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  pointer-events: none;
}

.nav-icon::before {
  content: '';
  position: absolute;
  left: 57px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 8px solid white;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 1001;
  pointer-events: none;
}

.nav-icon:hover::after,
.nav-icon:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Excluir tooltip en nav-logout si no quieres que aparezca */
.nav-logout::after,
.nav-logout::before {
  display: none;
}

html[data-theme="dark"] .page-title {
  color: var(--text-primary);
}

html[data-theme="dark"] .card-header h3 {
  color: var(--text-primary);
}

html[data-theme="dark"] .mobile-header-menu,
html[data-theme="dark"] .mobile-header-theme,
html[data-theme="dark"] .mobile-header-search {
  color: var(--text-primary);
}