/* ==========================================================================
   DRFLIX — VIDEO STREAMING INTERFACE
   Token system
   Color:
     --drflix-bg:            #080808  (fundo principal)
     --drflix-bg-elevated:   #141414  (headers com fundo, modal)
     --drflix-bg-card:       #1c1c1c  (placeholder de cards)
     --drflix-accent:        #17E3C4  (verde-água — assinatura da marca)
     --drflix-accent-dim:    #0F9E8B
     --drflix-gold:          #E8B563  (destaque secundário, usado com moderação)
     --drflix-text:          #F4F4F4
     --drflix-text-dim:      #A6A6A6
     --drflix-text-faint:    #6E6E6E
   Type:
     Display: 'Manrope' (700/800) — títulos, hero
     Body:    'Inter' (400/500/600) — parágrafos, metadados
   ========================================================================== */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #080808;
  color: #F4F4F4;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

*:focus-visible {
  outline: 2px solid #17E3C4;
  outline-offset: 2px;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { text-decoration: none; color: inherit; }

/* Remove o atraso de ~300ms que navegadores mobile aplicam em toques,
   enquanto aguardam para ver se é um gesto de zoom com dois dedos. Sem
   isso, botões e cards pareciam "atrasados" para responder no celular. */
.drflix-video-platform button,
.drflix-video-platform a,
.drflix-video-platform .drflix-video-card,
.drflix-video-platform .drflix-profile,
.drflix-modal button,
.drflix-modal a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.drflix-video-platform {
  position: relative;
  min-height: 100vh;
  overflow-x: clip;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.drflix-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 18px 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0) 100%);
  transition: background-color .35s ease, padding .35s ease, box-shadow .35s ease;
}

.drflix-header.is-scrolled {
  background: rgba(8,8,8,0.94);
  backdrop-filter: blur(10px);
  padding: 12px 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.drflix-header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.drflix-header-left {
  display: flex;
  align-items: center;
  gap: 36px;
  min-width: 0;
}

.drflix-logo {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.02em;
  color: #F4F4F4 !important;
  white-space: nowrap;
  text-decoration: none !important;
}

.drflix-logo span { color: #17E3C4 !important; }

.drflix-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.drflix-nav-link {
  font-size: 14px;
  font-weight: 500;
  color: #C7C7C7 !important;
  text-decoration: none !important;
  transition: color .2s ease;
  white-space: nowrap;
}

.drflix-nav-link:hover,
.drflix-nav-link.is-active {
  color: #F4F4F4 !important;
}

.drflix-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.drflix-icon-btn {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  color: #F4F4F4 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  transition: background-color .2s ease;
}

.drflix-icon-btn:hover { background: rgba(255,255,255,0.08) !important; }

.drflix-search-input {
  width: 0;
  opacity: 0;
  padding: 0;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.06);
  color: #F4F4F4;
  border-radius: 8px;
  font-size: 14px;
  transition: width .3s ease, opacity .3s ease, padding .3s ease;
}

.drflix-search-input.is-open {
  width: 200px;
  opacity: 1;
  padding: 8px 12px;
  border-color: rgba(255,255,255,0.15);
}

.drflix-profile-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #17E3C4, #0F9E8B);
  color: #06201C;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

/* ==========================================================================
   HERO
   ========================================================================== */
.drflix-hero {
  position: relative;
  height: 72vh;
  min-height: 480px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: #080808; /* evita "vazar" branco quando a imagem ainda não carregou */
}

.drflix-hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #080808; /* mesmo motivo: garante fundo escuro mesmo sem thumbnail definida */
}

.drflix-hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  opacity: 0;
  transition: opacity .4s ease;
}

.drflix-hero-image.is-loaded { opacity: 1; }

.drflix-hero-gradient-side {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(8,8,8,0.95) 0%, rgba(8,8,8,0.55) 35%, rgba(8,8,8,0.05) 65%, rgba(8,8,8,0) 100%);
}

.drflix-hero-gradient-bottom {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 45%;
  background: linear-gradient(to bottom, rgba(8,8,8,0) 0%, #080808 100%);
}

.drflix-hero-content {
  position: relative;
  z-index: 1;
  max-width: 640px;
  padding: 0 clamp(20px, 4vw, 56px) clamp(48px, 8vh, 96px);
}

.drflix-hero-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #06201C;
  background: #17E3C4;
  padding: 5px 12px;
  border-radius: 6px;
  margin-bottom: 18px;
}

.drflix-hero-title {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  text-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.drflix-hero-description {
  font-size: 16px;
  line-height: 1.6;
  color: #D4D4D4;
  margin: 0 0 28px;
  max-width: 520px;
}

.drflix-hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.drflix-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  transition: transform .18s ease, background-color .18s ease, opacity .18s ease;
}

