/* ==========================================================================
   MÓDULO: MESTRADO - ESTRUTURA CURRICULAR (PPGSP IUPERJ)
   Design System Acadêmico, Moderno, Editorial & Responsivo
   ========================================================================== */

/* 1. HERO SECTION PADRÃO IUPERJ */
.ec-hero {
  position: relative;
  background-color: var(--color-primary-dark);
  background-image: url('https://media.visuals.com.br/iuperj/images/heroes/img_topo_estrutura_mestrado.webp');
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  padding: 5.5rem 1.5rem 4.5rem;
  color: #ffffff;
  min-height: 44vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.ec-hero__overlay {
  position: absolute;
  inset: 0;
  background-color: var(--color-burgundy);
  opacity: 0.75;
  mix-blend-mode: darken;
  z-index: 1;
}

.ec-hero__pattern {
  position: absolute;
  inset: 0;
  background-image: url('https://media.visuals.com.br/iuperj/images/iconn041.webp');
  background-position: bottom center;
  background-size: cover;
  opacity: 0.12;
  mix-blend-mode: overlay;
  z-index: 2;
  pointer-events: none;
}

.ec-hero__container {
  position: relative;
  z-index: 3;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.ec-hero__title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 3.2vw, 2.75rem);
  font-weight: 800;
  line-height: 1.2;
  color: #ffffff;
  margin-top: 0.5rem;
  margin-bottom: 0.85rem;
  letter-spacing: -0.015em;
  text-align: center;
}

.ec-hero__lead {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.6;
  text-align: center;
  max-width: 860px;
  margin: 0 auto;
}

/* 2. STATS SUMMARY BAR */
.ec-stats-section {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 2.5rem 0;
  position: relative;
  z-index: 5;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.ec-container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.ec-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.ec-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.25rem 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-top: 4px solid #790505 !important;
  transition: transform 0.2s, box-shadow 0.2s;
}

.ec-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.ec-stat-num {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--color-primary-dark);
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.ec-stat-title {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ec-stat-desc {
  font-size: 0.775rem;
  color: #64748b;
  line-height: 1.4;
}

/* 3. SECTION GENERAL STYLES */
.ec-section {
  padding: 4.5rem 0;
}

.ec-section--alt {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}

.ec-section-header {
  text-align: center;
  max-width: 780px;
  margin: 0 auto 3rem;
}

.ec-section-badge {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #790505;
  background: rgba(121, 5, 5, 0.08);
  padding: 0.35rem 0.85rem;
  margin-bottom: 0.75rem;
}

.ec-section-title {
  font-family: var(--font-heading);
  font-size: clamp(1.65rem, 2.5vw, 2.15rem);
  font-weight: 800;
  color: var(--color-primary-dark);
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

.ec-section-lead {
  font-size: 0.975rem;
  color: #475569;
  line-height: 1.6;
}

/* 4. CREDITOS BREAKDOWN CARDS */
.ec-creditos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.75rem;
}

.ec-credito-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #790505;
  padding: 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  transition: all 0.25s ease;
}

.ec-credito-card:hover {
  border-color: #cbd5e1;
  border-left-color: var(--color-primary-dark);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.ec-credito-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.ec-credito-badge {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: #790505;
  line-height: 1;
}

.ec-credito-type {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.65rem;
  background: #f1f5f9;
  color: #334155;
}

.ec-credito-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-bottom: 0.6rem;
}

.ec-credito-text {
  font-size: 0.925rem;
  color: #475569;
  line-height: 1.6;
}

/* 5. ORGANOGRAMA SEMESTRAL (TIMELINE / ROADMAP) */
.ec-timeline-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.ec-periodo-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-top: 4px solid #790505;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  transition: all 0.25s ease;
}

.ec-periodo-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.ec-periodo-header {
  padding: 1.25rem 1.25rem 1rem;
  background: #fafbfd;
  border-bottom: 1px solid #edf2f7;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ec-periodo-pill {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #ffffff;
  background: var(--color-primary-dark);
  padding: 0.3rem 0.65rem;
}

.ec-periodo-creditos {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  color: #790505;
}

.ec-periodo-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1;
}

.ec-disciplina-item {
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #cbd5e1;
  transition: border-left-color 0.2s;
}

.ec-disciplina-item:hover {
  border-left-color: #790505;
  background: #f1f5f9;
}

