/* ==========================================================================
   1. VARIABLES Y BASE
============================================================================= */

:root {
  --azul-unam-dark: #05264D;
  --azul-unam-light: #1260b5;
  --gris-fondo: #F4F6F9;
  --texto-oscuro: #0F172A;
  --blanco: #FFFFFF;
  --gris-borde: #CBD5E1;
}

* { 
  box-sizing: border-box;
}

body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--texto-oscuro);
  background-color: var(--gris-fondo);
  margin: 0;
  padding: 0;
  scroll-padding-top: 180px;
}

/* ==========================================================================
   2. BARRA SUPERIOR INSTITUCIONAL
============================================================================= */

.top-nav-bar {
  background-color: var(--azul-unam-light);
  color: var(--blanco);
  padding: 12px 30px;
  display: flex;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.top-nav-left,
.top-nav-center,
.top-nav-right,
.social-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-logo {
  height: 40px;
  width: auto;
  filter: brightness(0) invert(1);
  transition: transform 0.3s ease;
}

a .top-logo:hover {
  transform: scale(1.1);
}

.user-greeting {
  font-size: 0.9rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.18);
  padding: 6px 16px;
  border-radius: 20px;
  color: #FFF;
}

.social-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #f0f2f4;
  background-color: transparent;
  transition: transform 0.2s ease, color 0.2s ease, background-color 0.2s ease !important;
}

.social-icon:hover {
  transform: translateY(-3px) scale(1.1) !important;
}

.social-icon.facebook:hover { color: #1877f2 !important; background-color: #e7f1ff !important; }
.social-icon.instagram:hover { color: #e44066 !important; background-color: #fce8ec !important; }
.social-icon.x:hover { color: #000000 !important; background-color: #f1f5f9 !important; }
.social-icon.youtube:hover { color: #ff0000 !important; background-color: #ffe6e6 !important; }
.social-icon.gmail:hover { color: #ea4335 !important; background-color: #fce8e6 !important; }

.home-icon-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: 20px;
  transition: background 0.2s ease;
}

.home-icon-link:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Redes Sociales Responsivo */
.social-toggle-btn { display: none; }

@media screen and (max-width: 768px) {
  .social-dropdown-wrapper { position: relative; }
  .social-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
  }
  .social-links {
    display: none !important;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #071d3ac2;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    border-radius: 8px;
    padding: 10px 14px;
    gap: 14px;
    z-index: 3500;
  }
  .social-dropdown-wrapper.active .social-links {
    display: flex !important;
  }
}

/* ==========================================================================
   3. TARJETAS DE CURSOS Y EFECTO HOVER
============================================================================= */

.cart-item-card,
.recommended-course-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
              border-color 0.25s ease;
  will-change: transform, box-shadow;
}

/* EFECTO HOVER EN LOS CURSOS */
.cart-item-card:hover,
.recommended-course-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(18, 96, 181, 0.12);
  border-color: #9cc3ef;
}

.course-info {
  flex: 1;
}

.course-title {
  font-size: 1rem;
  border-left: 4px solid #05264D;
  font-weight: 700;
  color: #0F172A;
  margin: 0 0 4px 0;
}

.course-price {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0e3156;
}

/* Botón de Agregar Curso (+ Agregar) */
.btn-add-course {
  background-color: #0e253d;
  color: #FFFFFF;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-add-course:hover {
  background-color: #0E4B8E;
  transform: scale(1.04);
}

/* ==========================================================================
   4. BOTÓN DE BOTE DE BASURA ANIMADO (DESDE EL VIDEO)
============================================================================= */

.btn-trash-animated {
  background: #fee2e200;
  border: none;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  color: #c23b3b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.btn-trash-animated:hover {
  background-color: #fca5a500;
  color: #0a2957;
  transform: scale(1.08);
}

.trash-svg {
  overflow: visible;
  width: 20px;
  height: 20px;
}

/* Tapa animada del bote de basura */
.trash-lid {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: 4px 4px;
}

.btn-trash-animated:hover .trash-lid {
  transform: rotate(-30deg) translateY(-2px);
}

/* Asegura que el clic siempre se registre en el <button> y no se "atrape" en el SVG */
#btn-delete-credencial svg,
#btn-delete-credencial path {
  pointer-events: none;
}

