/* =========================================================
   PORTAFOLIO DIGITAL PIP — COLEGIO TORIBIO CASANOVA
   Diseño Premium 2.0 — Celeste & Oro
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&display=swap');

/* ─── Variables del Sistema ─── */
:root {
  /* Colores Institucionales */
  --sky-50:  #f0f9ff;
  --sky-100: #e0f2fe;
  --sky-200: #bae6fd;
  --sky-400: #38bdf8;
  --sky-500: #0ea5e9;
  --sky-600: #0284c7;
  --sky-700: #0369a1;
  --sky-900: #0c4a6e;

  --gold-50:  #fffbeb;
  --gold-100: #fef3c7;
  --gold-300: #fcd34d;
  --gold-400: #fbbf24;
  --gold-500: #f59e0b;
  --gold-600: #d97706;
  --gold-700: #b45309;

  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* Tokens de Design */
  --primary:        var(--sky-500);
  --primary-dark:   var(--sky-600);
  --primary-light:  var(--sky-50);
  --accent:         var(--gold-500);
  --accent-dark:    var(--gold-600);
  --accent-light:   var(--gold-50);

  --text-primary:   var(--slate-900);
  --text-secondary: var(--slate-500);
  --text-muted:     var(--slate-400);
  --text-inverse:   #ffffff;

  --bg-page:    #eef2f7;
  --bg-surface: #ffffff;
  --bg-muted:   var(--slate-50);

  --border-light: var(--slate-200);
  --border-muted: var(--slate-100);

  /* Radios */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  18px;
  --r-xl:  24px;
  --r-full: 9999px;

  /* Sombras */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.07), 0 1px 2px -1px rgb(0 0 0 / 0.07);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.07), 0 4px 6px -4px rgb(0 0 0 / 0.07);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.07), 0 8px 10px -6px rgb(0 0 0 / 0.07);
  --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.06);
  --shadow-primary: 0 4px 14px 0 rgb(14 165 233 / 0.25);
  --shadow-gold: 0 4px 14px 0 rgb(245 158 11 / 0.25);

  /* Animaciones */
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.25s;
  --duration-slow: 0.4s;

  /* Sidebar */
  --sidebar-width: 300px;
  --docpane-width: 380px;
}

/* ─── Reset & Base ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  background-color: var(--bg-page);
  background-image:
    radial-gradient(ellipse 80% 60% at 10% -10%, rgba(14,165,233,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 100%, rgba(245,158,11,0.08) 0%, transparent 55%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout Principal ─── */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
}

/* ========================================================
   SIDEBAR
   ======================================================== */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0c2a45 0%, #0f172a 100%);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  z-index: 20;
}

/* Fondo decorativo del sidebar */
.sidebar::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 250px; height: 250px;
  background: radial-gradient(circle, rgba(14,165,233,0.2) 0%, transparent 70%);
  pointer-events: none;
}
.sidebar::after {
  content: '';
  position: absolute;
  bottom: 60px; left: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(245,158,11,0.12) 0%, transparent 70%);
  pointer-events: none;
}

/* Banner de la IE al top del sidebar */
.sidebar-brand {
  position: relative;
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
  flex-shrink: 0;
}

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

.sidebar-brand-prefix {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--sky-300);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.2;
}

.sidebar-brand-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.2;
  margin-top: 1px;
}

.sidebar-brand-ugel {
  font-size: 0.60rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* Sección de Perfil */
.profile-section {
  padding: 24px 20px 20px;
  text-align: center;
  position: relative;
}

.avatar-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 14px;
}

.avatar-ring {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, var(--sky-400), var(--gold-400));
  display: block;
  box-shadow: 0 0 0 4px rgba(14,165,233,0.15), var(--shadow-lg);
}

.profile-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #1e293b;
  display: block;
}

.avatar-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, var(--sky-500), var(--sky-600));
  border-radius: 50%;
  border: 2px solid #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-badge svg {
  width: 10px; height: 10px;
  color: #fff;
}

.profile-name {
  font-size: 1rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 4px;
  line-height: 1.3;
}

.profile-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--sky-400);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: rgba(14,165,233,0.12);
  border: 1px solid rgba(14,165,233,0.2);
  padding: 3px 10px;
  border-radius: var(--r-full);
  margin-bottom: 12px;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.profile-meta-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
}

.profile-meta-item svg { flex-shrink: 0; }
.profile-meta-item strong { color: rgba(255,255,255,0.7); font-weight: 500; }

