/* ============================================
   ESTILOS GERAIS
   ============================================ */

/* Prevent horizontal scroll on the entire page */
html,
body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Fallback: Contain overflow at page content level */
/* .movie-sections-content {
  overflow-x: hidden;
  max-width: 100%;
} */

.badge {
  gap: 8px;
  font-family: "Inter", sans-serif;
  font-size: 16px;
  font-weight: 400;
  width: 24px;
  height: 24px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-link {
  background-color: #fff;
  color: #0a376e !important;
  padding: 0.5rem 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid #0a376e;
}

.nav-link:hover {
  background-color: #072a54;
  color: #fff !important;
}

.nav-link.active {
  background-color: #fff !important;
  color: var(--main-blue-950) !important;
  border: 1px solid var(--main-blue-950) !important;
}

/* ============================================
   COMPONENTE: DETALHES TÉCNICOS
   template-parts/filme-single/detalhes.php
   ============================================ */

.technical-details {
  max-width: 100%;
}

.technical-details-row {
  display: flex;
  border-bottom: 1px solid #e0e0e0;
  padding: 12px 0;

}

.technical-details-row:last-child {
  border-bottom: none;
}

.technical-details-label {
  font-weight: 600;
  color: #333;
  flex-shrink: 0;
  width: 220px;
}

.technical-details-value {
  color: #666;
  flex-grow: 1;
}

/* ============================================
   COMPONENTE: SOBRE
   template-parts/filme-single/sobre.php
   ============================================ */
/* Estilos específicos para a tab "Sobre" podem ser adicionados aqui */

/* ============================================
   COMPONENTE: ELENCO E EQUIPE
   template-parts/filme-single/elenco.php
   ============================================ */

.elenco-container {
  width: 100%;
  margin-top: 1rem;
  position: relative;
}

.elenco-swiper {
  width: 100%;
  overflow: hidden;
}

.elenco-swiper .swiper-wrapper {
  display: flex;
  align-items: stretch;
}

.elenco-card-image-wrapper {
  width: 170px;
  height: 170px;
  margin-bottom: 0.75rem;
  position: relative;
  flex-shrink: 0;
}

.elenco-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid #e0e0e0;
  transition: border-color 0.3s ease;
}

.elenco-card-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #0a376e 0%, #1a4a8a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #e0e0e0;
  transition: border-color 0.3s ease;
}

.elenco-card:hover .elenco-card-placeholder {
  border-color: #0a376e;
}

.elenco-card-placeholder span {
  color: #fff;
  font-size: 2rem;
  font-weight: 600;
  text-transform: uppercase;
}

.elenco-card-name {
  /* width: 100%; */
  /* padding: 0 0.5rem; */
}

.elenco-card-name span {
  font-size: 16px;
  font-weight: 500;
  color: #333;
  line-height: 1.4;
  word-wrap: break-word;
  display: block;
}

/* ============================================
   COMPONENTE: FOTOS E VÍDEOS
   template-parts/filme-single/fotos.php
   ============================================ */