/* Botón de cerrar tipo tachita redonda */
.cart-item-remove-btn-over_modal {
  background: #FFFFFF;
  color: #888080;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.cart-item-remove-btn-over_modal:hover {
  background: #b10c0cef;
  color: #FFFFFF; 
}


/* ==========================================================================
   5. CAJA DE ADJUNTAR CREDENCIAL (DISEÑO SEGUNDA IMAGEN)
============================================================================= */

.credencial-upload-box {
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

/* Estado ROJO: Pendiente */
.credencial-upload-box.credencial-pending {
  background-color: #FEF2F2 !important;
  border: 1.5px dashed #EF4444 !important;
}

.credencial-upload-box.credencial-pending .credencial-status {
  color: #B91C1C;
}

/* Estado VERDE: Subido Correctamente (Como en la imagen 2) */
.credencial-upload-box.credencial-success {
  background-color: #F0FDF4 !important;
  border: 1.5px solid #86EFAC !important;
}

.credencial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.credencial-header label {
  font-size: 0.86rem;
  font-weight: 700;
  color: #0F172A;
}

/* Botón Eliminar archivo arriba a la derecha con el icono rojo */
.btn-delete-credencial {
  background: transparent;
  border: none;
  color: #EF4444;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
}

.btn-delete-credencial:hover {
  color: #B91C1C;
  text-decoration: underline;
}

/* Contenedor del selector de archivos (Cuadro blanco interior) */
.file-select-wrapper {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.file-select-wrapper input[type="file"] {
  display: none; /* Ocultamos el input feo del navegador */
}

/* Botón estilo "Elegir archivo" en azul oscuro */
.btn-custom-choose-file {
  background-color: #0F172A;
  color: #FFFFFF;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-custom-choose-file:hover {
  background-color: #1E293B;
}

.file-chosen-name {
  font-size: 0.85rem;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* Mensaje verde de éxito de archivo adjuntado */
.credencial-status {
  font-size: 0.84rem;
  font-weight: 700;
  margin: 6px 0 0 0;
}

.credencial-success .credencial-status {
  color: #15803D;
}

/* Fila contenedora: botones separados equitativamente */
.modal-buttons-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px; /* Distancia de separación entre botones */
    margin-top: 24px;
    width: 100%;
}

/* Estilo base compartido para ambos botones */
.btn-modal-cancel,
.btn-modal-confirm {
    flex: 1; /* Hace que ambos botones midan exactamente lo mismo */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-sizing: border-box;
}

/* Botón Cancelar */
.btn-modal-cancel {
    background-color: #F1F5F9;
    color: #475569;
    border: 1px solid #CBD5E1;
}

.btn-modal-cancel:hover {
    background-color: #E2E8F0;
    color: #1E293B;
    border-color: #94A3B8;
}

/* Botón Confirmar / Enviar */
.btn-modal-confirm {
    background-color: #1260B5;
    color: #FFFFFF;
    border: 1px solid #1260B5;
    box-shadow: 0 2px 4px rgba(18, 96, 181, 0.2);
}

.btn-modal-confirm:hover {
    background-color: #0E4B8F;
    border-color: #0E4B8F;
    box-shadow: 0 4px 8px rgba(18, 96, 181, 0.3);
}

.btn-modal-confirm:active,
.btn-modal-cancel:active {
    transform: translateY(1px);
}

/* ==========================================================================
   6. CONTENEDORES Y REGISTRO
============================================================================= */

.full-cart-container {
  max-width: 1250px;
  margin: 90px auto 40px auto;
  padding: 0 20px;
  box-sizing: border-box;
}

.full-cart-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 32px;
  align-items: start;
}

.cart-section-title {
  border-left: 4px solid #3f79c1;
  font-size: 1.35rem;
  padding-left: 5px;
  color: #0F172A;
  margin-top: 0;
  margin-bottom: 16px;
  font-weight: 700;
}

.cart-section-title.extra-top {
  margin-top: 32px;
}

.full-cart-summary-card {
  background-color: #ffffff;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid #E2E8F0;
}

.card-main-title {
  border-left: 4px solid #1260B5;
  padding-left: 10px;
  margin-top: 0;
  margin-bottom: 20px;
  color: #0F172A;
  font-size: 1.2rem;
}

.drawer-form-group {
  margin-bottom: 14px;
}

.drawer-form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: #334155;
}