.drflix-btn:active { transform: scale(0.97); }

/* !important nos botões: temas WordPress costumam estilizar
   "button"/"a.button" globalmente com alta especificidade (ex: cor de
   marca do tema aplicada em todo <button>). Isso blinda o componente
   sem depender da ordem de carregamento do CSS do tema. */
.drflix-btn-primary {
  background: #F4F4F4 !important;
  color: #080808 !important;
  border: none !important;
  box-shadow: none !important;
  text-decoration: none !important;
}

.drflix-btn-primary:hover,
.drflix-btn-primary:focus { background: #17E3C4 !important; color: #06201C !important; }

.drflix-btn-secondary {
  background: rgba(255,255,255,0.14) !important;
  color: #F4F4F4 !important;
  border: none !important;
  box-shadow: none !important;
  text-decoration: none !important;
  backdrop-filter: blur(6px);
}

.drflix-btn-secondary:hover,
.drflix-btn-secondary:focus { background: rgba(255,255,255,0.24) !important; color: #F4F4F4 !important; }

/* ==========================================================================
   MAIN / SECTIONS
   ========================================================================== */
.drflix-main {
  position: relative;
  z-index: 2;
  padding: 8px 0 64px;
  margin-top: -64px;
}

.drflix-section {
  padding: 26px 0;
}

.drflix-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 56px);
  margin-bottom: 14px;
}

.drflix-section-title {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
  margin: 0;
}

/* ==========================================================================
   CARROSSEL
   ========================================================================== */
.drflix-row-wrap {
  position: relative;
  padding: 0 clamp(20px, 4vw, 56px);
}

.drflix-row-viewport {
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  /* espaço extra para o card ampliado no hover não ser cortado */
  padding: 40px 0 56px;
  margin: -40px 0 -56px;
}

.drflix-row-viewport::-webkit-scrollbar { display: none; }

.drflix-video-row {
  display: flex;
  gap: 10px;
  width: max-content;
}

.drflix-row-arrow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(90deg, #080808 20%, rgba(8,8,8,0) 100%) !important;
  border: none !important;
  box-shadow: none !important;
  color: #F4F4F4 !important;
  z-index: 5;
  opacity: 0;
  transition: opacity .2s ease;
}

.drflix-row-wrap:hover .drflix-row-arrow { opacity: 1; }

.drflix-row-arrow.drflix-arrow-right {
  right: 0;
  background: linear-gradient(270deg, #080808 20%, rgba(8,8,8,0) 100%);
}

.drflix-row-arrow.drflix-arrow-left { left: 0; }

.drflix-row-arrow svg { width: 28px; height: 28px; }

/* ==========================================================================
   CARDS
   ========================================================================== */
.drflix-video-card {
  position: relative;
  flex: 0 0 auto;
  width: 240px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: visible;
  cursor: pointer;
}

.drflix-video-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  overflow: hidden;
  background: #1c1c1c;
  transition: transform .28s cubic-bezier(.25,.8,.25,1), box-shadow .28s ease, border-radius .28s ease;
  transform-origin: center;
}

.drflix-video-card-image {
  /* position:absolute (em vez de filho normal do flow) evita que o card
     inteiro colapse de altura quando a imagem ainda não tem um src válido
     (thumbnail automática ainda carregando, ou vídeo cuja capa falhou).
     Vale pra qualquer largura de tela — por isso está aqui na regra base,
     não só dentro do breakpoint mobile. */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.drflix-video-card-image--empty {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1c1c1c, #262626);
}

/* Enquanto a thumbnail automática do YouTube/Vimeo ainda está sendo
   resolvida, o card mostra o mesmo visual do placeholder "sem capa" —
   não é um novo estilo, só reaproveita o gradiente já existente. */
.drflix-video-card-image.drflix-thumb-loading {
  background: linear-gradient(135deg, #1c1c1c, #262626);
}

.drflix-empty-state {
  max-width: 1600px;
  margin: 0 auto;
  padding: 48px clamp(20px, 4vw, 56px);
  color: #A6A6A6;
  font-size: 14px;
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: 10px;
}

.drflix-video-card-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0,0,0,0.7);
  padding: 3px 7px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.drflix-video-card-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(8,8,8,0.55) !important;
  border: 1.5px solid rgba(255,255,255,0.75) !important;
  box-shadow: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .22s ease, transform .22s ease, background-color .22s ease;
}

.drflix-video-card-play svg { width: 16px; height: 16px; fill: #F4F4F4; margin-left: 2px; }

.drflix-video-card-info {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 12px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.55) 55%, rgba(0,0,0,0) 100%);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .22s ease, transform .22s ease;
}