.ec-disciplina-item--obrig {
  border-left-color: #790505;
}

.ec-disciplina-item--eletiva {
  border-left-color: #3b82f6;
}

.ec-disciplina-name {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-bottom: 0.2rem;
  line-height: 1.35;
}

.ec-disciplina-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
  line-height: 1.3;
}

.ec-disciplina-tag {
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
}

.ec-disciplina-tag--obrig {
  color: #790505;
}

.ec-disciplina-tag--eletiva {
  color: #1d4ed8;
}

.ec-disciplina-tag--dissert {
  color: #047857;
}

/* 6. ELETIVAS E GRUPOS ESPECIAIS */
.ec-eletivas-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
}

.ec-eletivas-media {
  position: relative;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 20px 40px -15px rgba(3, 35, 68, 0.18);
  border: 1px solid rgba(3, 35, 68, 0.08);
  background-color: #f1f5f9;
}

.ec-eletivas-media img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0;
  transition: transform 0.4s ease;
}

.ec-eletivas-media:hover img {
  transform: scale(1.02);
}

.ec-eletivas-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ec-feature-box {
  display: flex;
  gap: 1.25rem;
  background: #ffffff;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--color-primary-dark);
}

.ec-feature-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: rgba(121, 5, 5, 0.08);
  color: #790505;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ec-feature-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-bottom: 0.35rem;
}

.ec-feature-desc {
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.55;
}

/* 7. CTA / NEXT STEPS BOX */
.ec-cta-section {
  background: #ffffff;
  padding: 4rem 0 5rem;
}

.ec-cta-box {
  background: linear-gradient(135deg, #032344 0%, #1e293b 100%);
  color: #ffffff;
  padding: 3rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  border-left: 6px solid #790505;
}

.ec-cta-content {
  max-width: 650px;
}

.ec-cta-title {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.ec-cta-desc {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
}

.ec-cta-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 1rem;
  flex-shrink: 0;
}

.ec-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.9rem 1.6rem;
  border-radius: 0;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  justify-content: center;
}

.ec-btn--primary {
  background: #790505;
  color: #ffffff;
  border: 1px solid #790505;
}

.ec-btn--primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: #ffffff;
}

.ec-btn--outline {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.ec-btn--outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #ffffff;
  color: #ffffff;
}

/* 8. RESPONSIVE MEDIA QUERIES */
@media (max-width: 1150px) {
  .ec-timeline-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

@media (max-width: 1024px) {
  
  .ec-creditos-grid {
    grid-template-columns: 1fr;
  }
  .ec-timeline-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .ec-eletivas-wrapper {
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem;
    align-items: center;
  }
  .ec-cta-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 2.75rem 2.5rem;
    gap: 1.75rem;
  }
  .ec-cta-content {
    max-width: 100%;
    width: 100%;
  }
  .ec-cta-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 1rem;
    width: auto;
  }
  .ec-btn {
    white-space: nowrap;
    padding: 0.9rem 1.6rem;
    font-size: 0.88rem;
    flex-shrink: 0;
  }
}

@media (max-width: 768px) {
  .ec-eletivas-wrapper {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 640px) {
  
  /* Alinhamento à esquerda nos celulares para cabeçalhos de seção */
  .ec-section-header {
    text-align: left !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 2rem !important;
  }

  .ec-section-badge {
    margin-left: 0 !important;
    margin-right: auto !important;
    display: inline-block !important;
  }

  .ec-section-title {
    text-align: left !important;
  }

  .ec-section-lead {
    text-align: left !important;
  }

  .ec-timeline-grid {
    grid-template-columns: 1fr;
  }
  .ec-hero-title {
    font-size: 1.85rem;
  }
  .ec-credito-card {
    padding: 1.5rem;
  }
  .ec-cta-box {
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 2.25rem 1.5rem !important;
    gap: 1.75rem !important;
  }
  .ec-cta-content {
    max-width: 100% !important;
  }
  .ec-cta-title {
    font-size: 1.45rem !important;
    line-height: 1.3 !important;
    word-break: normal;
  }
  .ec-cta-desc {
    font-size: 0.9rem !important;
    line-height: 1.55 !important;
  }
  .ec-cta-actions {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.85rem !important;
  }
  .ec-btn {
    width: 100%;
    justify-content: center;
  }
}

/* 9. DIRETRIZES PEDAGÓGICAS E IDENTIDADE DO EGRESSO */
.ec-pedagogico-box {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.ec-pedagogico-item {
  display: flex;
  gap: 1.25rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 1.75rem;
  border-top: 3px solid #032344;
  transition: transform 0.2s, box-shadow 0.2s;
}

.ec-pedagogico-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.05);
}