/* Divisor con label */
.sidebar-divider {
  margin: 0 20px 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-divider-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.25);
  white-space: nowrap;
}

.sidebar-divider-line {
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.07);
}

/* Navegación de Categorías */
.categories-section {
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.categories-section::-webkit-scrollbar { width: 4px; }
.categories-section::-webkit-scrollbar-track { background: transparent; }
.categories-section::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.category-list { list-style: none; display: flex; flex-direction: column; gap: 3px; }

.category-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.5);
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 500;
  text-align: left;
  border-radius: var(--r-md);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--duration) var(--ease-smooth);
  border: 1px solid transparent;
  position: relative;
}

.category-btn:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.85);
  border-color: rgba(255,255,255,0.06);
}

.category-btn.active {
  background: linear-gradient(135deg, rgba(14,165,233,0.25), rgba(14,165,233,0.12));
  color: #ffffff;
  border-color: rgba(14,165,233,0.3);
  box-shadow: inset 0 0 0 1px rgba(14,165,233,0.15);
}

.category-btn.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: linear-gradient(180deg, var(--sky-400), var(--sky-500));
  border-radius: 0 3px 3px 0;
}

.category-btn svg { flex-shrink: 0; width: 16px; height: 16px; }

.category-btn span:nth-child(2) { flex: 1; }

.category-count {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
  padding: 2px 7px;
  border-radius: var(--r-full);
  min-width: 22px;
  text-align: center;
}

.category-btn.active .category-count {
  background: rgba(14,165,233,0.3);
  color: var(--sky-200);
}

/* Footer del Sidebar */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.social-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.social-btn {
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.45);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: all var(--duration) var(--ease-smooth);
  border: 1px solid rgba(255,255,255,0.06);
}
.social-btn:hover {
  background: rgba(255,255,255,0.14);
  color: #ffffff;
}

/* Botones de accesos rápidos sólo iconos (Catálogo y Galería) */
.sidebar-icon-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.sidebar-quick-btn {
  flex: 1;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  text-decoration: none;
  position: relative;
  transition: all var(--duration) var(--ease-smooth);
  border: 1px solid transparent;
}

/* Color distintivo: Catálogo de Recursos (Verde Esmeralda) */
.sidebar-quick-btn.btn-recursos {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
  color: #34d399;
}
.sidebar-quick-btn.btn-recursos:hover, 
.sidebar-quick-btn.btn-recursos.active {
  background: rgba(16, 185, 129, 0.28);
  border-color: rgba(16, 185, 129, 0.55);
  color: #a7f3d0;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  transform: translateY(-2px);
}

/* Color distintivo: Galería de Evidencias (Naranja Cálido) */
.sidebar-quick-btn.btn-galeria {
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.25);
  color: #fb923c;
}
.sidebar-quick-btn.btn-galeria:hover, 
.sidebar-quick-btn.btn-galeria.active {
  background: rgba(249, 115, 22, 0.28);
  border-color: rgba(249, 115, 22, 0.55);
  color: #ffedd5;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.3);
  transform: translateY(-2px);
}

.sidebar-quick-btn svg {
  width: 18px;
  height: 18px;
  transition: transform var(--duration) var(--ease-spring);
}
.sidebar-quick-btn:hover svg {
  transform: scale(1.15);
}

/* Tooltip Flotante al pasar el cursor (Hover) */
.sidebar-quick-btn::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: #0f172a;
  color: #ffffff;
  font-size: 0.73rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s var(--ease-smooth), transform 0.2s var(--ease-smooth);
  z-index: 100;
}

.sidebar-quick-btn::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  border-width: 5px 5px 0 5px;
  border-style: solid;
  border-color: #0f172a transparent transparent transparent;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s var(--ease-smooth), transform 0.2s var(--ease-smooth);
  z-index: 101;
}

.sidebar-quick-btn:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-10px);
}

.sidebar-quick-btn:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-5px);
}