.drflix-video-card-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 4px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.drflix-video-card-desc {
  font-size: 11.5px;
  color: #C7C7C7;
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.drflix-video-card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #06201C;
  background: #E8B563;
  padding: 3px 7px;
  border-radius: 4px;
  z-index: 2;
}

/* Hover: desktop apenas */
@media (hover: hover) and (pointer: fine) {
  .drflix-video-card:hover {
    z-index: 20;
  }

  .drflix-video-card:hover .drflix-video-card-inner {
    transform: scale(1.32);
    border-radius: 8px;
    box-shadow: 0 20px 46px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
  }

  .drflix-video-card:hover .drflix-video-card-play {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  .drflix-video-card:hover .drflix-video-card-play:hover {
    background: #17E3C4;
    border-color: #17E3C4;
  }

  .drflix-video-card:hover .drflix-video-card-play:hover svg { fill: #06201C; }

  .drflix-video-card:hover .drflix-video-card-info {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   MODAL
   ========================================================================== */
.drflix-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.drflix-modal.is-open { display: flex; }

.drflix-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4,4,4,0.88);
  backdrop-filter: blur(4px);
  animation: drflixFadeIn .2s ease;
}

.drflix-modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 920px;
  background: #141414;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  animation: drflixModalIn .25s cubic-bezier(.25,.8,.25,1);
}

@keyframes drflixFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes drflixModalIn { from { opacity: 0; transform: scale(0.96) translateY(12px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.drflix-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none !important;
  box-shadow: none !important;
  background: rgba(8,8,8,0.7) !important;
  color: #F4F4F4 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .2s ease, transform .2s ease;
}

.drflix-modal-close:hover { background: #17E3C4 !important; color: #06201C !important; transform: rotate(90deg); }

.drflix-modal-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.drflix-modal-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  background: #000;
}

.drflix-modal-loading span {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #17E3C4;
  animation: drflixSpin .7s linear infinite;
}

@keyframes drflixSpin { to { transform: rotate(360deg); } }

.drflix-modal-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.drflix-modal-info { padding: 20px 24px 26px; }

.drflix-modal-title {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 20px;
  margin: 0 0 8px;
}

.drflix-modal-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 12.5px;
  color: #A6A6A6;
}

.drflix-modal-duration { color: #17E3C4; font-weight: 600; }

.drflix-modal-category {
  border: 1px solid rgba(255,255,255,0.18);
  padding: 2px 9px;
  border-radius: 4px;
}

.drflix-modal-description {
  font-size: 14px;
  line-height: 1.6;
  color: #D4D4D4;
  margin: 0;
}

.drflix-modal-fallback {
  display: inline-block;
  margin-top: 12px;
  font-size: 12.5px;
  color: #17E3C4 !important;
  text-decoration: underline !important;
}

.drflix-modal-fallback:hover { color: #F4F4F4 !important; }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.drflix-footer {
  text-align: center;
  padding: 32px 20px 48px;
  color: #6E6E6E;
  font-size: 12.5px;
}

/* ==========================================================================
   RESPONSIVO
   ========================================================================== */

/* Tablet: ~3-4 cards visíveis */
@media (max-width: 1024px) {
  .drflix-video-card { width: 220px; }
  .drflix-hero { height: 68vh; }
}

/* Celular: ~1.5-2.2 cards visíveis, sem depender de hover */
@media (max-width: 640px) {
  .drflix-nav { display: none; }

  .drflix-header-inner { padding: 0 16px; }

  .drflix-hero { height: 62vh; min-height: 420px; }

  .drflix-hero-content { padding: 0 16px 36px; max-width: 100%; }
  .drflix-hero-description { font-size: 14px; }

  .drflix-btn { padding: 11px 18px; font-size: 14px; }

  .drflix-section-header { padding: 0 16px; }

  .drflix-row-wrap { padding: 0 16px; }

  .drflix-row-arrow { display: none; }

  /* vw em vez de % — o card vive num row com width:max-content,
     então uma largura percentual não teria base de cálculo estável */
  .drflix-video-card { width: 45vw; max-width: 260px; }

  .drflix-video-card-inner { transform: none !important; box-shadow: none !important; }

  .drflix-video-card-info {
    opacity: 1;
    transform: none;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
  }

  .drflix-video-card-desc { display: none; }

  .drflix-video-card-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .drflix-video-card-play {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.85);
    width: 36px;
    height: 36px;
  }

  .drflix-modal-info { padding: 16px 18px 20px; }
  .drflix-modal-title { font-size: 17px; }
}

/* Respeita preferência de movimento reduzido */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
