/* ==========================================================================
   BIBLIOTECA CENTRAL - SISTEMA DE DISEÑO Y HOJA DE ESTILOS CSS3
   Paleta: #14213D (Azul Oscuro), #3563E9 (Azul Principal), #FFFFFF, #F4F6FA
   ========================================================================== */

:root {
  /* Paleta Oficial Requerida */
  --color-primary-dark: #14213D;
  --color-primary: #3563E9;
  --color-primary-hover: #274dc4;
  --color-primary-light: #EEF2FF;
  --color-primary-glow: rgba(53, 99, 233, 0.18);

  --color-white: #FFFFFF;
  --color-bg: #F4F6FA;
  --color-surface: #FFFFFF;
  --color-surface-hover: #F8FAFC;

  /* Colores Semánticos */
  --color-success: #10B981;
  --color-success-bg: #ECFDF5;
  --color-success-text: #065F46;

  --color-danger: #EF4444;
  --color-danger-bg: #FEF2F2;
  --color-danger-text: #991B1B;

  --color-warning: #F59E0B;
  --color-warning-bg: #FFFBEB;
  --color-warning-text: #92400E;

  --color-info: #0284C7;
  --color-info-bg: #F0F9FF;
  --color-info-text: #075985;

  /* Escala Neutra */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  --border-color: #E2E8F0;
  --border-light: #F1F5F9;

  /* Dimensiones y Sombras */
  --sidebar-width: 270px;
  --header-height: 72px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);

  --transition-fast: 0.18s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--color-bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Tipografía */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-primary-dark);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

p {
  color: var(--text-secondary);
}

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

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

/* LAYOUT PRINCIPAL */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* SIDEBAR DE NAVEGACIÓN */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--color-primary-dark);
  color: var(--color-white);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-normal);
  box-shadow: 4px 0 24px rgba(10, 18, 34, 0.15);
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary), #60a5fa);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  box-shadow: 0 4px 12px rgba(53, 99, 233, 0.35);
  flex-shrink: 0;
}

.brand-text h2 {
  color: var(--color-white);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.brand-text span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #94A3B8;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748B;
  padding: 12px 12px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: #CBD5E1;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  user-select: none;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--color-white);
}

.nav-link.active {
  background-color: var(--color-primary);
  color: var(--color-white);
  box-shadow: 0 4px 14px rgba(53, 99, 233, 0.38);
}

.nav-link svg, .nav-link i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  background-color: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
}

.nav-link.active .nav-badge {
  background-color: rgba(255, 255, 255, 0.28);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.12);
}

.user-quick-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-md);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #3B82F6, #1D4ED8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.user-info-text {
  overflow: hidden;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.72rem;
  color: #94A3B8;
}

/* ÁREA DE CONTENIDO PRINCIPAL */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* HEADER SUPERIOR */
.top-header {
  height: var(--header-height);
  background-color: var(--color-white);
  border-bottom: 1px solid var(--border-color);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.menu-toggle-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.page-title-box h1 {
  font-size: 1.35rem;
  font-weight: 800;
}

.page-title-box p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-search {
  position: relative;
  width: 280px;
}

.header-search input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1px solid var(--border-color);
  background-color: var(--color-bg);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.88rem;
  transition: all var(--transition-fast);
}

.header-search input:focus {
  outline: none;
  border-color: var(--color-primary);
  background-color: var(--color-white);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.header-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.action-btn-circle {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background-color: var(--color-white);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

.action-btn-circle:hover {
  background-color: var(--color-bg);
  color: var(--color-primary);
  border-color: #CBD5E1;
}

.notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 9px;
  height: 9px;
  border-radius: var(--radius-full);
  background-color: var(--color-danger);
  border: 2px solid white;
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--color-white);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-profile-btn:hover {
  background-color: var(--color-bg);
  border-color: #CBD5E1;
}

/* CONTENEDOR DE VISTAS */
.content-body {
  flex: 1;
  padding: 30px 32px 50px;
}

.view-section {
  display: none;
  animation: fadeIn 0.22s ease-out;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* TARJETAS ESTADÍSTICAS DEL DASHBOARD */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #CBD5E1;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.stat-card.primary::after { background-color: var(--color-primary); }
.stat-card.success::after { background-color: var(--color-success); }
.stat-card.warning::after { background-color: var(--color-warning); }
.stat-card.danger::after { background-color: var(--color-danger); }
.stat-card.info::after { background-color: var(--color-info); }
.stat-card.dark::after { background-color: var(--color-primary-dark); }

.stat-info .stat-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.stat-info .stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--color-primary-dark);
  line-height: 1.1;
}

