/* =========================================================
   CURSOS VIRTUALES — ITEPREVENGO
   Paleta de marca (reutiliza los valores del :root de style.css)
   ========================================================= */
:root {
  --ite-primary:     #072D70;  /* --iteazul: azul corporativo principal */
  --ite-primary-2:   #051F4D;  /* variante/hover del azul principal */
  --ite-secondary:   #A4C639;  /* --iteverde: color secundario (agregar al carrito, toast) */
  --ite-accent:      #F99400;  /* naranja de marca iteprevengo (badge, COMPRAR, hover) */
  --ite-text-muted:  #666666;  /* gris de textos secundarios */
}

/* =========================================================
   CURSOS VIRTUALES — LISTADO
   ========================================================= */
/* el header del sitio es position:absolute/fixed; se compensa su alto */
.courses { max-width: 100%; padding-top: 130px; }

@media (max-width: 768px) {
  .courses { padding-top: 100px; }
}

/* esta vista ocupa más ancho que el resto del sitio */
.courses .container { width: 94%; max-width: 1600px; margin: 0 auto; }

.title-courses {
  text-align: center;
  color: var(--ite-primary);
  font-size: 45px;
  font-weight: bold;
}

.components-search {
  padding: 20px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  border-bottom: 3px solid var(--ite-primary);
}

.buscador {
  border: 2px solid var(--ite-primary-2);
  border-radius: 25px;
  padding: 10px 20px;
  font-size: 16px;
  width: 400px;
  outline: none;
}
.buscador::placeholder { font-style: italic; }

.categoris {
  border: 2px solid var(--ite-primary);
  border-radius: 25px;
  padding: 10px 20px;
  font-size: 16px;
  width: auto;
  outline: none;
  color: var(--ite-primary);
  font-weight: bold;
  background-color: #fff;
}
.categoris option { color: var(--ite-primary); }

/* TARJETAS */
.row-cursos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 20px;
}

.curso {
  display: flex;
  flex-direction: column;
  background-color: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.2s ease-in-out;
  padding: 10px;
  height: 87vh;
  width: 50vh;
  margin: 0 auto;
}
.curso:hover { transform: translateY(-5px); }

.imagen-curso img {
  width: 100%;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  margin: 0 auto;
}

.div-padding { padding: 15px; }

.curso h3 {
  font-size: 1.6rem;
  color: var(--ite-primary);
  text-align: center;
  margin-bottom: 10px;
}

.contenido ul { list-style: none; padding: 0; margin: 0; }
.contenido ul li { margin-bottom: 5px; font-size: 1.2rem; color: #333; }
.contenido ul li i { margin-right: 5px; color: var(--ite-text-muted); }

.footer-curso { text-align: center; padding: 5px 0; }

.btn-precio-info {
  background-color: var(--ite-primary);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  text-decoration: none;
  width: auto;
  margin: 0 auto;
  font-weight: bold;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.btn-precio-info span { display: inline; color: #000; text-decoration: line-through; }
.btn-precio-info:hover { background-color: var(--ite-primary-2); }

.no-results,
.row-cursos > div[style*="text-align"] {
  text-align: center;
  font-size: 1.5rem;
  color: var(--ite-primary);
  padding: 20px 0;
  font-weight: bold;
}

@media (max-width: 1270px) {
  .row-cursos { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .row-cursos { grid-template-columns: 1fr; justify-content: center; }
  .curso { width: 90%; max-width: 400px; margin: 0 auto; height: auto; }
  .courses .container { width: 90%; padding: 0 20px; }
  .components-search { flex-direction: column; gap: 10px; align-items: stretch; }
  .buscador, .categoris { width: 100%; }
}

/* =========================================================
   BANNER PROMOCIONAL
   ========================================================= */
.promo-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ite-secondary);
  color: var(--ite-primary);
  padding: 12px 20px;
  border-radius: 8px;
  margin: 18px 0 24px 0;
  font-size: 2.1rem;
  line-height: 1.5;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}
.promo-banner svg { flex-shrink: 0; opacity: 0.85; }
.promo-banner strong { font-weight: 700; }
@media (max-width: 600px) {
  .promo-banner { flex-direction: column; align-items: flex-start; font-size: 1.25rem; gap: 6px; }
}

/* =========================================================
   CARRITO FLOTANTE
   ========================================================= */
#cart-widget {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  z-index: 9999;
}

#cart-toggle {
  position: relative;
  background: var(--ite-primary);
  color: #fff;
  border: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
}
#cart-toggle:hover { background: var(--ite-accent); transform: scale(1.05); }

.cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--ite-accent);
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 2px solid #fff;
}
.cart-count.bump { animation: cart-bump 0.4s ease; }
@keyframes cart-bump {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

.cart-modal {
  position: absolute;
  top: 70px;
  right: 0;
  width: 380px;
  max-width: 90vw;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  animation: cart-slide-in 0.25s ease;
  display: flex;
  flex-direction: column;
}
@keyframes cart-slide-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.cart-modal-header {
  background: var(--ite-primary);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 10px 10px 0 0;
  flex-shrink: 0;
}
.cart-modal-header h3 { margin: 0; font-size: 16px; font-weight: 600; }

#cart-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.cart-modal-body {
  max-height: 200px;
  overflow-y: auto;
  padding: 0 10px;
  flex-shrink: 0;
}

.cart-empty { text-align: center; padding: 30px 15px; color: #888; font-size: 14px; }

.cart-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cart-table thead th {
  background: #f5f5f5;
  padding: 8px 6px;
  text-align: left;
  font-weight: 600;
  color: var(--ite-primary);
  font-size: 11px;
  border-bottom: 2px solid var(--ite-accent);
  position: sticky;
  top: 0;
  z-index: 1;
}
.cart-table tbody td { padding: 10px 6px; border-bottom: 1px solid #eee; vertical-align: middle; }
.cart-table tbody td:first-child { max-width: 170px; word-wrap: break-word; }

.cart-remove-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #d9534f;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}
.cart-remove-btn:hover { transform: scale(1.15); }

.cart-modal-footer {
  border-top: 2px solid var(--ite-accent);
  background: #fafafa;
  border-radius: 0 0 10px 10px;
  flex-shrink: 0;
}

.cart-discount-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #f0faf0;
  color: #2e7d32;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 18px;
  border-bottom: 1px solid #c8e6c9;
}
.cart-discount-bar svg { flex-shrink: 0; }

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: var(--ite-primary);
  font-size: 15px;
  padding: 12px 18px 10px;
}
.cart-total-prices { display: flex; align-items: center; gap: 8px; }
.cart-price-original { font-size: 14px; font-weight: 600; color: #999; text-decoration: line-through; }
#cart-total-amount { font-size: 15px; font-weight: 700; color: var(--ite-primary); }

.cart-checkout-btn {
  display: block;
  width: calc(100% - 36px);
  margin: 0 18px 14px;
  background: var(--ite-accent);
  color: #fff;
  border: none;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.cart-checkout-btn:hover:not(:disabled) { background: var(--ite-primary); }
.cart-checkout-btn:disabled { background: #ccc; cursor: not-allowed; }

.btn-add-cart {
  background-color: var(--ite-secondary);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  text-decoration: none;
  width: auto;
  margin: 8px auto 0;
  font-weight: bold;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.btn-add-cart:hover { background: var(--ite-accent); color: #fff; }

.cart-toast {
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ite-secondary);
  color: #fff;
  padding: 12px 22px;
  border-radius: 6px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  font-size: 14px;
  font-weight: 500;
  animation: toast-in 0.3s ease;
}
.cart-toast.toast-warning { background: var(--ite-accent); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.hidden { display: none !important; }

@media (max-width: 480px) {
  #cart-widget { right: 15px; top: 40%; }
  .cart-modal { width: calc(100vw - 30px); right: -10px; border-radius: 10px; }
  .cart-modal-body { max-height: 150px; }
}
