/* ==========================================================================
   AulaPRL - Global Design System & Stylesheet
   Theme: Professional Safety & Occupational Risk Prevention (PRL)
   Colors: Emerald Green (Safety), Deep Navy/Steel Blue, Caution Amber
   ========================================================================== */

:root {
  --font-display: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  /* Color Palette */
  --primary: #1e3a8a;       /* Deep Navy Steel Blue */
  --primary-light: #3b82f6; /* Modern Blue */
  --primary-dark: #0f172a;  /* Charcoal Dark */
  
  --safety-green: #059669;  /* Safety/PRL Green */
  --safety-green-light: #10b981;
  
  --warning-amber: #d97706; /* Caution Amber */
  --danger-red: #dc2626;    /* Emergency Red */
  
  --neutral-50: #f9fafb;
  --neutral-100: #f3f4f6;
  --neutral-200: #e5e7eb;
  --neutral-300: #d1d5db;
  --neutral-700: #374151;
  --neutral-800: #1f2937;
  --neutral-900: #111827;

  /* Wood & Metal Colors for Bookshelf */
  --wood-top: #a05a2c;
  --wood-front: #78350f;
  --wood-shadow: rgba(0, 0, 0, 0.4);
  --metal-support: #4b5563;
  --metal-glow: #9ca3af;

  /* Typography */
  --text-main: var(--neutral-800);
  --text-muted: #6b7280;

  /* Layout Constants */
  --header-height: 70px;
  --border-radius: 12px;
  --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --box-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Core Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--neutral-100);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--neutral-900);
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: var(--transition-smooth);
}
a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: var(--font-body);
  transition: var(--transition-smooth);
}

.hidden {
  display: none !important;
}

/* App Container Layout */
#app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ==========================================================================
   Header Component
   ========================================================================== */
.app-header {
  height: var(--header-height);
  background-color: #2b70af; /* Steel Blue matching screenshot */
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 100;
  flex-shrink: 0;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-logo .logo-icon {
  font-size: 24px;
  color: var(--safety-green-light);
}
.header-logo .logo-text {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.header-logo .logo-text span {
  color: var(--safety-green-light);
}

.header-nav {
  display: flex;
  height: 100%;
}
.nav-btn {
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  font-size: 14px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  border-bottom: 3px solid transparent;
}
.nav-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}
.nav-btn.active {
  background-color: #1e5282; /* Active tab dark blue */
  border-bottom-color: var(--safety-green-light);
  color: white;
}
.nav-btn .badge-count {
  background-color: #6b7280;
  color: white;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 700;
}

.header-profile {
  position: relative;
}
.profile-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 30px;
  background-color: rgba(255, 255, 255, 0.1);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.profile-dropdown-trigger:hover {
  background-color: rgba(255, 255, 255, 0.2);
}
.profile-dropdown-trigger .user-avatar {
  font-size: 18px;
}
.profile-dropdown-trigger .user-name {
  color: white;
}
.profile-dropdown-trigger i {
  font-size: 10px;
  opacity: 0.8;
}

.profile-menu {
  position: absolute;
  top: 105%;
  right: 0;
  width: 220px;
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow-lg);
  padding: 8px 0;
  border: 1px solid var(--neutral-200);
  z-index: 1000;
  animation: slideDown 0.2s ease-out;
}
.profile-info {
  padding: 12px 16px;
}
.profile-info .info-name {
  font-weight: 600;
  color: var(--neutral-800);
  font-size: 15px;
}
.profile-info .info-role {
  font-size: 12px;
  color: var(--text-muted);
}
.profile-menu hr {
  border: 0;
  border-top: 1px solid var(--neutral-200);
  margin: 6px 0;
}
.profile-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--neutral-700);
  transition: var(--transition-smooth);
}
.profile-menu a:hover {
  background-color: var(--neutral-100);
  color: var(--neutral-900);
  text-decoration: none;
}
.profile-menu a.logout-link {
  color: var(--danger-red);
}
.profile-menu a.logout-link:hover {
  background-color: #fee2e2;
}

/* App Main Body */
.app-content {
  flex-grow: 1;
  overflow-y: auto;
  position: relative;
}

.view-section {
  padding: 24px;
  animation: fadeIn 0.4s ease-out;
  min-height: calc(100vh - var(--header-height));
}

