/* ==========================================================================
   VISOR DOCUMENTAL ESTILO REVISTA - STYLES
   ========================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;

  /* Dark Theme Palette (Default) */
  --bg-primary: #0a0d14;
  --bg-secondary: #121722;
  --bg-surface: rgba(22, 28, 40, 0.85);
  --bg-surface-solid: #161c28;
  --bg-paper: #ffffff;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-focus: #3b82f6;
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-color: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  --accent-glow: rgba(59, 130, 246, 0.35);

  --toolbar-bg: rgba(18, 23, 34, 0.82);
  --toolbar-border: rgba(255, 255, 255, 0.12);
  --toolbar-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.6), 0 0 1px 1px rgba(255, 255, 255, 0.08);

  --page-shadow: 0 16px 36px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.3);
  --spine-shadow: linear-gradient(to right, rgba(0,0,0,0.18) 0%, rgba(0,0,0,0.02) 8%, transparent 15%, transparent 85%, rgba(0,0,0,0.02) 92%, rgba(0,0,0,0.18) 100%);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Theme Variables */
body.theme-light {
  --bg-primary: #e2e8f0;
  --bg-secondary: #f1f5f9;
  --bg-surface: rgba(255, 255, 255, 0.9);
  --bg-surface-solid: #ffffff;
  --border-color: rgba(0, 0, 0, 0.1);
  --border-focus: #2563eb;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --toolbar-bg: rgba(255, 255, 255, 0.88);
  --toolbar-border: rgba(0, 0, 0, 0.08);
  --toolbar-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.15), 0 0 1px 1px rgba(0, 0, 0, 0.05);

  --page-shadow: 0 12px 28px rgba(0, 0, 0, 0.2), 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* Visually Hidden Utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   TOP BAR / HEADER
   ========================================================================== */
.app-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  background: var(--bg-surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
  z-index: 40;
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-icon {
  width: 24px;
  height: 24px;
  color: var(--accent-color);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.brand-subtitle {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Document Selector */
.doc-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 2px 4px;
  border-radius: var(--radius-md);
  margin-left: 0.5rem;
}

.doc-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  outline: none;
  padding: 0.35rem 1.6rem 0.35rem 0.6rem;
  cursor: pointer;
  max-width: 260px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.4rem center;
}

.doc-select option {
  background-color: var(--bg-surface-solid);
  color: var(--text-primary);
}

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

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

.nav-doc-btn {
  width: 26px;
  height: 26px;
}

.nav-doc-btn svg {
  width: 14px;
  height: 14px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* Document Badge */
.doc-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.25);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   VIEWER MAIN & VIEWPORT CANVAS
   ========================================================================== */
.viewer-main {
  position: absolute;
  top: 58px;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.03) 0%, transparent 80%),
    radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.04) 0%, transparent 40%);
}

.viewport-canvas {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: default;
  transition: cursor var(--transition-fast);
}

.viewport-canvas.can-pan {
  cursor: grab;
}

.viewport-canvas.is-panning {
  cursor: grabbing;
  user-select: none;
}

.viewport-canvas.is-panning .book-container {
  transition: none !important;
}

/* Side Arrows */
.side-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 72px;
  background: rgba(18, 23, 34, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 30;
  transition: all var(--transition-normal);
  opacity: 0.6;
}

.side-nav-btn.prev {
  left: 12px;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  border-radius: var(--radius-md);
}

.side-nav-btn.next {
  right: 12px;
  border-radius: var(--radius-md);
}

.side-nav-btn:hover:not(:disabled) {
  opacity: 1;
  background: rgba(30, 41, 59, 0.9);
  color: var(--accent-hover);
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.side-nav-btn:disabled {
  opacity: 0.15;
  cursor: not-allowed;
}

.side-nav-arrow {
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 300;
}

/* ==========================================================================
   BOOK CONTAINER & PAGES (REVISTA SPREAD)
   ========================================================================== */
.book-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transform-origin: center center;
  transition: transform 0.15s ease-out;
  max-width: 96vw;
  max-height: 84vh;
}

/* Spread (Magazine 2 Pages) */
.book-spread {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: var(--page-shadow);
  border-radius: var(--radius-sm);
  background-color: var(--bg-paper);
}

