/* ==========================================================================
   SISTEMA DE DISEÑO & VARIABLES (TEMA OSCURO POR DEFECTO / TEMA CLARO)
   ========================================================================== */
:root {
  /* Paleta Oscura (Por Defecto) */
  --bg-app: #0a0f1d;
  --bg-card: #131b2e;
  --bg-sidebar: #0f1626;
  --bg-header: rgba(10, 15, 29, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(226, 184, 87, 0.3);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent: #e2b857; /* Dorado legal refinado */
  --accent-hover: #f1d279;
  --accent-rgb: 226, 184, 87;
  
  --success: #10b981; /* Verde esmeralda para WhatsApp */
  --success-hover: #059669;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, Cambria, "Times New Roman", serif;
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --header-height: 80px;
}

body.light-mode {
  /* Paleta Clara */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #f1f5f9;
  --bg-header: rgba(248, 250, 252, 0.85);
  --border-color: rgba(15, 23, 42, 0.08);
  --border-hover: rgba(226, 184, 87, 0.5);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
}

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

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  scroll-behavior: smooth;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  text-decoration: none;
  color: inherit;
}

input, button, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
}

/* Utilitarios de botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.6rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--accent);
  color: #0a0f1d;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

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

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

.btn-success:hover {
  background-color: var(--success-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.w-100 {
  width: 100%;
}

.icon-inline {
  vertical-align: middle;
  width: 1.1rem;
  height: 1.1rem;
}

.icon-btn-inline {
  width: 1.2rem;
  height: 1.2rem;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-category {
  background-color: rgba(var(--accent-rgb), 0.15);
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
}

.badge-condition {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

body.light-mode .badge-condition {
  background-color: rgba(0, 0, 0, 0.03);
}

/* ==========================================================================
   HEADER PRINCIPAL
   ========================================================================== */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  transition: var(--transition);
}

.header-container {
  max-width: 1400px;
  height: 100%;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.brand {
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-title .accent {
  color: var(--accent);
  font-style: italic;
  font-weight: 400;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

/* Buscador */
.search-wrapper {
  flex-grow: 1;
  max-width: 600px;
  position: relative;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem 0.6rem 2.8rem;
  display: flex;
  align-items: center;
  transition: var(--transition);
}

body.light-mode .search-wrapper {
  background-color: rgba(0, 0, 0, 0.02);
}

.search-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
  background-color: var(--bg-card);
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  width: 1.2rem;
  height: 1.2rem;
}

#search-input {
  width: 100%;
  outline: none;
  font-size: 0.95rem;
  color: var(--text-primary);
}

#search-input::placeholder {
  color: var(--text-muted);
}

.clear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.clear-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.1);
}

body.light-mode .clear-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

body.light-mode .icon-btn:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

/* ==========================================================================
   DISEÑO PRINCIPAL Y SIDEBAR (GRID)
   ========================================================================== */
.main-layout {
  max-width: 1400px;
  margin: calc(var(--header-height) + 2rem) auto 4rem;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2.5rem;
  align-items: start;
}