/* ==========================================================================
   1. LOGIN VIEW
   ========================================================================== */
/* ==========================================================================
   1. LOGIN VIEW (Light Theme)
   ========================================================================== */
#login-view {
  background: linear-gradient(135deg, #f3f4f6 0%, #e2e8f0 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}
.login-wrapper {
  width: 100%;
  max-width: 440px;
}
.login-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 40px 32px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  color: var(--neutral-800);
}
.login-header {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-size: 32px;
  margin-bottom: 12px;
}
.login-logo i {
  color: var(--safety-green);
}
.login-logo h1 {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--primary);
  margin: 0;
}
.login-logo h1 span {
  color: var(--safety-green);
}
.login-header p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.4;
}

.login-form .form-group {
  margin-bottom: 24px;
}
.login-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  color: var(--neutral-700);
}
.input-wrapper {
  position: relative;
}
.input-wrapper i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  transition: var(--transition-smooth);
}
.input-wrapper input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  background: #ffffff;
  border: 1px solid var(--neutral-300);
  border-radius: var(--border-radius);
  color: var(--neutral-900);
  font-size: 15px;
  outline: none;
  transition: var(--transition-smooth);
}
.input-wrapper input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}
.input-wrapper input:focus {
  background: #ffffff;
  border-color: var(--safety-green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}
.input-wrapper input:focus + i {
  color: var(--safety-green);
}

.login-footer {
  margin-top: 32px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 12px;
  background-color: var(--neutral-100);
  border-radius: var(--border-radius);
  border: 1px solid var(--neutral-200);
}
.login-footer code {
  color: var(--safety-green);
  background: var(--neutral-200);
  padding: 2px 4px;
  border-radius: 4px;
  font-family: monospace;
}

/* ==========================================================================
   2. BOOKSHELF VIEW & MODERN BANNER
   ========================================================================== */
.welcome-header {
  margin-bottom: 30px;
  border-bottom: 1px solid var(--neutral-200);
  padding-bottom: 20px;
}
.welcome-header h1 {
  font-size: 24px;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 4px;
}
.welcome-header p {
  font-size: 14px;
  color: var(--text-muted);
}

/* Toolbar & Breadcrumbs */
.library-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}
.toolbar-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.breadcrumb {
  font-size: 13px;
  color: #6b7280;
}
.search-box {
  display: flex;
  gap: 8px;
}
.search-box input {
  padding: 8px 16px;
  border: 1px solid var(--neutral-300);
  border-radius: 6px;
  outline: none;
  font-size: 14px;
  width: 240px;
}
.search-box input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.filter-tabs {
  display: flex;
  background: var(--neutral-200);
  padding: 4px;
  border-radius: 8px;
}
.filter-tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  background: transparent;
  color: var(--neutral-700);
}
.filter-tab.active {
  background: white;
  color: var(--neutral-900);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Bookshelf Visual Elements (Modern Realistic Wood Shelf) */
.bookshelf-wrapper {
  background-color: #faf8f5;
  border: 1px solid #e6dfd5;
  border-radius: var(--border-radius);
  padding: 40px 30px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05), 0 10px 30px rgba(0, 0, 0, 0.05);
  margin-bottom: 40px;
}
.category-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 35px;
  color: #4a2c11;
  border-left: 5px solid var(--warning-amber);
  padding-left: 12px;
}

/* Grid of Bookshelf Shelves */
.bookshelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 50px 30px; /* spacing vertically and horizontally */
  padding-bottom: 40px;
  position: relative;
  
  /* Wooden shelves: gradient mimicking beautiful wood plank boards */
  background: transparent;
  border-bottom: 24px solid transparent;
  background-image: linear-gradient(to bottom, transparent calc(100% - 24px), #8b5a2b calc(100% - 24px), #5c3a21 100%);
  background-size: 100% 320px; /* Shelf height spacing */
  background-position: 0 270px;
  background-repeat: repeat-y;
}

.bookshelf::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: -20px;
  right: -20px;
  height: 24px;
  background: linear-gradient(to bottom, #a05a2c 0%, #8b5a2b 30%, #5c3a21 100%);
  border-radius: 4px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), inset 0 2px 2px rgba(255, 255, 255, 0.25);
  border-bottom: 2px solid #3d2210;
}