.stat-info .stat-subtext {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.primary { background-color: var(--color-primary-light); color: var(--color-primary); }
.stat-icon.success { background-color: var(--color-success-bg); color: var(--color-success); }
.stat-icon.warning { background-color: var(--color-warning-bg); color: var(--color-warning); }
.stat-icon.danger { background-color: var(--color-danger-bg); color: var(--color-danger); }
.stat-icon.info { background-color: var(--color-info-bg); color: var(--color-info); }
.stat-icon.dark { background-color: #E2E8F0; color: var(--color-primary-dark); }

/* GRID DE GRÁFICOS */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 28px;
}

.chart-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.chart-title h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.chart-title p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.chart-body {
  position: relative;
  flex: 1;
  min-height: 280px;
  max-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ALERTAS Y ACCIONES RÁPIDAS */
.dashboard-extra-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.widget-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

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

.widget-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.widget-title h3 {
  font-size: 1.02rem;
  font-weight: 700;
}

/* LISTAS DE ALERTAS */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.86rem;
}

.alert-item.danger {
  background-color: var(--color-danger-bg);
  border-color: #FECACA;
  color: var(--color-danger-text);
}

.alert-item.warning {
  background-color: var(--color-warning-bg);
  border-color: #FDE68A;
  color: var(--color-warning-text);
}

.alert-item-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-item-action {
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* ACCIONES RÁPIDAS */
.quick-actions-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.quick-action-btn {
  background: var(--color-surface-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.86rem;
}

.quick-action-btn:hover {
  background-color: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.quick-action-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-white);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

/* BOTONES GLOBALES */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  box-shadow: 0 4px 12px rgba(53, 99, 233, 0.32);
}

.btn-secondary {
  background-color: var(--color-white);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background-color: var(--color-bg);
  border-color: #CBD5E1;
  color: var(--text-primary);
}

.btn-success {
  background-color: var(--color-success);
  color: var(--color-white);
}

.btn-success:hover {
  background-color: #059669;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.32);
}

.btn-danger {
  background-color: var(--color-danger);
  color: var(--color-white);
}

.btn-danger:hover {
  background-color: #DC2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.32);
}

.btn-dark {
  background-color: var(--color-primary-dark);
  color: var(--color-white);
}

.btn-dark:hover {
  background-color: #0A1224;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-xs {
  padding: 4px 8px;
  font-size: 0.72rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* BARRA DE HERRAMIENTAS Y FILTROS */
.toolbar-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.toolbar-search {
  flex: 1;
  min-width: 240px;
  max-width: 420px;
  position: relative;
}

.toolbar-search input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  background-color: var(--color-bg);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.toolbar-search input:focus {
  outline: none;
  border-color: var(--color-primary);
  background-color: var(--color-white);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.toolbar-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  width: 16px;
  height: 16px;
}

.toolbar-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.select-filter {
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--color-white);
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  min-width: 150px;
  transition: border-color var(--transition-fast);
}

.select-filter:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* TABLAS MODERNAS */
.table-container {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.custom-table thead {
  background-color: #F8FAFC;
  border-bottom: 1px solid var(--border-color);
}

.custom-table th {
  padding: 14px 18px;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
}

.custom-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text-secondary);
}

.custom-table tbody tr {
  transition: background-color var(--transition-fast);
}

.custom-table tbody tr:hover {
  background-color: #F8FAFC;
}

.custom-table tbody tr:last-child td {
  border-bottom: none;
}

/* DETALLE DE LIBRO EN TABLA */
.book-table-item {
  display: flex;
  align-items: center;
  gap: 14px;
}

.book-thumb {
  width: 44px;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  box-shadow: var(--shadow-sm);
  background-color: #E2E8F0;
  flex-shrink: 0;
}

.book-details {
  display: flex;
  flex-direction: column;
}

.book-title-cell {
  font-weight: 700;
  color: var(--color-primary-dark);
  font-size: 0.92rem;
  line-height: 1.25;
}

.book-meta-cell {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
}

/* BADGES / ETIQUETAS */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.badge-success { background-color: var(--color-success-bg); color: var(--color-success-text); }
.badge-danger { background-color: var(--color-danger-bg); color: var(--color-danger-text); }
.badge-warning { background-color: var(--color-warning-bg); color: var(--color-warning-text); }
.badge-info { background-color: var(--color-info-bg); color: var(--color-info-text); }
.badge-primary { background-color: var(--color-primary-light); color: var(--color-primary); }
.badge-dark { background-color: #E2E8F0; color: var(--color-primary-dark); }

/* ACCIONES DE TABLA */
.action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.action-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--color-white);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.action-btn:hover {
  background-color: var(--color-bg);
  color: var(--color-primary);
  border-color: #CBD5E1;
}

.action-btn.delete:hover {
  background-color: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: #FECACA;
}

.action-btn.success:hover {
  background-color: var(--color-success-bg);
  color: var(--color-success);
  border-color: #A7F3D0;
}

/* PIE DE TABLA / PAGINACIÓN */
.table-footer {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  background-color: #FAFBFD;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* CARDS DE CATEGORÍAS */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.category-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.category-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #CBD5E1;
}

.cat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.cat-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.cat-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.cat-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 16px;
  flex: 1;
}