/* Sidebar de Filtros */
.sidebar-filters {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  position: sticky;
  top: calc(var(--header-height) + 2rem);
  max-height: calc(100vh - var(--header-height) - 4rem);
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

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

.sidebar-header h2 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group {
  margin-bottom: 2rem;
}

.filter-group h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-weight: 700;
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Checkbox Personalizado */
.checkbox-container {
  display: block;
  position: relative;
  padding-left: 2rem;
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.checkbox-container:hover {
  color: var(--text-primary);
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 1px;
  left: 0;
  height: 18px;
  width: 18px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  transition: var(--transition);
}

body.light-mode .checkmark {
  background-color: rgba(0, 0, 0, 0.02);
}

.checkbox-container:hover input ~ .checkmark {
  border-color: var(--text-muted);
}

.checkbox-container input:checked ~ .checkmark {
  background-color: var(--accent);
  border-color: var(--accent);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

.checkbox-container .checkmark:after {
  left: 6px;
  top: 2px;
  width: 4px;
  height: 9px;
  border: solid #0a0f1d;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Price Range Slider */
.price-slider-container {
  padding: 0.5rem 0;
}

#price-range {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 5px;
  background: var(--border-color);
  outline: none;
}

#price-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: transform 0.1s ease;
}

#price-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.price-values {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.75rem;
}

.price-limit-val {
  font-weight: 600;
  color: var(--accent);
}

/* Select Personalizado */
.custom-select {
  width: 100%;
  padding: 0.75rem;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

body.light-mode .custom-select {
  background-color: rgba(0, 0, 0, 0.02);
}

.custom-select:focus {
  border-color: var(--accent);
  color: var(--text-primary);
}

.custom-select option {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

/* ==========================================================================
   SECCION DE CATALOGO
   ========================================================================== */
.catalog-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.catalog-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.results-count {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.active-filters-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

body.light-mode .chip {
  background-color: rgba(0, 0, 0, 0.03);
}

.chip-close {
  cursor: pointer;
  display: flex;
  align-items: center;
}

.chip-close:hover {
  color: var(--text-primary);
}

/* Grid de Tarjetas */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
}

/* Tarjeta del Libro (Book Card) */
.book-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.book-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

/* Contenedor de Portada en Tarjeta */
.book-card-cover {
  width: 100%;
  aspect-ratio: 3/4;
  position: relative;
  background-color: rgba(0, 0, 0, 0.2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border-color);
}

.book-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.book-card:hover .book-card-cover img {
  transform: scale(1.05);
}

/* Portada Estilizada con CSS (Fallback) */
.book-cover-css {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #101626 0%, #1e2942 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem;
  color: #fff;
  border-left: 6px solid rgba(0, 0, 0, 0.3);
  position: relative;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.3);
  text-align: center;
}

/* Diferentes variaciones de color de portada CSS basadas en categoría */
.book-cover-css.legal {
  background: linear-gradient(135deg, #1e263d 0%, #0d1220 100%);
}

.book-cover-css.tributario {
  background: linear-gradient(135deg, #302018 0%, #150d0a 100%);
}

.book-cover-css-border {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 1px solid rgba(226, 184, 87, 0.25);
  pointer-events: none;
  border-radius: 4px;
}

.book-cover-css-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 1.5rem;
  color: var(--accent);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.book-cover-css-author {
  font-size: 0.8rem;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.book-card-info {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.book-card-category {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.book-card-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card-author {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.book-card-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}

.book-card-condition {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
}

body.light-mode .book-card-condition {
  background-color: rgba(0, 0, 0, 0.02);
}

/* Skeleton Loader */
.skeleton-card {
  height: 420px;
  background: linear-gradient(90deg, var(--bg-card) 25%, rgba(255,255,255,0.03) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background-color: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
}

.empty-icon {
  width: 4rem;
  height: 4rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.empty-state h3 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* ==========================================================================
   MODAL DE DETALLE (GLASSMORPHISM OVERLAY)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(5, 8, 16, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 900px;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  z-index: 10;
}

body.light-mode .modal-close-btn {
  background-color: rgba(0, 0, 0, 0.03);
}

.modal-close-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--accent);
  transform: rotate(90deg);
}

.modal-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.8fr;
}

.modal-cover-sec {
  background-color: rgba(0, 0, 0, 0.15);
  padding: 3rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border-color);
}

.modal-cover-sec .book-cover-container {
  width: 100%;
  max-width: 250px;
  aspect-ratio: 3/4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border-radius: 6px;
  overflow: hidden;
  background-color: var(--bg-app);
}

.modal-cover-sec img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-info-sec {
  padding: 3rem;
  display: flex;
  flex-direction: column;
}

.modal-book-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  margin: 0.75rem 0 0.25rem 0;
  line-height: 1.25;
}

.modal-book-author {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.book-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.meta-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.meta-value {
  font-size: 0.95rem;
  font-weight: 600;
}

.meta-value.badge-condition {
  align-self: flex-start;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.modal-synopsis {
  margin-bottom: 2.5rem;
}

.modal-synopsis h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.modal-synopsis p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.modal-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  gap: 1.5rem;
}

.price-container {
  display: flex;
  flex-direction: column;
}

.price-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.price-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.app-footer {
  background-color: var(--bg-sidebar);
  border-top: 1px solid var(--border-color);
  padding: 4rem 2rem 2rem;
  margin-top: auto;
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 2rem;
}

.footer-brand h4 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.footer-brand p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer-contact {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer-bottom {
  max-width: 1400px;
  margin: 1.5rem auto 0;
  display: flex;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   ANIMACIONES
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   MEDIA QUERIES (RESPONSIVE)
   ========================================================================== */
@media (max-width: 992px) {
  .main-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  /* Ocultar Sidebar en Móviles por defecto */
  .sidebar-filters {
    position: fixed;
    top: 0;
    left: -100%;
    width: 300px;
    height: 100vh;
    max-height: 100vh;
    z-index: 1000;
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border-color);
    box-shadow: 10px 0 30px rgba(0,0,0,0.5);
  }

  .sidebar-filters.open {
    left: 0;
  }

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

  .modal-cover-sec {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 2rem;
  }

  .modal-info-sec {
    padding: 2rem;
  }
}

@media (max-width: 768px) {
  .header-container {
    padding: 0 1rem;
  }

  .main-layout {
    padding: 0 1rem;
    margin-top: calc(var(--header-height) + 1rem);
  }

  .brand-title {
    font-size: 1.3rem;
  }

  .search-wrapper {
    max-width: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    z-index: 99;
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  }

  .main-layout {
    margin-top: calc(var(--header-height) + 3.5rem);
  }

  .mobile-only {
    display: inline-flex !important;
  }
}

.mobile-only {
  display: none;
}

/* ==========================================================================
   ESTILOS DEL PANEL DE ADMINISTRACIÓN
   ========================================================================== */
.admin-card {
  max-width: 1100px;
  width: 95%;
}

.admin-login-view {
  padding: 4rem 2rem;
  max-width: 400px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.login-shield-icon {
  width: 4.5rem;
  height: 4.5rem;
  color: var(--accent);
}

.admin-login-view h2 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
}

.admin-login-view p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.admin-login-view form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Campos de Formulario */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  text-align: left;
}

.input-group label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.input-group input[type="text"],
.input-group input[type="password"],
.input-group input[type="number"],
.input-group input[type="email"],
.input-group select,
.input-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

body.light-mode .input-group input[type="text"],
body.light-mode .input-group input[type="password"],
body.light-mode .input-group input[type="number"],
body.light-mode .input-group input[type="email"],
body.light-mode .input-group select,
body.light-mode .input-group textarea {
  background-color: rgba(0, 0, 0, 0.02);
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
  border-color: var(--accent);
  background-color: rgba(var(--accent-rgb), 0.02);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.error-text {
  color: #ef4444;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* Consola Admin Principal */
.admin-console-view {
  padding: 2.5rem;
}

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

.admin-header h2 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

/* Tabs de Navegación */
.admin-tabs {
  display: flex;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.tab-btn {
  padding: 0.75rem 0.5rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.tab-btn:hover, .tab-btn.active {
  color: var(--accent);
}

.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--accent);
}

/* Layout de la consola de libros */
.books-admin-layout {
  display: grid;
  grid-template-columns: 1.2fr 1.8fr;
  gap: 2.5rem;
  align-items: start;
}

.form-container, .list-container {
  background-color: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

body.light-mode .form-container,
body.light-mode .list-container {
  background-color: rgba(0, 0, 0, 0.005);
}

.form-container h3, .list-container h3, .contact-admin-form-container h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.form-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* Subida de Imagen */
.file-upload-wrapper {
  position: relative;
  overflow: hidden;
  display: inline-block;
  width: 100%;
}

.file-upload-wrapper input[type="file"] {
  font-size: 100px;
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  cursor: pointer;
}

.file-upload-btn {
  border: 1px dashed var(--border-color);
  color: var(--text-secondary);
  background-color: rgba(255, 255, 255, 0.02);
  padding: 1rem;
  border-radius: var(--radius-md);
  text-align: center;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.file-upload-wrapper:hover .file-upload-btn {
  border-color: var(--accent);
  color: var(--text-primary);
  background-color: rgba(var(--accent-rgb), 0.03);
}

.file-name {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-preview {
  margin-top: 1rem;
  width: 120px;
  aspect-ratio: 3/4;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Tabla Administrativa */
.table-wrapper {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.admin-table th, .admin-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.admin-table th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.admin-table tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

body.light-mode .admin-table tr:hover {
  background-color: rgba(0, 0, 0, 0.01);
}

.admin-book-meta-title {
  font-weight: 600;
  color: var(--text-primary);
}

.admin-book-meta-author {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.table-actions {
  display: flex;
  gap: 0.5rem;
}

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

.edit-action {
  color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.05);
}

.edit-action:hover {
  color: white;
  background-color: #3b82f6;
  border-color: #3b82f6;
}

.delete-action {
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.05);
}

.delete-action:hover {
  color: white;
  background-color: #ef4444;
  border-color: #ef4444;
}

/* Pestaña de Contacto */
.contact-admin-form-container {
  max-width: 600px;
  margin: 0 auto;
}

.tab-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* Adaptación para pantallas pequeñas */
@media (max-width: 850px) {
  .books-admin-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