.admin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.25);
  color: var(--gold-300);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--r-md);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--duration) var(--ease-smooth);
  letter-spacing: 0.01em;
}
.admin-btn:hover {
  background: rgba(245,158,11,0.22);
  border-color: rgba(245,158,11,0.4);
  color: var(--gold-200, #fde68a);
  transform: translateY(-1px);
}
.admin-btn svg { width: 14px; height: 14px; }

/* ========================================================
   MAIN CONTENT
   ======================================================== */
.main-content {
  flex: 1;
  display: flex;
  height: 100%;
  overflow: hidden;
  min-width: 0;
}

/* ─── Panel de Documentos ─── */
.document-pane {
  width: var(--docpane-width);
  display: flex;
  flex-direction: column;
  background: #f4f6f9;
  border-right: 1px solid var(--border-light);
  height: 100%;
  flex-shrink: 0;
}

.pane-header {
  padding: 20px 16px 14px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
}

.pane-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.pane-title svg {
  color: var(--primary);
  flex-shrink: 0;
}

.search-wrapper {
  position: relative;
}

.search-icon-wrap {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
}

.search-input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  background: var(--slate-50);
  border: 1.5px solid var(--border-light);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 0.84rem;
  color: var(--text-primary);
  outline: none;
  transition: all var(--duration) var(--ease-smooth);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}

/* Lista de documentos */
.document-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

.document-list::-webkit-scrollbar { width: 4px; }
.document-list::-webkit-scrollbar-track { background: transparent; }
.document-list::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

/* Tarjeta de Documento */
.doc-card {
  background: #ffffff;
  border: 1.5px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 14px;
  cursor: pointer;
  transition: all var(--duration) var(--ease-smooth);
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}

.doc-card::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--sky-400), var(--sky-600));
  opacity: 0;
  border-radius: 0 2px 2px 0;
  transition: opacity var(--duration) var(--ease-smooth);
}

.doc-card:hover {
  border-color: var(--sky-200);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.doc-card:hover::after { opacity: 0.5; }

.doc-card.active {
  border-color: var(--primary);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--primary);
  background: #fdfdff;
}
.doc-card.active::after { opacity: 1; }

.doc-card-header {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 6px;
}

.doc-icon-wrap {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  background: var(--sky-50);
  color: var(--sky-600);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--duration);
}
.doc-card.active .doc-icon-wrap {
  background: linear-gradient(135deg, var(--sky-500), var(--sky-600));
  color: #ffffff;
  box-shadow: var(--shadow-primary);
}

.doc-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  flex: 1;
  letter-spacing: -0.01em;
}
.doc-card.active .doc-card-title { color: var(--sky-700); }

.doc-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
  padding-left: 46px;
}

.doc-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 46px;
}

.doc-tag {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--slate-100);
  padding: 2px 8px;
  border-radius: var(--r-full);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.doc-card-arrow {
  margin-left: auto;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--sky-50);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transform: translateX(-4px);
  transition: all var(--duration) var(--ease-spring);
  flex-shrink: 0;
}
.doc-card:hover .doc-card-arrow,
.doc-card.active .doc-card-arrow {
  opacity: 1;
  transform: translateX(0);
}
.doc-card.active .doc-card-arrow {
  background: var(--primary);
  color: #fff;
}

/* Estado vacío */
.empty-docs {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
  gap: 12px;
}
.empty-docs svg { opacity: 0.4; }
.empty-docs p { font-size: 0.85rem; font-weight: 500; }

/* ─── Visor de Documentos ─── */
.viewer-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
  height: 100%;
  min-width: 0;
}

.viewer-header {
  padding: 14px 20px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.viewer-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.viewer-doc-cat {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: var(--sky-50);
  padding: 2px 8px;
  border-radius: var(--r-full);
  border: 1px solid var(--sky-100);
}

.viewer-doc-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 500px;
}

.viewer-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.viewer-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: all var(--duration) var(--ease-smooth);
  white-space: nowrap;
}

.viewer-btn-secondary {
  background: var(--slate-50);
  color: var(--text-secondary);
  border-color: var(--border-light);
}
.viewer-btn-secondary:hover {
  background: var(--slate-100);
  color: var(--text-primary);
  border-color: var(--slate-300);
}

.viewer-btn-primary {
  background: linear-gradient(135deg, var(--sky-500), var(--sky-600));
  color: #ffffff;
  box-shadow: var(--shadow-primary);
}
.viewer-btn-primary:hover {
  background: linear-gradient(135deg, var(--sky-400), var(--sky-500));
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(14,165,233,0.35);
}

.viewer-body {
  flex: 1;
  padding: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.iframe-shell {
  flex: 1;
  background: #ffffff;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-light);
}

.iframe-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  z-index: 5;
  flex-direction: column;
  gap: 14px;
  transition: opacity 0.4s ease;
}