.cat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

.cat-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-primary);
}

/* MODALES */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  overflow-y: auto;
}

.modal-backdrop.active {
  display: flex;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-dialog {
  background-color: var(--color-surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: modalScaleUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-dialog.lg {
  max-width: 820px;
}

@keyframes modalScaleUp {
  from { transform: scale(0.96) translateY(8px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #FAFBFD;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--color-danger);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 18px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background-color: #FAFBFD;
}

/* FORMULARIOS */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.form-grid.single {
  grid-template-columns: 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.form-label span.req {
  color: var(--color-danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--color-bg);
  color: var(--text-primary);
  font-size: 0.88rem;
  transition: all var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  background-color: var(--color-white);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.form-control.is-invalid {
  border-color: var(--color-danger);
  background-color: var(--color-danger-bg);
}

.invalid-feedback {
  font-size: 0.74rem;
  color: var(--color-danger);
  font-weight: 600;
}

.form-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* PREVISUALIZACIÓN DE PORTADA DE LIBRO */
.cover-preview-box {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 12px;
  background-color: var(--color-bg);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
}

.cover-preview-img {
  width: 60px;
  height: 84px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background-color: #E2E8F0;
  box-shadow: var(--shadow-sm);
}

/* FICHA DETALLADA DE LIBRO (MODAL VIEW) */
.book-detail-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
}

.book-detail-cover {
  width: 100%;
  height: 280px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  box-shadow: var(--shadow-md);
}

.book-info-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.book-info-item label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  display: block;
}

.book-info-item span {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-primary-dark);
}

/* COMPROBANTE DE PRÉSTAMO (TICKET / RECIBO) */
.loan-receipt-ticket {
  background-color: #FFFFFF;
  border: 2px dashed #CBD5E1;
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: var(--shadow-md);
  font-family: 'Plus Jakarta Sans', monospace, sans-serif;
}

.receipt-header {
  text-align: center;
  padding-bottom: 16px;
  border-bottom: 1px dashed #CBD5E1;
  margin-bottom: 16px;
}

.receipt-header h4 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--color-primary-dark);
}

.receipt-header p {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.receipt-code-box {
  margin: 12px 0;
  display: inline-block;
  padding: 4px 14px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 800;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.receipt-details-table {
  width: 100%;
  margin-bottom: 16px;
  font-size: 0.84rem;
}

.receipt-details-table td {
  padding: 6px 0;
}

.receipt-details-table td.label {
  color: var(--text-muted);
  font-weight: 600;
  width: 40%;
}

.receipt-details-table td.value {
  color: var(--color-primary-dark);
  font-weight: 700;
  text-align: right;
}

.receipt-highlight-date {
  background-color: #FEF3C7;
  color: #92400E;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  text-align: center;
  font-weight: 800;
  font-size: 0.95rem;
  margin: 14px 0;
  border: 1px solid #FDE68A;
}

.receipt-barcode {
  text-align: center;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed #CBD5E1;
}

.barcode-simulated {
  height: 40px;
  letter-spacing: 3px;
  font-size: 1.8rem;
  font-weight: 900;
  color: #1E293B;
  display: flex;
  align-items: center;
  justify-content: center;
}

.receipt-footer-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
}

/* MÓDULO DE REPORTES */
.reports-dashboard-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}

.reports-sidebar-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.report-nav-item:hover {
  background-color: var(--color-bg);
  color: var(--color-primary);
}

.report-nav-item.active {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 700;
}

.reports-content-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.report-action-buttons {
  display: flex;
  gap: 10px;
}

/* MÓDULO DE CONFIGURACIÓN */
.config-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
}

.config-tabs {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: fit-content;
}

.config-tab-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.config-tab-btn:hover {
  background-color: var(--color-bg);
  color: var(--color-primary);
}

.config-tab-btn.active {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.config-pane {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  display: none;
}

.config-pane.active {
  display: block;
}

.config-section-title {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.config-section-title h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.config-section-title p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* TABLA DE ROLES Y PERMISOS */
.roles-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 0.86rem;
}

.roles-table th {
  padding: 12px;
  background-color: #F8FAFC;
  border: 1px solid var(--border-color);
  text-align: left;
  font-weight: 700;
}

.roles-table td {
  padding: 12px;
  border: 1px solid var(--border-color);
  vertical-align: top;
}

.perm-tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px;
  background: #EFF6FF;
  color: #1D4ED8;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 600;
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  max-width: 380px;
  width: 100%;
  pointer-events: none;
}

.toast {
  background-color: var(--color-white);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-xl);
  border-left: 5px solid var(--color-primary);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: auto;
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.2s ease;
}

