/* =====================================================================
   CCA — CENTRO DE CAPACITACIÓN AVANZADA
   HOJA DE ESTILOS PRINCIPAL · TEMA STREAMING OBSIDIAN & AMBER
   ===================================================================== */

:root {
  --cca-bg: #080c14;
  --cca-surface: #0e1526;
  --cca-card: #131d33;
  --cca-border: #1e293b;
  --cca-amber: #f59e0b;
  --cca-amber-hover: #d97706;
  --cca-sapphire: #38bdf8;
  --cca-text-main: #f8fafc;
  --cca-text-muted: #94a3b8;
}

.cca-certificate-name {
  font-family: "Great Vibes", cursive;
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

html, body {
  background-color: var(--cca-bg);
  color: var(--cca-text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
  max-width: 100vw;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #080c14;
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* Streaming Smooth Transitions */
.card-hover-effect {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.card-hover-effect:hover {
  transform: translateY(-4px) scale(1.01);
}

/* Modal Backdrops with Blur */
.cca-modal-backdrop {
  background-color: rgba(4, 7, 13, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Pulse badge animation */
@keyframes cca-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.cca-pulse {
  animation: cca-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* =====================================================================
   MOBILE FIRST OPTIMIZATIONS (360px+) & TOUCH ACCESSIBILITY
   ===================================================================== */

/* Mobile Bottom Navigation Bar (Obsidian & Amber Gold) */
.cca-mobile-bottom-nav {
  height: calc(60px + env(safe-area-inset-bottom, 0px));
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  padding-top: 2px;
  background: rgba(8, 12, 20, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(30, 41, 59, 0.85);
  box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.6);
}

.cca-bottom-nav-container {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  height: 100%;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.cca-nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1 1 0;
  min-width: 0;
  width: 20%;
  min-height: 48px;
  padding: 4px 1px;
  color: #94a3b8;
  transition: color 0.15s ease, transform 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  background: transparent;
  border: none;
  cursor: pointer;
}

.cca-nav-item:active {
  transform: scale(0.92);
}

.cca-nav-item .cca-nav-icon {
  stroke-width: 2.1;
  transition: all 0.2s ease;
}

.cca-nav-item .cca-nav-label {
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  transition: all 0.2s ease;
}

/* Estado Activo Profesional */
.cca-nav-item.active {
  color: #f59e0b;
}

.cca-nav-item.active .cca-nav-icon {
  stroke-width: 2.5;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.5));
  transform: translateY(-1px);
}

.cca-nav-item.active .cca-nav-label {
  font-weight: 800;
  color: #fbbf24;
}

.cca-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 3px;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  border-radius: 9999px;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.7);
}

/* Margen inferior para que la barra móvil fija nunca tape el contenido */
.cca-page-content-padding {
  padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px)) !important;
}

@media (min-width: 768px) {
  .cca-page-content-padding {
    padding-bottom: 2.5rem !important;
  }
}

/* 16:9 Responsive Video Aspect Ratio & Drive Player Wrapper */
.cca-video-responsive-container,
.drive-player-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  border-radius: 1rem;
  background-color: #000;
}

.cca-video-responsive-container iframe,
.drive-player-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  z-index: 1;
}

/* Capa de protección UX: Oculta y bloquea el botón emergente externo de Google Drive */
.drive-external-link-cover {
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 56px;
  background-color: #000;
  z-index: 20;
  pointer-events: auto;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  border-top-right-radius: 1rem;
}

/* Pantalla completa segura CCA: Fullscreen sobre el wrapper padre para mantener la cobertura activa */
.drive-player-wrapper:fullscreen,
.cca-video-responsive-container:fullscreen,
.drive-player-wrapper:-webkit-full-screen,
.cca-video-responsive-container:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  padding-bottom: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  background-color: #000 !important;
}

.drive-player-wrapper:fullscreen iframe,
.cca-video-responsive-container:fullscreen iframe,
.drive-player-wrapper:-webkit-full-screen iframe,
.cca-video-responsive-container:-webkit-full-screen iframe {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border: 0 !important;
  z-index: 1 !important;
}