.iframe-loading.hidden { opacity: 0; pointer-events: none; }

.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--sky-100);
  border-top-color: var(--sky-500);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.loading-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

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

.iframe-shell iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ─── Splash / Bienvenida ─── */
.viewer-splash {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  overflow-y: auto;
}

.splash-inner {
  max-width: 640px;
  width: 100%;
  text-align: center;
}

/* Hero Banner del Colegio */
.splash-hero {
  background: linear-gradient(135deg, #0c2a45 0%, #0f4c75 50%, #1565a8 100%);
  border-radius: var(--r-xl);
  padding: 40px 32px 36px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

.splash-hero::before {
  content: '';
  position: absolute;
  top: -50px; right: -50px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(14,165,233,0.3), transparent 70%);
}
.splash-hero::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -40px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(245,158,11,0.2), transparent 70%);
}

.splash-insignia {
  width: 80px; height: 80px;
  object-fit: contain;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
  position: relative;
  z-index: 1;
}

.splash-insignia-placeholder {
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.4);
  position: relative; z-index: 1;
}

.splash-hero-prefix {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--sky-300);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  position: relative; z-index: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.splash-hero-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 6px;
  letter-spacing: -0.03em;
  position: relative; z-index: 1;
  text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.splash-hero-sub {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.6);
  position: relative; z-index: 1;
  font-weight: 500;
}

.splash-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  background: rgba(245,158,11,0.2);
  border: 1px solid rgba(245,158,11,0.35);
  color: var(--gold-300);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: var(--r-full);
  position: relative; z-index: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Tarjetas de info del docente */
.splash-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  text-align: left;
}

.splash-info-card {
  background: #ffffff;
  border-radius: var(--r-lg);
  padding: 16px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.splash-info-icon {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}

.splash-info-icon.sky { background: var(--sky-50); color: var(--sky-600); }
.splash-info-icon.gold { background: var(--gold-50); color: var(--gold-600); }

.splash-info-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.splash-info-value {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.splash-bio-card {
  background: #ffffff;
  border-radius: var(--r-lg);
  padding: 18px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  text-align: left;
  margin-bottom: 12px;
}

.splash-bio-card p {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ─── Cabecera Móvil ─── */
.mobile-header {
  display: none;
  background: linear-gradient(135deg, #0c2a45, #0f172a);
  padding: 0 16px;
  height: 56px;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-md);
}

.mobile-menu-btn {
  width: 38px; height: 38px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #ffffff;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

.mobile-logo { display: flex; align-items: center; gap: 8px; }
.mobile-logo-text { display: flex; flex-direction: column; justify-content: center; }
.mobile-logo-prefix { font-size: 0.55rem; font-weight: 700; color: var(--sky-300); text-transform: uppercase; letter-spacing: 0.05em; line-height: 1; }
.mobile-logo-main { font-size: 0.85rem; font-weight: 800; color: #ffffff; line-height: 1.1; }

/* ─── Responsive ─── */
@media (max-width: 1100px) {
  :root { --docpane-width: 320px; }
}

@media (max-width: 860px) {
  body { overflow: auto; }
  .app-container { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }
  .mobile-header { display: flex; }
  .sidebar {
    position: fixed; left: -320px; top: 0; bottom: 0;
    width: 280px; height: 100vh;
    box-shadow: 20px 0 40px rgba(0,0,0,0.3);
    transition: left var(--duration-slow) var(--ease-smooth);
    z-index: 100;
  }
  .sidebar.open { left: 0; }
  .main-content { flex-direction: column; height: auto; overflow: visible; }
  .document-pane { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border-light); }
  .viewer-pane { width: 100%; height: 80vh; }
  .viewer-splash { height: auto; min-height: 400px; }
  .splash-info-grid { grid-template-columns: 1fr; }
}

/* ─── Animaciones globales ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.doc-card { animation: fadeUp 0.3s ease both; }
.doc-card:nth-child(1) { animation-delay: 0.03s; }
.doc-card:nth-child(2) { animation-delay: 0.06s; }
.doc-card:nth-child(3) { animation-delay: 0.09s; }
.doc-card:nth-child(4) { animation-delay: 0.12s; }
.doc-card:nth-child(5) { animation-delay: 0.15s; }

/* ─── Overlay móvil ─── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  z-index: 90;
}
.sidebar-overlay.show { display: block; }