/* ==========================================================================
   Real 3D Book Cover Design
   ========================================================================== */
.book-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 270px;
  padding-bottom: 12px;
  perspective: 600px;
}

.book {
  position: relative;
  width: 150px;
  height: 220px;
  background-color: #3b82f6;
  border-radius: 2px 10px 10px 2px;
  box-shadow: 5px 5px 12px rgba(0, 0, 0, 0.35), -1px 0px 2px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
  transform-style: preserve-3d;
  transform: rotateY(-12deg);
  background: #ffffff;
}

.book:hover {
  transform: rotateY(-5deg) translateZ(20px) translateY(-12px);
  box-shadow: 12px 18px 24px rgba(0, 0, 0, 0.4), -2px 0px 4px rgba(0, 0, 0, 0.1);
}

/* Spine effect (left fold shadow) */
.book::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 14px;
  height: 100%;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0) 85%, rgba(255, 255, 255, 0.12) 100%);
  border-radius: 2px 0 0 2px;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  z-index: 10;
  pointer-events: none;
}

/* White page bundle thickness effect on top and right edges */
.book::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 3px;
  width: 5px;
  height: calc(100% - 6px);
  background: linear-gradient(to right, #e2e8f0 40%, #ffffff 80%, #cbd5e1 100%);
  border-radius: 0 3px 3px 0;
  z-index: 1;
  pointer-events: none;
}

/* Inner book design card */
.book-cover {
  position: absolute;
  inset: 0;
  border-radius: 2px 10px 10px 2px;
  padding: 16px 16px 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  z-index: 5;
  color: white;
}

/* Sleek Badge Pill Container (top-left) */
.book-badge {
  position: absolute;
  top: 14px;
  left: 20px;
  background-color: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 2px 8px;
  border-radius: 30px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Restricted Lock Indicator (top-right) */
.book-lock-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  background-color: var(--danger-red);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 11px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

/* CD Disc graphics cutout on the right, matching screenshot */
.book-cd-graphic {
  position: absolute;
  right: -30px;
  top: 50%;
  transform: translateY(-50%);
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 6px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}
.book-cd-graphic::after {
  content: "";
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.2);
  background: transparent;
}

/* Text Spine "TUTORIAL PARA EL PROFESOR" */
.book-spine-text {
  position: absolute;
  right: 48px;
  bottom: 50px;
  transform: rotate(-90deg) translateX(50%);
  transform-origin: right bottom;
  font-size: 8px;
  letter-spacing: 2px;
  opacity: 0.65;
  white-space: nowrap;
  font-weight: 700;
  color: white;
}

.book-meta {
  margin-top: auto;
}
.book-subtitle {
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
  margin-bottom: 4px;
}
.book-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: white;
}

