/* ═══════════════════════════════════════════════════════════════
   FileViewerModal — estilos del modal reutilizable de documentos
   Depende de las CSS custom properties definidas en head.php:
     --color-primary, --color-secondary, --color-text-light
   ═══════════════════════════════════════════════════════════════ */

/* ── Tamaño y posición: 75 % de la pantalla ──────────────────── */
.modal-file-viewer {
  max-width: 75vw;
  width: 75vw;
  margin: auto;
}

.fvm-content {
  height: 75vh;
  display: flex;
  flex-direction: column;
  border: none;
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.28),
    0 4px 16px rgba(0, 0, 0, 0.14);
}

/* ── Animación de apertura (override Bootstrap fade) ─────────── */
.modal.fade .modal-file-viewer {
  transform: scale(0.95) translateY(16px);
  opacity: 0;
  transition:
    transform 0.28s cubic-bezier(0.34, 1.42, 0.64, 1),
    opacity   0.22s ease;
}

.modal.show .modal-file-viewer {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ── Backdrop con micro-blur ─────────────────────────────────── */
.modal-backdrop {
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* ── Header ──────────────────────────────────────────────────── */
.fvm-header {
  background: var(--color-primary, #972850);
  color: #fff;
  padding: 0.65rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  min-height: 52px;
}

.fvm-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.fvm-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.fvm-icon {
  font-size: 1.15rem;
  opacity: 0.9;
  flex-shrink: 0;
}

.fvm-title {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 480px;
}

.fvm-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 0.2em 0.55em;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ── Botón Descargar ─────────────────────────────────────────── */
.fvm-btn-download {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  text-decoration: none;
  transition:
    background 0.18s ease,
    border-color 0.18s ease;
  white-space: nowrap;
}

.fvm-btn-download:hover,
.fvm-btn-download:focus {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.6);
  color: #fff;
  text-decoration: none;
}

/* ── Botón cerrar ────────────────────────────────────────────── */
.fvm-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  transition:
    background 0.18s ease,
    transform  0.15s ease;
  flex-shrink: 0;
}

.fvm-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.08);
}

/* ── Cuerpo: contenedor del iframe ───────────────────────────── */
.fvm-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #f0f0f0;
  min-height: 0; /* Necesario para flex + overflow */
}

/* ── Estado de carga ─────────────────────────────────────────── */
.fvm-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: #f8f9fa;
  z-index: 2;
  transition: opacity 0.25s ease;
}

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

.fvm-spinner {
  width: 2.2rem;
  height: 2.2rem;
  color: var(--color-primary, #972850);
  border-width: 3px;
}

.fvm-loading-text {
  font-size: 0.82rem;
  color: #6c757d;
  margin: 0;
}

/* ── iframe ──────────────────────────────────────────────────── */
.fvm-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ── Responsive: móvil ───────────────────────────────────────── */
@media (max-width: 768px) {
  .modal-file-viewer {
    max-width: 95vw;
    width: 95vw;
  }

  .fvm-content {
    height: 82vh;
    border-radius: 10px;
  }

  .fvm-title {
    max-width: 180px;
  }

  .fvm-btn-label {
    display: none; /* Solo el icono en móvil */
  }

  .fvm-btn-download {
    padding: 0.3rem 0.55rem;
  }
}
