/**
 * Cursos Catálogo - Estilos da página de listagem de cursos
 * Otimizado para mobile-first com grid responsivo
 */

/* =============== Course Cards =============== */
.course-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.course-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12) !important;
}

.course-media {
  position: relative;
  overflow: hidden;
}

.course-media img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.course-card:hover .course-media img {
  transform: scale(1.05);
}

.course-title {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.2;
  margin-top: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8rem;
}

.course-desc {
  color: #444;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3.8rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.price-block {
  min-height: 48px;
  margin-top: auto;
}

.pix-block {
  min-height: 22px;
}

/* =============== Ribbon Parametrizável =============== */
.media-hero,
.course-media,
.curso-imagem-wrapper {
  position: relative;
  overflow: hidden;
}

.curso-ribbon {
  /* Variáveis CSS customizáveis */
  --y: 35%;              /* altura em relação à imagem (0% topo, 100% base) */
  --x: 25%;              /* afastamento da borda direita */
  --maxw: 55%;           /* largura máxima da faixa */
  --thickness: 30px;     /* altura da faixa */
  --rotate: -20deg;      /* ângulo da diagonal */
  --alpha: 0.95;         /* transparência do fundo (0–1) */

  position: absolute;
  top: var(--y);
  right: var(--x);
  transform: translateY(-50%) rotate(var(--rotate));
  transform-origin: 100% 50%;
  height: var(--thickness);
  max-width: var(--maxw);
  padding: 0 102px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-radius: 4px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
  z-index: 20;
  pointer-events: none;
}

/* Fundo com transparência controlada (não afeta o texto) */
.curso-ribbon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  opacity: var(--alpha);
}

.curso-ribbon > span {
  position: relative;
  z-index: 1;
}

/* Brilho opcional */
.curso-ribbon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: translateX(-120%);
  animation: ribbon-shine 4s ease-in-out infinite;
}

@keyframes ribbon-shine {
  0% { transform: translateX(-120%); }
  60%, 100% { transform: translateX(120%); }
}

/* Paletas de cores do ribbon */
.ribbon--verde {
  --bg1: #628eeb;
  --bg2: #091e90;
}

.ribbon--laranja {
  --bg1: #ffa94d;
  --bg2: #fd7e14;
}

.ribbon--vermelho {
  --bg1: #ff6b6b;
  --bg2: #e90e0e;
}

/* =============== Empty State =============== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-state i {
  font-size: 4rem;
  color: #6c757d;
  opacity: 0.5;
  margin-bottom: 1rem;
}

.empty-state h4 {
  color: #495057;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: #6c757d;
  margin-bottom: 0;
}

/* =============== Filter Chips =============== */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: #e7f1ff;
  border: 1px solid #b6d4fe;
  border-radius: 20px;
  font-size: 0.875rem;
  color: #084298;
  transition: all 0.2s;
}

.filter-chip:hover {
  background: #cfe2ff;
  border-color: #9ec5fe;
}

.filter-chip .btn-close {
  font-size: 0.7rem;
  padding: 0;
  opacity: 0.6;
}

.filter-chip .btn-close:hover {
  opacity: 1;
}

/* =============== Responsivo Mobile =============== */
@media (max-width: 576px) {
  .curso-ribbon {
    --y: 35%;
    --x: 35%;
    --maxw: 66%;
    --thickness: 24px;
    --rotate: -25deg;
    font-size: 11px;
    padding: 0 10px;
  }

  .course-title {
    font-size: 0.95rem;
    min-height: 2.6rem;
  }

  .course-desc {
    font-size: 0.85rem;
    -webkit-line-clamp: 2;
    min-height: 2.8rem;
  }
}

/* =============== Loading States =============== */
.course-card.loading {
  pointer-events: none;
  opacity: 0.6;
}

.course-card img[loading="lazy"]:not([src*="data:"]) {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =============== Accessibility =============== */
.course-card:focus-within {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

/* =============== Performance - Reduce Motion =============== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =============== Navy Dark Theme Overrides =============== */

/* Ribbon: posição top-right nas cards do catálogo */
.course-media .nv-ribbon {
  top: .7rem;
  bottom: auto;
  right: .7rem;
  font-size: .62rem;
  padding: .28rem .8rem;
  letter-spacing: .08em;
  z-index: 3;
}

/* Gradiente no topo da imagem para contraste do ribbon */
.course-media::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40%;
  background: linear-gradient(to bottom, rgba(8,15,30,.45) 0%, transparent 100%);
  pointer-events: none;
  z-index: 1;
  border-radius: 0;
}

/* Título do curso — sobrepõe text-dark do Bootstrap */
.course-title a,
.course-title a.text-dark {
  color: #f1f5f9 !important;
}

.course-title a:hover {
  color: #fb923c !important;
}

/* Descrição — sobrepõe text-muted do Bootstrap */
.course-desc,
.course-desc.text-muted {
  color: rgba(241,245,249,.6) !important;
}

/* Preço principal — sobrepõe text-primary do Bootstrap */
.price-block .text-primary,
.price-block .fw-bold.text-primary {
  color: #fb923c !important;
}

/* Preço PIX */
.pix-block .text-success,
.pix-block small {
  color: #34d399 !important;
}

/* Card footer — sobrepõe bg-white do Bootstrap */
.card-footer.bg-white,
.course-card .card-footer {
  background: #0d1b2e !important;
  border-top-color: rgba(255,255,255,.08) !important;
}

/* Badge de formato (Presencial/EaD) — mantém leitura no fundo escuro */
.course-media .badge.bg-warning {
  opacity: .92;
  font-weight: 700;
}

/* Focus ring no tema navy */
.course-card:focus-within {
  outline-color: #f97316;
}

/* Filter chips no tema navy */
.filter-chip {
  background: #162236;
  border-color: rgba(255,255,255,.15);
  color: #fb923c;
}

.filter-chip:hover {
  background: #1e3050;
  border-color: rgba(249,115,22,.4);
}

/* Empty state no tema navy */
.empty-state i {
  color: rgba(241,245,249,.3);
  opacity: 1;
}

.empty-state h4 {
  color: #f1f5f9;
}

.empty-state p {
  color: rgba(241,245,249,.55);
}