/* En pantalla completa, la cubierta se expande a 70x64 para cobertura total en pantallas de alta resolución */
.drive-player-wrapper:fullscreen .drive-external-link-cover,
.cca-video-responsive-container:fullscreen .drive-external-link-cover,
.drive-player-wrapper:-webkit-full-screen .drive-external-link-cover,
.cca-video-responsive-container:-webkit-full-screen .drive-external-link-cover {
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  width: 70px !important;
  height: 64px !important;
  background-color: #000 !important;
  z-index: 20 !important;
  pointer-events: auto !important;
  border-radius: 0 !important;
}

/* Control discreto de Pantalla Completa CCA */
.cca-player-fs-btn {
  position: absolute;
  top: 10px;
  right: 68px;
  z-index: 25;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: #e2e8f0;
  background-color: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(51, 65, 85, 0.7);
  border-radius: 9999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  user-select: none;
  -webkit-user-select: none;
}

.cca-player-fs-btn:hover {
  background-color: rgba(30, 41, 59, 0.95);
  border-color: rgba(245, 158, 11, 0.6);
  color: #fbbf24;
  transform: translateY(-1px);
}

.cca-player-fs-btn:active {
  transform: translateY(0);
}

.drive-player-wrapper:fullscreen .cca-player-fs-btn,
.cca-video-responsive-container:fullscreen .cca-player-fs-btn,
.drive-player-wrapper:-webkit-full-screen .cca-player-fs-btn,
.cca-video-responsive-container:-webkit-full-screen .cca-player-fs-btn {
  top: 14px !important;
  right: 80px !important;
  padding: 7px 14px !important;
  font-size: 12px !important;
  background-color: rgba(15, 23, 42, 0.9) !important;
  border-color: rgba(71, 85, 105, 0.8) !important;
}

/* Touch Targets: minimum 44px height for mobile interaction */
.cca-touch-target {
  min-height: 44px;
  min-width: 44px;
}

/* Responsive Table -> Cards for screens < 768px */
@media (max-width: 767px) {
  .cca-responsive-table thead {
    display: none;
  }
  .cca-responsive-table, 
  .cca-responsive-table tbody, 
  .cca-responsive-table tr, 
  .cca-responsive-table td {
    display: block;
    width: 100%;
  }
  .cca-responsive-table tr {
    margin-bottom: 1rem;
    border: 1px solid #1e293b;
    border-radius: 1rem;
    padding: 0.75rem;
    background-color: rgba(14, 21, 38, 0.6);
  }
  .cca-responsive-table td {
    padding: 0.5rem 0.25rem;
    text-align: left !important;
    border-bottom: 1px solid rgba(30, 41, 59, 0.4);
  }
  .cca-responsive-table td:last-child {
    border-bottom: none;
    padding-top: 0.75rem;
  }
}

/* Modales en móvil: Contención estricta para evitar cualquier desborde horizontal en 360px+ */
@media (max-width: 640px) {
  .cca-modal-backdrop {
    padding: 0.75rem !important;
  }
  .cca-modal-backdrop > div {
    max-width: calc(100vw - 1.5rem) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* Ocultar barra inferior móvil automáticamente cuando cualquier modal está abierto */
body:has(.cca-modal-backdrop:not(.hidden)) #mobile-bottom-nav {
  display: none !important;
}

/* =====================================================================
   ADMIN: MODAL DETALLE DE VENTA, ACCIONES, ACCESOS Y DEVOLUCIONES
   Garantía de dimensiones físicas completas (Evita 0x0)
   ===================================================================== */
#modal-admin-sale-detail {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  min-width: 100vw !important;
  min-height: 100vh !important;
  z-index: 9999 !important;

  align-items: center;
  justify-content: center;

  padding: 1rem;
  overflow-y: auto;
  box-sizing: border-box !important;

  background: rgba(4, 7, 13, 0.88) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#modal-admin-sale-detail.hidden {
  display: none !important;
}

#modal-admin-sale-detail.flex,
#modal-admin-sale-detail:not(.hidden) {
  display: flex !important;
}

#modal-admin-sale-detail > div {
  width: 100% !important;
  max-width: 672px !important;
  min-width: 0 !important;

  height: auto !important;
  max-height: calc(100vh - 2rem) !important;

  overflow-y: auto !important;
  position: relative !important;
  box-sizing: border-box !important;
  margin: auto !important;
}