.ec-pedagogico-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: rgba(3, 35, 68, 0.08);
  color: #032344;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ec-pedagogico-text h4 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: #032344;
  margin-bottom: 0.5rem;
}

.ec-pedagogico-text p {
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.6;
  margin: 0;
}

@media (max-width: 1023px) {
  .ec-pedagogico-box {
    grid-template-columns: 1fr;
  }
}

.ec-disciplina-meta > span:last-child {
  white-space: nowrap;
}

@media (max-width: 1200px) {
  .ec-periodo-header {
    padding: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .ec-periodo-body {
    padding: 1rem;
  }
  .ec-disciplina-name {
    font-size: 0.85rem;
  }
}

@media (max-width: 1100px) and (min-width: 769px) {
  .ec-cta-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 2.75rem 2.5rem;
    gap: 1.75rem;
  }
  .ec-cta-content {
    max-width: 100%;
    width: 100%;
  }
  .ec-cta-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 1rem;
  }
  .ec-btn {
    padding: 0.9rem 1.6rem;
    font-size: 0.88rem;
    white-space: nowrap;
  }
}

/* ==========================================================================
   CARROSSEL RESPONSIVO PARA TABLETS (ec-stats-grid)
   Autoplay em loop infinito, 2 colunas visíveis em 1 linha, avançando de 1 em 1,
   sem controladores (setas/bullets), toque/swipe suave
   ========================================================================== */
@media (max-width: 1024px) {
  .ec-stats-section {
    overflow: hidden;
  }

  .ec-stats-carousel-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
  }

  .ec-stats-grid {
    display: flex !important;
    grid-template-columns: none !important;
    flex-wrap: nowrap !important;
    gap: 1.25rem !important;
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* 2 colunas e 1 linha visíveis: cada card ocupa 50% menos metade do gap */
  .ec-stat-card {
    flex: 0 0 calc((100% - 1.25rem) / 2) !important;
    width: calc((100% - 1.25rem) / 2) !important;
    min-width: calc((100% - 1.25rem) / 2) !important;
    box-sizing: border-box !important;
    margin: 0 !important;
  }
}

@media (max-width: 640px) {
  /* Carrossel Mobile Celulares: 1 coluna e 1 linha, 1 card por vez centralizado */
  .ec-stats-carousel-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    overflow: hidden;
  }

  .ec-stats-grid {
    gap: 1.5rem !important;
  }

  .ec-stat-card {
    flex: 0 0 100% !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    text-align: center;
    align-items: center;
    justify-content: center;
    padding: 1.75rem 1.25rem !important;
  }
}

/* ==========================================================================
   AJUSTES RESPONSIVOS PARA CELULARES (CARDS DE CRÉDITOS)
   Evitar quebra de linha de '20 créditos', reduzir tag e melhorar espaçamento
   ========================================================================== */
@media (max-width: 640px) {
  .ec-credito-card {
    padding: 1.5rem 1.25rem;
  }

  .ec-credito-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }

  .ec-credito-badge {
    font-size: 1.25rem;
    white-space: nowrap;
    letter-spacing: -0.3px;
    line-height: 1.2;
    flex-shrink: 0;
  }

  .ec-credito-type {
    font-size: 0.58rem;
    padding: 0.2rem 0.45rem;
    letter-spacing: 0.03em;
    text-align: right;
    white-space: nowrap;
    line-height: 1.2;
    flex-shrink: 0;
  }

  .ec-credito-title {
    font-size: 1.05rem;
    line-height: 1.35;
    margin-bottom: 0.65rem;
  }

  .ec-credito-text {
    font-size: 0.875rem;
    line-height: 1.55;
  }
}

@media (max-width: 380px) {
  .ec-credito-badge {
    font-size: 1.15rem;
  }
  .ec-credito-type {
    font-size: 0.54rem;
    padding: 0.18rem 0.38rem;
  }
}