.toast.success { border-left-color: var(--color-success); }
.toast.danger { border-left-color: var(--color-danger); }
.toast.warning { border-left-color: var(--color-warning); }
.toast.info { border-left-color: var(--color-info); }

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.toast-message {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
}

/* ESTADOS VACÍOS (EMPTY STATES) */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background-color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  margin-bottom: 6px;
}

.empty-state h4 {
  font-size: 1.05rem;
  font-weight: 700;
}

.empty-state p {
  font-size: 0.84rem;
  color: var(--text-muted);
  max-width: 380px;
}

/* MEDIA QUERIES RESPONSIVE */
@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-extra-grid {
    grid-template-columns: 1fr;
  }

  .reports-dashboard-grid, .config-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99;
    display: none;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .menu-toggle-btn {
    display: block;
  }

  .top-header {
    padding: 0 16px;
  }

  .header-search {
    display: none;
  }

  .content-body {
    padding: 20px 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .quick-actions-bar {
    grid-template-columns: 1fr 1fr;
  }

  .book-detail-grid {
    grid-template-columns: 1fr;
  }

  .book-detail-cover {
    height: 200px;
    margin: 0 auto;
  }
}

/* REGLAS DE IMPRESIÓN (PRINT STYLES) */
@media print {
  body {
    background-color: #FFFFFF !important;
    color: #000000 !important;
  }

  .sidebar, .top-header, .toolbar-card, .table-footer, .action-buttons, .modal-footer, .btn, .toast-container, .modal-close-btn {
    display: none !important;
  }

  .main-wrapper {
    margin-left: 0 !important;
  }

  .content-body {
    padding: 0 !important;
  }

  .modal-backdrop {
    position: static !important;
    background: none !important;
    display: block !important;
    padding: 0 !important;
  }

  .modal-dialog {
    box-shadow: none !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .loan-receipt-ticket {
    box-shadow: none !important;
    border: 1px solid #000 !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
  }
}