.filme-galeria {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.filme-galeria img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* ============================================
   COMPONENTE: AVALIAÇÕES
   template-parts/filme-single/avaliacoes.php
   ============================================ */
/* Estilos específicos para a tab "Avaliações" podem ser adicionados aqui */

/* ============================================
   COMPONENTE: PRÊMIOS
   template-parts/filme-single/premios.php
   ============================================ */
/* Estilos específicos para a tab "Prêmios" podem ser adicionados aqui */

/* ============================================
   COMPONENTE: MATÉRIAS
   template-parts/filme-single/materias.php
   ============================================ */
/* Estilos específicos para a tab "Matérias" podem ser adicionados aqui */

/* ============================================
   FILM DETAILS SECTION STYLES
   ============================================ */

/* Main title - large, semibold, dark gray */
.film-main-title {
  font-size: 36px;
  font-weight: 600;
  color: var(--main-gray-950, #303030);
  line-height: 1;
  margin-bottom: 0.5rem;
}

/* Original title - smaller, light gray */
.film-original-title {
  font-size: 18px;
  color: var(--main-gray-500, #6d6d6d);
  line-height: 1.4;
}

/* Meta info row (year, badge, duration) */
.film-meta-info {
  font-size: 16px;
  color: var(--main-gray-950, #303030);
  gap: 15px;
}

.film-year,
.film-duration {
  color: var(--main-gray-950, #303030);
  font-size: 16px;
}

.film-meta-separator {
  color: var(--main-gray-500, #6d6d6d);
  font-size: 16px;
  margin: 0;
}

/* Credits section */
.film-credits-section {
  font-size: 14px;
  line-height: 1.6;
}

.film-credit-item {
  display: block;
  line-height: 1.6;
}

.film-credit-label {
  color: var(--main-gray-500, #6d6d6d);
  font-weight: 400;
  white-space: nowrap;
  margin-right: 0.5rem;
}

.film-credit-names {
  display: inline;
  line-height: 1.6;
}

/* Credit links - bold, blue, clickable */
.film-credit-link {
  color: var(--main-blue-950, #0a2463);
  font-weight: 700;
  text-decoration: none;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.film-credit-link:hover {
  color: var(--main-blue-800, #1e40af);
  text-decoration: underline;
}

.film-credit-link:focus {
  outline: 2px solid var(--main-blue-950, #0a2463);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ============================================
   FILM RATING SECTION
   ============================================ */

.film-rating-section {
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.film-rating-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--main-gray-950, #303030);
  flex-shrink: 0;
}

.film-rating-stars {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.film-star {
  font-size: 22px;
  line-height: 1;
  display: inline-block;
  width: 23px;
  height: 22px;
  text-align: center;
  font-family: Arial, sans-serif;
}

.film-star-filled {
  color: #fbbf24;
}

.film-star-empty {
  color: #fbbf24;
  opacity: 0.3;
}

.film-star-half {
  color: #fbbf24;
  background: linear-gradient(90deg, #fbbf24 50%, rgba(251, 191, 36, 0.3) 50%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ============================================
   FILM RATING BADGES
   ============================================ */

.film-rating-badge-wrapper {
  flex-shrink: 0;
}

.film-rating-badge {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
}

.film-rating-badge--square {
  border-radius: 0.375rem;
}

.film-rating-badge--circle {
  border-radius: 50%;
}

/* Rating title and count labels (Críticos/Público) */
.film-rating-title {
  font-family: "Inter", sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--main-gray-950, #303030);
  line-height: 1.2;
}

.film-rating-count {
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--main-gray-600, #5d5d5d);
  line-height: 1.2;
}

/* ============================================
   LAYOUT GERAL E RESPONSIVIDADE
   ============================================ */

/* Mobile poster next to title */
.film-title-mobile-wrapper {
  align-items: flex-start;
}

.film-poster-mobile {
  flex-shrink: 0;
}

.film-poster-mobile .film-poster {
  max-width: 120px;
  width: 120px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

/* Tabs Section */
.tabs-section {
  padding: 1.5rem 0;
}

@media (max-width: 768px) {
  .tabs-section {
    padding: 1rem 0;
  }
}

.tabs-container {
  display: flex;
  gap: 13px;
  flex-wrap: wrap;
}

/* Horizontal scroll for tabs on mobile */
@media (max-width: 768px) {
  .tabs-container {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    padding-bottom: 0.5rem;
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .tabs-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
  }

  .tabs-container .tab-btn {
    flex-shrink: 0;
    white-space: nowrap;
  }
}

.tab-btn {
  padding: 8px 10px;
  border: 2px solid var(--color-main, #0a376e);
  border-radius: 50px;
  background: white;
  color: var(--color-main, #0a376e);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
  height: 37px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tab-btn:hover {
  background: rgba(10, 55, 110, 0.05);
}

.tab-btn.active {
  background: var(--color-main, #0a376e);
  color: white;
}

/* ============================================
   POSTER E CARD ALINHAMENTO
   ============================================ */

.film-poster-container {
  align-self: stretch;
}

.film-poster-skeleton {
  width: 236px;
  aspect-ratio: 2 / 3;
  background: var(--main-gray-200, #e5e7eb);
  border-radius: 0.375rem;
  overflow: hidden;
  position: relative;
}

.film-poster-skeleton::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
  animation: skeleton-shimmer 1.5s infinite;
}

.film-poster-skeleton.loaded {
  background: none;
}

.film-poster-skeleton.loaded::before {
  display: none;
}

.film-poster-mobile .film-poster-skeleton {
  width: 150px;
}

@keyframes skeleton-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.film-poster-container img {
  max-width: 236px;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

.film-info-container {
  flex: 1;
  align-self: stretch;
  min-width: 0;
}

/* Make poster column + bordered info box the same height (desktop) */
@media (min-width: 768px) {
  .film-header-row {
    align-items: stretch !important;
  }

  .film-poster-container {
    display: flex;
    align-items: stretch;
  }

  .film-poster-container .film-poster-skeleton {
    height: 100%;
    aspect-ratio: auto;
  }

  .film-poster-container .film-poster {
    display: block;
    height: 100%;
    width: auto;
    object-fit: cover;
  }
}

/* Seção de informações do filme (título, direção, etc) */
.film-details-section {
  flex: 2;
  min-width: 0;
}

/* Container de ratings e streaming */
.film-ratings-container {
  flex: 1 0 auto;
  align-self: center;
  display: flex;
  flex-direction: column;
  padding-right: 1rem;
  max-width: 360px;
}

@media (min-width: 992px) {
  .film-details-section {
    min-width: 450px;
  }

  .film-info-container {
    gap: 2rem !important;
  }
}

/* ============================================
   RECENTS SECTION
   ============================================ */

.recentes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.recentes-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--main-blue-1000, #0a2463);
  margin: 0;
}

.recentes-clear-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  color: #666;
  font-size: 16px;
  cursor: pointer;
  padding: 0.5rem;
  transition: color 0.2s;
}

.recentes-clear-btn:hover {
  color: #ef4444;
}

.recentes-clear-btn svg {
  width: 20px;
  height: 20px;
}

.recentes-swiper {
  overflow: hidden;
}

.recentes-movie-card {
  display: flex;
  flex-direction: column;
}

.recentes-movie-poster {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.75rem;
  aspect-ratio: 2/3;
}

.recentes-movie-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recentes-movie-poster a {
  display: block;
  width: 100%;
  height: 100%;
}

.recentes-movie-ratings {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.recentes-rating {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.recentes-rating-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.recentes-rating-icon svg {
  width: 100%;
  height: 100%;
}

.recentes-rating-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: #22c55e;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  min-width: 32px;
  text-align: center;
}

.recentes-rating-value.rating-yellow {
  background: #eab308;
}

.recentes-rating-value.rating-red {
  background: #ef4444;
}

.recentes-movie-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--main-blue-1000, #0a2463);
  margin: 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recentes-movie-title a {
  color: inherit;
  text-decoration: none;
}

.recentes-movie-title a:hover {
  text-decoration: underline;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

/* Desktop: credit items inline (label + names on same row) */
@media (min-width: 769px) {
  .film-credits-section .film-credit-item {
    line-height: 1.6;
  }
}

@media (max-width: 768px) {
  .technical-details-row {
    display: grid;
    grid-template-columns: minmax(100px, 35%) 1fr;
    column-gap: 16px;
    padding: 14px 0;
  }

  .technical-details-label {
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: fit-content;
  }

  .technical-details-value {
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .film-poster-container {
    display: none;
  }

  .film-info-container {
    width: 100%;
    padding: 1rem;
  }

  /* Flatten both containers so their children become direct flex children of .film-info-container */
  .film-details-section {
    display: contents !important;
  }

  .film-ratings-container {
    display: contents !important;
  }
/* reorder for mobile */
  .film-title-mobile-wrapper {
    order: 1;
    width: 100%;
  }

  .film-ratings-and-stars {
    order: 2;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 0.75rem 0;
  }

  .film-ratings-scores {
    width: 100%;
    justify-content: center;
  }

  .film-rating-badge-wrapper {
    width: 40px;
    height: 40px;
  }

  .film-rating-badge {
    width: 40px;
    height: 40px;
    font-size: 20px;
    font-weight: 600;
  }

  .film-rating-section {
    /* width: 100%; */
    margin: 0 !important;
  }

  .film-rating-section .avaliar-btn {
    justify-content: flex-start;
  }

  .film-star {
    font-size: 22px;
    width: 23px;
    height: 22px;
  }

  .film-rating-label {
    font-size: 14px;
    font-weight: 600;
  }

  .film-credits-section {
    order: 4;
    width: 100%;
  }

  .film-streaming-section {
    order: 5;
    width: 100%;
    padding-top: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .film-title-mobile-wrapper {
    margin-bottom: 1rem;
  }

  .film-main-title {
    font-size: 20px;
    line-height: 1.1;
  }

  .film-original-title {
    font-size: 14px;
  }

  .film-credits-section {
    font-size: 14px;
  }

  /* Mobile rating labels match Figma mobile spec */
  .film-rating-title {
    font-size: 14px;
    font-weight: 600;
    color: #161117;
  }

  .film-rating-count {
    font-size: 12px;
    font-weight: 400;
    color: var(--main-gray-500, #6d6d6d);
  }

  /* Mobile age badge: 16×16px with 12px text */
  .film-meta-info .badge {
    width: 16px;
    height: 16px;
    font-size: 12px;
    padding: 0 !important;
  }

  .film-meta-info {
    font-size: 14px;
    color: var(--main-gray-500, #6d6d6d);
    gap: 6px;
  }

  .film-year,
  .film-duration {
    font-size: 14px;
    color: var(--main-gray-500, #6d6d6d);
  }

  .film-meta-separator {
    font-size: 14px;
  }

  /* Credits table-like rows with dividers */
  .film-credits-section .film-credit-item {
    border-top: 1px solid #e5e7eb;
    border-bottom: none;
    padding: 10px 0;
    margin-bottom: 0 !important;
  }

  /* Bottom border only on the very last credit item in the section */
  .film-credits-section > .film-credit-item:last-child {
    border-bottom: 1px solid #e5e7eb;
  }

  .film-credit-label {
    margin-bottom: 0;
    color: #000;
    font-weight: 400;
    font-size: 12px;
    line-height: 1.5;
  }

  .film-credit-names {
    font-weight: 600;
    color: var(--main-blue-950, #0a376e);
    font-size: 14px;
    line-height: 1.35;
  }

  /* Onde assistir centered on mobile */
  .film-streaming-section > .text-sm {
    display: block;
    text-align: center;
    font-weight: 600;
  }

  .filme-galeria {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
  }

  .elenco-swiper {
    padding: 1rem 0 2rem 0;
  }

  .elenco-card-image-wrapper {
    width: 90px;
    height: 90px;
  }

  .elenco-card-placeholder span {
    font-size: 1.75rem;
  }

  .elenco-card-name span {
    font-size: 0.85rem;
  } 

  #section-sobre {
    margin-top: -40px;
  }
}

@media (max-width: 575px) {
  .film-poster-mobile .film-poster {
    max-width: 150px;
    width: 150px;
    aspect-ratio: 2 / 3;
    object-fit: cover;
  }

  .film-info-container {
    padding: 1rem !important;
  }

  .film-title-mobile-wrapper {
    gap: 1rem;
  }

  .film-main-title {
    font-size: 20px;
    line-height: 1.1;
  }

  .film-original-title {
    font-size: 14px;
  }

  .film-meta-info {
    font-size: 14px;
  }

  .film-credits-section {
    font-size: 14px;
  }

  .film-credit-label {
    min-width: 64px;
  }

  .filme-galeria {
    grid-template-columns: 1fr;
  }

  .elenco-swiper {
    padding: 1rem 0 2rem 0;
  }

  .elenco-card-image-wrapper {
    width: 80px;
    height: 80px;
  }

  .elenco-card-placeholder span {
    font-size: 1.5rem;
  }

  .elenco-card-name span {
    font-size: 1rem;
  }
}

/* ============================================
   COMPONENTE: AD CONTAINER
   ============================================ */

.ad-container-filme {
  width: 1220px;
  height: 125px;
  max-width: 100%;
  margin: 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f5f5f5;
  border: 1px dashed #ddd;
  box-sizing: border-box;
}

.ad-placeholder-filme {
  color: #999;
  font-size: 14px;
  text-align: center;
}

/* Responsive adjustments for ad container */
@media (max-width: 1220px) {
  .ad-container-filme {
    width: 100%;
    height: auto;
    min-height: 125px;
    padding: 10px;
  }
}