.book-spread .page {
  position: relative;
  background-color: var(--bg-paper);
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 82vh;
}

.book-spread .page.left {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.book-spread .page.right {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.book-spread .page img {
  display: block;
  max-height: 82vh;
  max-width: 46vw;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  transition: transform 0.25s ease-out;
  transform-origin: center center;
}

/* Magazine Center Spine Effect */
.book-spine-effect {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - 25px);
  width: 50px;
  background: var(--spine-shadow);
  pointer-events: none;
  z-index: 10;
}

/* Single Page View */
.single-page-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--page-shadow);
  border-radius: var(--radius-sm);
  background-color: var(--bg-paper);
  max-height: 82vh;
}

.single-page-wrapper img {
  display: block;
  max-height: 82vh;
  max-width: 90vw;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  transition: transform 0.25s ease-out;
  transform-origin: center center;
}

/* Page corner number indicator */
.page-corner-tag {
  position: absolute;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  pointer-events: none;
  z-index: 12;
  letter-spacing: 0.03em;
  transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.page.left .page-corner-tag {
  left: 10px;
}

.page.right .page-corner-tag {
  right: 10px;
}

.single-page-wrapper .page-corner-tag {
  bottom: 10px;
  right: 10px;
}

/* ==========================================================================
   PAGE SIDE BADGE OVERLAYS (FRENTE / REVERSO / FOJA)
   ========================================================================== */
.page-side-tag {
  position: absolute;
  top: 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  z-index: 15;
  pointer-events: auto;
  user-select: none;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ocultar etiquetas suavemente al pasar el mouse por la página o sobre los badges para no tapar texto */
.page:hover .page-side-tag,
.single-page-wrapper:hover .page-side-tag,
.page-side-tag:hover {
  opacity: 0.05;
  transform: translateY(-4px);
}

.page:hover .page-corner-tag,
.single-page-wrapper:hover .page-corner-tag,
.page-corner-tag:hover {
  opacity: 0.05;
  transform: translateY(4px);
}

/* Si se ocultan globalmente desde el menú o botón */
body.hide-badges .page-side-tag,
body.hide-badges .page-corner-tag {
  opacity: 0 !important;
  pointer-events: none !important;
}

.page.left .page-side-tag {
  left: 10px;
}

.page.right .page-side-tag {
  right: 10px;
  justify-content: flex-end;
}

.single-page-wrapper .page-side-tag {
  left: 12px;
}

.side-badge-pill {
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.side-badge-pill.frente {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.side-badge-pill.reverso {
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.side-badge-pill.unclassified {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
}

.side-badge-pill.blanco {
  background: rgba(71, 85, 105, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #cbd5e1;
  font-weight: 600;
}

.foja-badge-pill {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f8fafc;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.ref-badge-pill {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  font-weight: 500;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.ref-badge-pill.pdf-info {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  font-weight: 600;
}

.ref-badge-pill.difiere {
  background: rgba(153, 27, 27, 0.9);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fecaca;
  font-weight: 600;
}

.ref-badge-pill.nota {
  background: rgba(146, 64, 14, 0.9);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: #fef3c7;
  max-width: 300px;
}

/* Thumbnail mini badges */
.thumb-side-badge {
  position: absolute;
  top: 3px;
  left: 3px;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.thumb-side-badge.frente {
  background-color: #059669;
}

.thumb-side-badge.reverso {
  background-color: #7c3aed;
}

.thumb-foja-badge {
  position: absolute;
  bottom: 3px;
  right: 3px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.56rem;
  font-weight: 700;
  z-index: 2;
}

/* Loader */
.loader-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: var(--text-secondary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Zoom Indicator Overlay */
.zoom-indicator-tag {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-normal);
  z-index: 35;
}

.zoom-indicator-tag.show {
  opacity: 1;
}

/* ==========================================================================
   FLOATING COMPACT TOOLBAR
   ========================================================================== */
.floating-toolbar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  height: 52px;
  background: var(--toolbar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--toolbar-border);
  box-shadow: var(--toolbar-shadow);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.85rem;
  z-index: 38;
  transition: transform var(--transition-smooth), opacity var(--transition-smooth);
}

.floating-toolbar:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background-color: var(--border-color);
  margin: 0 0.2rem;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.tool-btn:hover:not(:disabled) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.tool-btn:active:not(:disabled) {
  transform: translateY(0);
}

.tool-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.tool-btn.icon-only {
  width: 36px;
  height: 36px;
}

.tool-btn.icon-only svg {
  width: 17px;
  height: 17px;
}

.tool-btn.text-btn {
  padding: 0.35rem 0.65rem;
  min-width: 52px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-primary);
}

.tool-btn.with-label {
  padding: 0.35rem 0.75rem;
  height: 36px;
}

.tool-btn.with-label svg {
  width: 16px;
  height: 16px;
}

.tool-btn.active {
  background: var(--accent-gradient);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 10px var(--accent-glow);
}

/* Page Input Box */
.page-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2px 8px;
  height: 32px;
}

.page-input-wrapper input {
  width: 44px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  -moz-appearance: textfield;
}

.page-input-wrapper input::-webkit-outer-spin-button,
.page-input-wrapper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.page-separator, .page-total {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================================================
   THUMBNAILS DRAWER
   ========================================================================== */
.thumbnails-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 160px;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4);
  z-index: 45;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform var(--transition-smooth);
}

.thumbnails-drawer.open {
  transform: translateY(0);
}

.drawer-header {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.drawer-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.drawer-count {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.drawer-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

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

.thumbnails-track {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.5rem 1.25rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
}

.thumbnails-track::-webkit-scrollbar {
  height: 6px;
}

.thumbnails-track::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
}

.thumb-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.thumb-item:hover {
  transform: translateY(-2px);
}

.thumb-img-wrapper {
  position: relative;
  width: 72px;
  height: 96px;
  background-color: #fff;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  border: 2px solid transparent;
  transition: all var(--transition-fast);
}

.thumb-item.active .thumb-img-wrapper {
  border-color: var(--accent-color);
  box-shadow: 0 0 12px var(--accent-glow);
}

.thumb-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-page-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.thumb-item.active .thumb-page-label {
  color: var(--accent-hover);
}

/* ==========================================================================
   MODAL - KEYBOARD SHORTCUTS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  opacity: 1;
  transition: opacity var(--transition-normal);
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: 90%;
  max-width: 520px;
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
}

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

.modal-body {
  padding: 1.25rem 1.5rem;
  max-height: 60vh;
  overflow-y: auto;
}

.shortcut-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.shortcut-item .keys {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.shortcut-item kbd {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom-width: 2px;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.shortcut-item .desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.modal-tip {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

.modal-btn {
  align-self: flex-end;
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--accent-glow);
  transition: transform var(--transition-fast);
}

.modal-btn:hover {
  transform: translateY(-1px);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 768px) {
  .app-header {
    padding: 0 0.75rem;
  }

  .brand-text {
    display: none;
  }

  .doc-badge {
    display: none;
  }

  .floating-toolbar {
    bottom: 12px;
    padding: 0 0.5rem;
    gap: 0.4rem;
    max-width: 96vw;
    height: 48px;
  }

  .tool-btn.with-label span {
    display: none;
  }

  .tool-btn.with-label {
    padding: 0;
    width: 34px;
    height: 34px;
  }

  .side-nav-btn {
    width: 36px;
    height: 56px;
  }
}

/* ==========================================================================
   CUSTOM CONTEXT MENU (ROTACIÓN Y ACCIONES)
   ========================================================================== */
.custom-context-menu {
  position: fixed;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
  padding: 6px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  user-select: none;
}

.custom-context-menu.hidden {
  display: none !important;
}

.context-menu-header {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 6px 12px 6px;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 3px;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  color: #f1f5f9;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  width: 100%;
}

.context-menu-item svg {
  flex-shrink: 0;
  color: #94a3b8;
  transition: color 0.15s ease;
}

.context-menu-item:hover {
  background: rgba(59, 130, 246, 0.25);
  color: #60a5fa;
}

.context-menu-item:hover svg {
  color: #60a5fa;
}

.context-menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 2px;
}