.drawer-form-group input,
.form-control-select {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #CBD5E1;
  font-size: 0.9rem;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.drawer-form-group input:focus,
.form-control-select:focus {
  outline: none;
  border-color: #1260B5;
}

.full-cart-total-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  border-top: 1px solid #E2E8F0;
  padding-top: 16px;
}

.full-cart-total-box span { font-size: 0.95rem; font-weight: 600; color: #0F172A; }
.full-cart-total-box strong { font-size: 1.25rem; font-weight: 800; color: #0F172A; }

.btn-submit-dark {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  background-color: #0F172A;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-submit-dark:hover {
  background-color: #1E293B;
}

.hidden { display: none !important; }

@media (max-width: 900px) {
  .full-cart-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   7. MODALES CENTRADOS Y COMPROBANTE
============================================================================= */

.custom-modal-overlay {
  display: none;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background-color: rgba(15, 23, 42, 0.65) !important;
  backdrop-filter: blur(4px);
  z-index: 99999 !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px;
  box-sizing: border-box;
}

.custom-modal-box {
  background: #ffffff !important;
  width: 100%;
  max-width: 480px;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  text-align: left;
  animation: modalScale 0.2s ease-out forwards;
}

.receipt-card-box {
  background: #ffffff !important;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  animation: modalScale 0.2s ease-out forwards;
  position: relative;
  padding-top: 35px;
}

.btn-modal-close-icon {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: #64748B;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-modal-close-icon:hover {
  background: #F1F5F9;
  color: #0F172A;
}

.receipt-header-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #E2E8F0;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.receipt-logo-side {
  height: 48px;
  max-height: 48px;
  width: auto;
  object-fit: contain;
}

.receipt-title-box { text-align: center; flex: 1; }
.receipt-main-title { font-size: 1.05rem; color: #1260B5; margin: 0; line-height: 1.2; }
.receipt-sub { font-size: 0.8rem; color: #64748B; margin: 4px 0 16px 0; text-align: center; }

.receipt-badge {
  background-color: #DCFCE7;
  color: #15803D;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 8px 12px;
  border-radius: 6px;
  text-align: center;
  margin-bottom: 14px;
}

.receipt-info-text { font-size: 0.85rem; color: #1e2c40; margin-bottom: 16px; text-align: center; }

.receipt-details-list {
  background: #F8FAFC;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid #E2E8F0;
  margin-bottom: 20px;
}

.receipt-row { display: flex; justify-content: space-between; font-size: 0.88rem; margin-bottom: 8px; color: #334155; }

.receipt-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 2px dashed #CBD5E1;
  padding-top: 10px;
  margin-top: 12px;
  font-size: 1rem;
  color: #0F172A;
}

.receipt-actions-row { display: flex; gap: 12px; margin-top: 20px; }

.btn-receipt-download {
  flex: 1;
  background-color: #0F172A;
  color: #ffffff;
  border: none;
  padding: 12px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-receipt-download:hover { background-color: #1E293B; }

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@media print {
  body * { visibility: hidden; }
  #receipt-modal, #receipt-modal .receipt-card-box, #receipt-modal .receipt-card-box * { visibility: visible; }
  #receipt-modal {
    position: absolute !important;
    left: 0 !important; top: 0 !important;
    width: 100% !important; height: auto !important;
    background: none !important; backdrop-filter: none !important; padding: 0 !important;
  }
  .receipt-card-box { box-shadow: none !important; border: 1px solid #CBD5E1 !important; max-width: 100% !important; }
  .receipt-actions-row, .btn-modal-close-icon { display: none !important; }
}

/* ==========================================================================
   ESTILOS HOVER PARA TARJETAS DE CURSOS SELECCIONADOS Y RECOMENDADOS
   ========================================================================== */

/* 1. Tarjetas del carrito (cursos seleccionados) */
.cart-item-card {
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.cart-item-card:hover {
  background-color: #e2eaf4 !important; /* Azul muy claro */
  border-color: #BFDBFE !important;     /* Borde azul suave */
  box-shadow: 0 4px 12px rgba(18, 96, 181, 0.15); /* Sombra azulada suave */
}

/* Cambiar color del título y del precio dentro de las tarjetas del carrito */
.cart-item-card:hover .cart-item-title,
.cart-item-card:hover h4 {
  color: #091230 !important; /* Azul oscuro elegante */
}

.cart-item-card:hover .cart-item-price,
.cart-item-card:hover span {
  color: #2755b8 !important; /* Azul más vivo para el precio */
}

/* 2. Tarjetas de Cursos Recomendados */
#full-cart-recommendations-container > div,
#cart-recommendations > div {
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

#full-cart-recommendations-container > div:hover,
#cart-recommendations > div:hover {
  background-color: #EFF6FF !important; /* Azul muy claro */
  border-color: #BFDBFE !important;     /* Borde azul suave */
  box-shadow: 0 4px 12px rgba(18, 97, 181, 0.114);
}

/* Cambiar color de textos en recomendados */
#full-cart-recommendations-container > div:hover div,
#cart-recommendations > div:hover div {
  color: #102c4b !important;

}

/* ==========================================================================
   NUEVA NAVEGACIÓN Y MENÚ DESPLEGABLE
============================================================================= */
.main-nav-bar {
  background-color: var(--azul-unam-dark);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  justify-content: center;
  padding: 0 20px;
}

.main-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 20px;
  align-items: center;
}

.main-nav-item {
  position: relative;
}

.main-nav-link {
  color: var(--blanco);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s ease, color 0.2s ease;
  border-radius: 4px;
}

.main-nav-link:hover, 
.main-nav-item:hover > .main-nav-link {
  background-color: var(--azul-unam-light);
  color: var(--blanco);
}

/* Menú Desplegable (Dropdown) */
.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--blanco);
  min-width: 220px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 8px 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.25s ease;
  z-index: 2000;
  border: 1px solid var(--gris-borde);
}

.main-nav-item:hover .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown li a {
  color: var(--texto-oscuro);
  padding: 10px 18px;
  text-decoration: none;
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-dropdown li a:hover {
  background-color: var(--gris-fondo);
  color: var(--azul-unam-light);
}

/* ==========================================================================
   AJUSTES DE NAVEGACIÓN PRINCIPAL
   ========================================================================== */
.main-nav-bar {
  background-color: var(--azul-unam-dark);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  justify-content: flex-start;
  padding: 0 20px;
}

.main-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 15px;
  align-items: center;
}

.main-nav-item {
  position: relative;
}

.main-nav-link {
  color: var(--blanco);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s ease, color 0.2s ease;
  border-radius: 4px;
}

.main-nav-link:hover, 
.main-nav-item:hover > .main-nav-link {
  background-color: var(--azul-unam-light);
  color: var(--blanco);
}

/* Descarga del comprobante de solicitud */
.solicitud-descarga {
    margin: 24px 0;
    padding: 20px 0;
    border-top: 1px solid #dfe7f1;
    border-bottom: 1px solid #dfe7f1;
}

.solicitud-descarga-boton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border-radius: 8px;
    background: #145da8;
    color: white;
    text-decoration: none;
    font-weight: 700;
}

.solicitud-descarga-boton:hover {
    background: #05264d;
    color: white;
}

.solicitud-descarga-boton:focus-visible {
    outline: 3px solid #c7a858;
    outline-offset: 4px;
}

.solicitud-descarga p {
    margin: 12px 0 0;
    color: #52667d;
    font-size: 14px;
}

/* Campo auxiliar para detectar llenado automatizado */
.inscripcion-control-auxiliar {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    pointer-events: none;
}