/* Mesh-style gradients for Books Cover Themes */
.book.theme-green { background: linear-gradient(135deg, #10b981 0%, #059669 50%, #064e3b 100%); }
.book.theme-blue { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1e3a8a 100%); }
.book.theme-purple { background: linear-gradient(135deg, #a855f7 0%, #7c3aed 50%, #4c1d95 100%); }
.book.theme-teal { background: linear-gradient(135deg, #06b6d4 0%, #0d9488 50%, #115e59 100%); }
.book.theme-red { background: linear-gradient(135deg, #f43f5e 0%, #e11d48 50%, #881337 100%); }
.book.theme-brown { background: linear-gradient(135deg, #d97706 0%, #b45309 50%, #451a03 100%); }
.book.theme-orange { background: linear-gradient(135deg, #ff7849 0%, #ff5216 50%, #9e2a00 100%); }
.book.theme-indigo { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #312e81 100%); }

/* Left margin color accent indicators on hover for modern detail */
.book.theme-green::after { background-color: #34d399; }
.book.theme-blue::after { background-color: #60a5fa; }
.book.theme-purple::after { background-color: #c084fc; }
.book.theme-teal::after { background-color: #2dd4bf; }
.book.theme-red::after { background-color: #fb7185; }
.book.theme-brown::after { background-color: #fbbf24; }
.book.theme-orange::after { background-color: #ff9f7d; }
.book.theme-indigo::after { background-color: #818cf8; }

/* No books message */
.no-books {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}
.no-books i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* ========================================================================== */
.viewer-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height) - 48px);
}

.viewer-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.viewer-breadcrumb {
  font-size: 14px;
  color: var(--neutral-700);
  font-weight: 500;
}

/* Slide Stage Container */
.slide-stage-container {
  flex-grow: 1;
  background-color: #cccccc; /* Cool grey background from screenshot */
  border-radius: 4px;
  position: relative;
  display: flex;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--neutral-300);
}

/* Slide Stage Frame */
.slide-stage {
  flex-grow: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

/* PDF Canvas Container */
.canvas-viewer-wrapper {
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  background-color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center;
  will-change: transform, opacity;
}
#pdf-render-canvas {
  max-width: 100%;
  max-height: calc(100vh - 280px);
  display: block;
}

/* HTML Mock Slide Container (matching the black safety presentation slide) */
.html-viewer-wrapper {
  width: 100%;
  max-width: 900px;
  aspect-ratio: 4/3;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  background-color: black;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  transform-origin: center;
  will-change: transform, opacity;
}

.slide-turn-next {
  animation: slideTurnNext 260ms ease-out;
}

.slide-turn-prev {
  animation: slideTurnPrev 260ms ease-out;
}
.html-slide {
  width: 100%;
  height: 100%;
  padding: 40px;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: black;
  position: relative;
  border: 10px solid #efefef;
}
.html-slide-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
}
.html-slide-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 2px;
}
.html-slide-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  margin: 20px 0;
}
.html-slide-title {
  background-color: var(--safety-green); /* Green banner from screenshot */
  padding: 16px 24px;
  font-size: 28px;
  text-align: center;
  border-radius: 4px;
  color: white;
  margin-bottom: 10px;
}
.html-slide-content {
  font-size: 15px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
}
.html-slide-content p {
  margin-bottom: 12px;
  white-space: pre-line;
}
.html-slide-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 10px;
  display: flex;
  justify-content: space-between;
}
.html-slide-footer-text {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
}

/* OneDrive Iframe Mode */
.iframe-viewer-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
}
.iframe-viewer-wrapper iframe {
  width: 100%;
  height: 100%;
}

/* Loader */
.viewer-loader {
  position: absolute;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  z-index: 20;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--neutral-300);
  border-top-color: var(--primary-light);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Slide Index Sidebar Drawer */
.viewer-sidebar {
  width: 260px;
  background-color: white;
  border-right: 1px solid var(--neutral-300);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  z-index: 10;
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  animation: slideRight 0.3s ease-out;
}
.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--neutral-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sidebar-header h3 {
  font-size: 15px;
  font-weight: 600;
}
.btn-close-sidebar {
  background: transparent;
  font-size: 16px;
  color: var(--text-muted);
}
.sidebar-thumbnails {
  flex-grow: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.thumb-item {
  border: 2px solid var(--neutral-200);
  border-radius: 4px;
  padding: 8px;
  cursor: pointer;
  background-color: var(--neutral-50);
  transition: var(--transition-smooth);
}
.thumb-item:hover {
  border-color: var(--primary-light);
  background-color: var(--neutral-100);
}
.thumb-item.active {
  border-color: var(--safety-green);
  background-color: rgba(16, 185, 129, 0.05);
}
.thumb-title {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--neutral-800);
}
.thumb-preview {
  font-size: 10px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}

/* Bottom Nav Toolbar */
.viewer-toolbar {
  background-color: white;
  border: 1px solid var(--neutral-300);
  border-radius: 0 0 4px 4px;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.toolbar-left, .toolbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}
.toolbar-btn {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  background-color: var(--neutral-100);
  color: var(--neutral-800);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
}
.toolbar-btn:hover {
  background-color: var(--neutral-200);
}
.slide-indicator {
  font-size: 14px;
  font-weight: 600;
  color: var(--neutral-700);
}

.btn-nav-slide {
  padding: 8px 20px;
  font-weight: 700;
  font-size: 13px;
  border-radius: 4px;
  background-color: #3b82f6; /* Blue navigations matching screenshot */
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-nav-slide:hover {
  background-color: #2563eb;
}

/* Fullscreen Mode Overrides */
.viewer-layout.fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background-color: black;
  padding: 0;
}
.viewer-layout.fullscreen .viewer-header {
  display: none;
}
.viewer-layout.fullscreen .slide-stage-container {
  border-radius: 0;
  border: none;
  width: 100vw;
  height: 100vh;
}
.viewer-layout.fullscreen .slide-stage {
  padding: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: black;
}
.viewer-layout.fullscreen #pdf-render-canvas {
  max-height: 100vh;
  max-width: 100vw;
  box-shadow: none;
}
.viewer-layout.fullscreen .html-viewer-wrapper {
  max-width: 100vw;
  max-height: 100vh;
  height: 100vh;
  width: auto;
  aspect-ratio: 4/3;
  box-shadow: none;
  border-radius: 0;
}
.viewer-layout.fullscreen .html-slide {
  border: none;
}
.viewer-layout.fullscreen .viewer-toolbar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 600px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: white;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transition: opacity 0.3s ease;
  opacity: 0.3; /* fades out slightly until hovered */
}
.viewer-layout.fullscreen .viewer-toolbar:hover {
  opacity: 1;
}
.viewer-layout.fullscreen .slide-indicator {
  color: rgba(255, 255, 255, 0.9);
}
.viewer-layout.fullscreen .toolbar-btn {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}
.viewer-layout.fullscreen .toolbar-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}
.viewer-layout.fullscreen .viewer-sidebar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 200;
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: 5px 0 15px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   4. LOCK VIEW & LOCK SCREEN
   ========================================================================== */
#lock-view {
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
}
.lock-wrapper {
  width: 100%;
  max-width: 400px;
}
.lock-card {
  background-color: white;
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  box-shadow: var(--box-shadow-lg);
}
.lock-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #fee2e2;
  color: var(--danger-red);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  margin: 0 auto 20px;
}
.lock-card h2 {
  font-size: 20px;
  margin-bottom: 12px;
}
.lock-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}
.lock-form input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--neutral-300);
  border-radius: var(--border-radius);
  outline: none;
  font-size: 14px;
  text-align: center;
  margin-bottom: 16px;
}
.lock-form input:focus {
  border-color: var(--danger-red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}
.lock-actions {
  display: flex;
  gap: 12px;
}
.lock-actions button {
  flex: 1;
}

/* ==========================================================================
   5. ADMIN VIEW & CRUD MANAGEMENT
   ========================================================================== */
.admin-layout {
  display: flex;
  gap: 24px;
  min-height: calc(100vh - var(--header-height) - 48px);
}
.admin-sidebar {
  width: 220px;
  background-color: white;
  border: 1px solid var(--neutral-200);
  border-radius: var(--border-radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  box-shadow: var(--box-shadow);
  height: fit-content;
}
.admin-sidebar h3 {
  font-size: 14px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  padding: 8px;
  font-weight: 700;
}
.admin-menu-btn {
  padding: 10px 14px;
  border-radius: 6px;
  background-color: transparent;
  color: var(--neutral-700);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  text-align: left;
  font-weight: 500;
}
.admin-menu-btn:hover {
  background-color: var(--neutral-100);
  color: var(--neutral-900);
}
.admin-menu-btn.active {
  background-color: var(--primary);
  color: white;
}

.admin-content {
  flex-grow: 1;
  background-color: white;
  border: 1px solid var(--neutral-200);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--box-shadow);
}
.admin-sub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.admin-sub-header h2 {
  font-size: 20px;
  font-weight: 700;
}

/* Admin Tables styling */
.admin-table-wrapper {
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}
.admin-table th {
  background-color: var(--neutral-100);
  color: var(--neutral-800);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 2px solid var(--neutral-200);
}
.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--neutral-200);
  vertical-align: middle;
}
.admin-table tbody tr:hover {
  background-color: var(--neutral-50);
}

.admin-book-indicator {
  width: 24px;
  height: 32px;
  border-radius: 2px;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}
.admin-book-indicator.green { background-color: var(--safety-green-light); }
.admin-book-indicator.blue { background-color: #3b82f6; }
.admin-book-indicator.purple { background-color: #8b5cf6; }
.admin-book-indicator.teal { background-color: #14b8a6; }
.admin-book-indicator.red { background-color: #ef4444; }
.admin-book-indicator.brown { background-color: #b45309; }
.admin-book-indicator.orange { background-color: #f97316; }
.admin-book-indicator.indigo { background-color: #6366f1; }

.badge-method {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
}
.badge-method.pdf { background-color: #fee2e2; color: #b91c1c; }
.badge-method.embed { background-color: #e0f2fe; color: #0369a1; }
.badge-method.mock { background-color: #f3f4f6; color: #374151; }

/* Action buttons */
.btn-action {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  background-color: var(--neutral-100);
  color: var(--neutral-700);
  font-size: 12px;
  margin-right: 4px;
}
.btn-action:hover {
  background-color: var(--neutral-200);
}
.btn-action.edit:hover { background-color: #fef3c7; color: #d97706; }
.btn-action.delete:hover { background-color: #fee2e2; color: #dc2626; }

/* ==========================================================================
   Buttons & Alerts System
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
}
.btn-primary {
  background-color: var(--safety-green);
  color: white;
}
.btn-primary:hover {
  background-color: #047857;
}
.btn-secondary {
  background-color: var(--neutral-200);
  color: var(--neutral-700);
}
.btn-secondary:hover {
  background-color: var(--neutral-300);
}
.btn-search {
  background-color: #2b70af;
  color: white;
}
.btn-search:hover {
  background-color: #1e5282;
}
.btn-back {
  background-color: white;
  border: 1px solid var(--neutral-300);
  color: var(--neutral-700);
  font-size: 13px;
  padding: 6px 12px;
}
.btn-back:hover {
  background-color: var(--neutral-100);
}
.btn-block {
  width: 100%;
}

.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-danger {
  background-color: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* ==========================================================================
   Modals Component
   ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
  padding: 16px;
  overflow-y: auto;
}
.modal-card {
  background-color: white;
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  box-shadow: var(--box-shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleUp 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-card.modal-small {
  max-width: 460px;
}
.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--neutral-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--neutral-50);
}
.modal-header h3 {
  font-size: 16px;
}
.btn-close-modal {
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
}
.modal-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: flex;
  gap: 16px;
}
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.modal-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--neutral-700);
  margin-bottom: 6px;
}
.modal-form input[type="text"],
.modal-form input[type="password"],
.modal-form select,
.modal-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--neutral-300);
  border-radius: 6px;
  outline: none;
  font-family: var(--font-body);
  font-size: 14px;
}
.modal-form textarea {
  resize: vertical;
}
.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.radio-label input {
  width: 16px;
  height: 16px;
}
.radio-label span {
  font-size: 13px;
  font-weight: 400 !important;
  color: var(--neutral-800);
}

.file-info-current {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--neutral-100);
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 6px;
  font-size: 12px;
}
.file-info-current i {
  color: var(--danger-red);
}
.btn-remove-file {
  background: transparent;
  color: var(--danger-red);
  margin-left: auto;
}

.form-tip {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
}

/* ==========================================================================
   Keyframes & Animations
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes slideTurnNext {
  0% { opacity: 0.35; transform: translateX(24px) scale(0.985); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes slideTurnPrev {
  0% { opacity: 0.35; transform: translateX(-24px) scale(0.985); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}

/* Responsive Media Queries */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    height: auto;
    padding: 16px;
    gap: 12px;
  }
  .header-nav {
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
  }
  .nav-btn {
    height: 40px;
    padding: 0 12px;
  }
  .view-section {
    padding: 12px;
  }
  .bookshelf {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 30px 15px;
    background-size: 100% 240px;
    background-position: 0 200px;
  }
  .book-wrapper {
    height: 200px;
  }
  .book {
    width: 110px;
    height: 160px;
  }
  .book-cover {
    padding: 12px 10px 12px 14px;
  }
  .book-badge {
    top: 10px;
    left: 14px;
    font-size: 10px;
  }
  .book-title {
    font-size: 11px;
  }
  .book-cd-graphic {
    width: 60px;
    height: 60px;
    right: -20px;
  }
  .book-cd-graphic::after {
    width: 20px;
    height: 20px;
  }
  .admin-layout {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
  }
  .form-row {
    flex-direction: column;
    gap: 12px;
  }
  .viewer-layout {
    height: auto;
  }
  .slide-stage-container {
    height: 300px;
  }
  .viewer-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 200px;
  }
}
