/**
 * Podcast Embed Widget Styles
 * Mantém a identidade visual do projeto original
 * + Mobile fixes, mobile player layout (grid) e estados do botão play/pause
 */

/* Base / Reset local */
.podcast-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    max-width: 100%;
    margin: 0 auto;
    overflow-x: hidden;
    box-sizing: border-box;
}
.podcast-widget * {
    box-sizing: border-box;
    max-width: 100%;
}

/* ============================================
   COMPACT LAYOUT
   ============================================ */
.podcast-widget-compact {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    max-width: 100%;
}
.podcast-widget-compact .podcast-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    overflow: hidden;
    width: 100%;
}
.podcast-widget-compact .show-artwork {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    max-width: 80px;
}
.podcast-widget-compact .show-info { flex: 1; min-width: 0; }
.podcast-widget-compact .show-title {
    font-size: 18px; font-weight: 700; color: #000;
    margin: 0 0 4px 0;
    overflow: hidden; text-overflow: ellipsis; white-space: wrap;
}
.podcast-widget-compact .show-author { font-size: 14px; color: #666; margin: 0; }

.podcast-widget-compact .episode-list { padding: 0; margin: 0; overflow-x: hidden; width: 100%; }
.podcast-widget-compact .episode-item {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s; cursor: pointer;
}
.podcast-widget-compact .episode-item:hover { background-color: #f9f9f9; }
.podcast-widget-compact .episode-item:last-child { border-bottom: none; }

.podcast-widget-compact .play-button {
    width: 40px; height: 40px; border-radius: 50%;
    background: #000; color: #fff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s; flex-shrink: 0;
}
.podcast-widget-compact .play-button:hover { background: #333; transform: scale(1.05); }
.podcast-widget-compact .play-button.playing { background: #000; }

.podcast-widget-compact .episode-info { flex: 1; min-width: 0; }
.podcast-widget-compact .episode-duration {
    font-size: 13px; color: #888; font-weight: 600; white-space: nowrap; margin-left: 8px;
}
.podcast-widget-compact .episode-title {
    font-size: 15px; font-weight: 600; color: #000; margin-bottom: 4px;
    overflow: hidden; text-overflow: ellipsis; white-space: wrap;
}
.podcast-widget-compact .episode-date { font-size: 13px; color: #666; }
.podcast-widget-compact .view-all-link {
    display: block; text-align: center; padding: 16px; color: #000;
    text-decoration: none; font-weight: 600; font-size: 14px; transition: background-color 0.2s;
}
.podcast-widget-compact .view-all-link:hover { background-color: #f9f9f9; }

/* ============================================
   FULL LAYOUT
   ============================================ */
.podcast-widget-full {
    background: white; border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden; max-width: 100%;
}
.podcast-widget-full .widget-header {
    display: flex; gap: 24px; padding: 32px;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #f9f9f9 0%, #ffffff 100%);
    overflow: hidden; width: 100%;
}
.podcast-widget-full .show-artwork-large {
    width: 200px; height: 200px; border-radius: 12px; object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); flex-shrink: 0; max-width: 200px;
}
.podcast-widget-full .header-content { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.podcast-widget-full .show-title { font-size: 28px; font-weight: 700; color: #000; margin: 0; line-height: 1.2; }
.podcast-widget-full .show-author { font-size: 16px; color: #666; margin: 0; }
.podcast-widget-full .show-description { font-size: 15px; color: #444; line-height: 1.6; margin: 8px 0; }
.podcast-widget-full .show-actions { display: flex; gap: 12px; margin-top: 8px; }
.podcast-widget-full .btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: 8px; text-decoration: none;
    font-weight: 600; font-size: 14px; transition: all 0.3s; border: none; cursor: pointer;
}
.podcast-widget-full .btn-subscribe { background: #000; color: #fff; }
.podcast-widget-full .btn-subscribe:hover { background: #333; }
.podcast-widget-full .btn-secondary { background: #f0f0f0; color: #333; }
.podcast-widget-full .btn-secondary:hover { background: #e0e0e0; }

.podcast-widget-full .episodes-section { padding: 32px; overflow: hidden; width: 100%; }
.podcast-widget-full .section-title { font-size: 20px; font-weight: 700; color: #000; margin: 0 0 20px 0; }
.podcast-widget-full .episode-card {
    display: flex; gap: 16px; padding: 20px; border-radius: 12px; margin-bottom: 16px;
    background: #f9f9f9; transition: all 0.3s; cursor: pointer;
    position: relative;
}
.podcast-widget-full .episode-card:hover { background: #f0f0f0; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }
.podcast-widget-full .episode-image {
    width: 120px; height: 120px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
}
.podcast-widget-full .episode-content { flex: 1; display: flex; gap: 16px; min-width: 0; }
.podcast-widget-full .play-button-large {
    width: 48px; height: 48px; border-radius: 50%; background: rgba(0,0,0,0.85); color: #fff; border: none;
    cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.3s; flex-shrink: 0;
    transform-origin: center center; will-change: transform;
}
.podcast-widget-full .play-button-large:hover { background: #333; transform: scale(1.05); }

/* Overlay play button on top of episode image (FULL) */
@media (min-width: 481px) {
  .podcast-widget-full .play-button-large {
    position: absolute;
    z-index: 2;
    left: calc(20px + 60px); /* card padding (20) + half of image (120/2) */
    top: calc(20px + 60px);
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
  }
}
@media (min-width: 481px) {
  .podcast-widget-full .play-button-large:hover {
    transform: translate(-50%, -50%) scale(1.08);
    background: rgba(0,0,0,0.95);
  }
}
.podcast-widget-full .episode-details { flex: 1; min-width: 0; }
.podcast-widget-full .episode-title {
    font-size: 16px; font-weight: 700; color: #000; margin: 0 0 8px 0; line-height: 1.3;
}
.podcast-widget-full .episode-description { font-size: 14px; color: #666; line-height: 1.5; margin: 0 0 8px 0; }
.podcast-widget-full .episode-meta { display: flex; gap: 12px; font-size: 13px; color: #888; }
.podcast-widget-full .view-all-link-full {
    display: block; text-align: center; padding: 16px; margin-top: 20px;
    background: #f9f9f9; border-radius: 8px; color: #000; text-decoration: none; font-weight: 600; font-size: 15px;
    transition: all 0.3s;
}
.podcast-widget-full .view-all-link-full:hover { background: #f0f0f0; transform: translateY(-1px); }

/* ============================================
   MINIMAL LAYOUT
   ============================================ */
.podcast-widget-minimal {
    background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden; max-width: 100%;
}
.podcast-widget-minimal .latest-episode {
    display: flex; align-items: center; gap: 16px; padding: 20px; cursor: pointer; transition: background-color 0.2s;
    position: relative;
}
.podcast-widget-minimal .latest-episode:hover { background-color: #f9f9f9; }
.podcast-widget-minimal .episode-artwork {
    width: 96px; height: 96px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
}
.podcast-widget-minimal .episode-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.podcast-widget-minimal .show-name {
    font-size: 13px; color: #666; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.podcast-widget-minimal .episode-title {
    font-size: 16px; font-weight: 700; color: #000; overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.podcast-widget-minimal .play-button-minimal {
    width: 56px; height: 56px; border-radius: 50%; background: rgba(0,0,0,0.85); color: #fff; border: none;
    cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.3s; flex-shrink: 0;
    transform-origin: center center; will-change: transform;
}
.podcast-widget-minimal .play-button-minimal:hover { background: #333; transform: scale(1.05); }

/* Overlay play button on top of episode artwork (MINIMAL) */
@media (min-width: 481px) {
  .podcast-widget-minimal .play-button-minimal {
    position: absolute;
    z-index: 2;
    left: calc(20px + 48px); /* padding (20) + half of artwork (96/2) */
    top: calc(20px + 48px);
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
  }
}
@media (min-width: 481px) {
  .podcast-widget-minimal .play-button-minimal:hover {
    transform: translate(-50%, -50%) scale(1.08);
    background: rgba(0,0,0,0.95);
  }
}

/* ============================================
   AUDIO PLAYER (base)
   ============================================ */
.audio-player-widget {
    position: sticky; bottom: 0;
    background: #000; color: #fff;
    padding: 16px 20px;
    display: flex; align-items: center; gap: 16px;
    border-top: 1px solid #333;
}
.audio-player-widget .player-artwork {
    width: 56px; height: 56px; border-radius: 6px; object-fit: cover; flex-shrink: 0;
}
.audio-player-widget .player-info {
    flex: 0 0 auto; min-width: 150px; max-width: 200px;
}
.audio-player-widget .player-title {
    font-size: 14px; font-weight: 600; color: #fff; margin-bottom: 4px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.audio-player-widget .player-show {
    font-size: 12px; color: #999; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.audio-player-widget .player-controls {
    flex: 1; display: flex; align-items: center; gap: 16px;
}
.audio-player-widget .player-play-pause {
    width: 40px; height: 40px; border-radius: 50%;
    background: #fff; color: #000; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s; flex-shrink: 0;
}
.audio-player-widget .player-play-pause:hover { transform: scale(1.05); }

.audio-player-widget .player-time { flex: 1; display: flex; align-items: center; gap: 12px; }
.audio-player-widget .current-time,
.audio-player-widget .total-time {
    font-size: 12px; color: #ccc; min-width: 40px; text-align: center;
}
.audio-player-widget .progress-bar {
    flex: 1; height: 6px; background: #333; border-radius: 3px; cursor: pointer;
    position: relative; overflow: hidden;
}
.audio-player-widget .progress-fill {
    height: 100%; background: #fff; border-radius: 3px; transition: width 0.1s linear;
}

/* ============================================
   ERROR STATE
   ============================================ */
.podcast-widget-error {
    text-align: center; padding: 60px 20px; background: white;
    border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.podcast-widget-error svg { color: #dc3545; margin-bottom: 16px; }
.podcast-widget-error p {
    font-size: 18px; font-weight: 600; color: #000; margin: 0 0 8px 0;
}
.podcast-widget-error small { font-size: 14px; color: #666; }

/* ============================================
   DARK THEME
   ============================================ */
.podcast-widget[data-theme="dark"] .podcast-widget-compact,
.podcast-widget[data-theme="dark"] .podcast-widget-full,
.podcast-widget[data-theme="dark"] .podcast-widget-minimal {
    background: #1a1a1a; color: #e0e0e0;
}
.podcast-widget[data-theme="dark"] .podcast-header,
.podcast-widget[data-theme="dark"] .widget-header {
    border-bottom-color: #333; background: #1a1a1a;
}
.podcast-widget[data-theme="dark"] .show-title,
.podcast-widget[data-theme="dark"] .episode-title { color: #fff; }
.podcast-widget[data-theme="dark"] .show-author,
.podcast-widget[data-theme="dark"] .episode-date,
.podcast-widget[data-theme="dark"] .episode-duration,
.podcast-widget[data-theme="dark"] .show-description,
.podcast-widget[data-theme="dark"] .episode-description { color: #999; }
.podcast-widget[data-theme="dark"] .episode-item { border-bottom-color: #2a2a2a; }
.podcast-widget[data-theme="dark"] .episode-item:hover,
.podcast-widget[data-theme="dark"] .latest-episode:hover { background-color: #2a2a2a; }
.podcast-widget[data-theme="dark"] .play-button { background: #fff; color: #000; }
.podcast-widget[data-theme="dark"] .play-button:hover { background: #e0e0e0; }
.podcast-widget[data-theme="dark"] .episode-card { background: #2a2a2a; }
.podcast-widget[data-theme="dark"] .episode-card:hover { background: #333; }
.podcast-widget[data-theme="dark"] .btn-secondary { background: #333; color: #fff; }
.podcast-widget[data-theme="dark"] .btn-secondary:hover { background: #444; }
.podcast-widget[data-theme="dark"] .view-all-link { color: #fff; }
.podcast-widget[data-theme="dark"] .view-all-link-full { color: #fff; background: #2a2a2a; }
.podcast-widget[data-theme="dark"] .view-all-link-full:hover { background: #333; }

/* DARK THEME — FULL layout contrast tweaks */
.podcast-widget[data-theme="dark"] .podcast-widget-full .section-title {
    color: #f5f5f5; /* brighten "Latest Episodes" */
}
.podcast-widget[data-theme="dark"] .podcast-widget-full .btn-subscribe {
    background: #ffffff; color: #000; /* brighter primary */
}
.podcast-widget[data-theme="dark"] .podcast-widget-full .btn-subscribe:hover {
    background: #e9e9e9; color: #000;
}
.podcast-widget[data-theme="dark"] .podcast-widget-full .btn-secondary {
    background: #444; color: #fff; /* lighter than #333 for clarity */
}
.podcast-widget[data-theme="dark"] .podcast-widget-full .btn-secondary:hover {
    background: #555; color: #fff;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .podcast-widget-full .widget-header {
        flex-direction: column; align-items: center; text-align: center; padding: 24px;
    }
    .podcast-widget-full .show-artwork-large { width: 150px; height: 150px; }
    .podcast-widget-full .show-actions { justify-content: center; flex-wrap: wrap; }
    .podcast-widget-full .episodes-section { padding: 20px; }
    .podcast-widget-full .episode-card { flex-direction: column; padding: 16px; }
    .podcast-widget-full .episode-image { width: 100%; height: auto; aspect-ratio: 1; }
    .podcast-widget-full .episode-content { flex-direction: column; }

    .audio-player-widget { flex-wrap: wrap; padding: 12px 16px; }
    .audio-player-widget .player-info { order: 1; flex: 1; min-width: 0; max-width: none; }
    .audio-player-widget .player-artwork { order: 0; width: 48px; height: 48px; }
    .audio-player-widget .player-controls { order: 2; width: 100%; margin-top: 8px; }
}
@media (max-width: 480px) {
    .podcast-widget-compact .podcast-header { padding: 16px; }
    .podcast-widget-compact .show-artwork { width: 60px; height: 60px; max-width: 60px; }
    .podcast-widget-compact .show-title { font-size: 16px; }
    .podcast-widget-compact .episode-item { padding: 12px 16px; }
    .podcast-widget-minimal .latest-episode { padding: 16px; }
    .podcast-widget-minimal .episode-artwork { width: 60px; height: 60px; max-width: 60px; }
    .podcast-widget-minimal .play-button-minimal { width: 48px; height: 48px; }
    .podcast-widget-full .widget-header { padding: 20px; }
    .podcast-widget-full .show-artwork-large { width: 120px; height: 120px; max-width: 120px; }
    .podcast-widget-full .episodes-section { padding: 20px; }

    /* Reset overlay on small screens for readability */
    .podcast-widget-full .play-button-large,
    .podcast-widget-minimal .play-button-minimal {
      position: static;
      transform: none;
      box-shadow: none;
    }
}

/* --- Responsive hardening (2025-10-31) --- */
.podcast-widget { width: 100%; max-width: 100%; overflow-x: hidden; }
.podcast-widget .podcast-header,
.podcast-widget .podcast-header-full { display: flex; align-items: center; gap: 12px; }
.podcast-widget .show-artwork,
.podcast-widget .show-artwork-full,
.podcast-widget .episode-image,
.podcast-widget .episode-artwork {
  max-width: 100%;
  border-radius: 8px;
  object-fit: cover;
  aspect-ratio: 1 / 1; /* ensures perfect square when one dimension is auto */
}
.podcast-widget .episodes-full,
.podcast-widget .episode-list { max-width: 100%; }
/* Mobile tweaks */
@media (max-width: 480px) {
  .podcast-widget .show-artwork,
  .podcast-widget .show-artwork-full { width: 56px; height: 56px; }
  .podcast-widget .episode-image,
  .podcast-widget .episode-artwork { width: 56px; height: 56px; }
  .podcast-widget .show-title { font-size: 16px; }
  .podcast-widget .episode-title { font-size: 14px; }
  .podcast-widget .episode-date { font-size: 12px; }
}

/* =========================================================
   MOBILE PLAYER LAYOUT — grid conforme screenshot
   Estrutura: [capa] [título/subtítulo] [botão]
              [capa] [progresso + tempos] [botão]
   (somente <= 480px)
   ========================================================= */
@media (max-width: 480px) {
  .audio-player-widget {
    position: fixed; left: 0; right: 0; bottom: 0;
    width: 100%; max-width: 100%;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: #000; z-index: 2147483000;
  }
  .audio-player-widget .player-controls,
  .audio-player-widget .player-info,
  .audio-player-widget .player-time { min-width: 0 !important; }

  .audio-player-widget {
    display: grid;
    grid-template-columns: 64px 1fr 52px;
    grid-template-rows: auto auto;
    grid-template-areas:
      "art title action"
      "art progress action";
    align-items: center;
    column-gap: 12px;
    row-gap: 8px;
  }
  .audio-player-widget .player-artwork {
    grid-area: art; width: 64px; height: 64px; border-radius: 10px; object-fit: cover;
  }
  .audio-player-widget .player-info {
    grid-area: title; display: grid; gap: 2px; min-width: 0 !important;
  }
  .audio-player-widget .player-title {
    font-weight: 800; font-size: 15px; line-height: 1.2;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .audio-player-widget .player-show {
    font-size: 13px; color: #999;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }

  .audio-player-widget .player-controls { grid-area: action; justify-self: end; }
  .audio-player-widget .player-play-pause { width: 44px; height: 44px; border-radius: 50%; }

  .audio-player-widget .player-time {
    grid-area: progress; display: grid;
    grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; min-width: 0 !important;
  }
  .audio-player-widget .current-time, .audio-player-widget .total-time {
    font-size: 12px; color: #ccc; line-height: 1;
  }
  .audio-player-widget .progress-bar { height: 6px; border-radius: 999px; background: #333; min-width: 0 !important; }
  .audio-player-widget .progress-fill { background: #fff; }
}

/* =========================================================
   PATCH — Estado do botão do PLAYER (play/pause)
   Funciona mesmo sem .playing; usa aria-label/aria-pressed.
   ========================================================= */
.audio-player-widget .player-play-pause {
  background: #fff; color: #000; /* parado */
}
.audio-player-widget .player-play-pause.playing,
.audio-player-widget .player-play-pause.is-playing,
.audio-player-widget .player-play-pause[aria-label*="Pause" i],
.audio-player-widget .player-play-pause[aria-pressed="true"],
.audio-player-widget[data-state="playing"] .player-play-pause {
  background: #000; color: #fff; /* tocando */
}
/* Estado pausado explícito (fallback) */
.audio-player-widget .player-play-pause[aria-label*="Play" i],
.audio-player-widget .player-play-pause[aria-pressed="false"],
.audio-player-widget[data-state="paused"] .player-play-pause,
.audio-player-widget[data-state="stopped"] .player-play-pause {
  background: #fff; color: #000;
}
/* Dark theme – garante contraste */
.podcast-widget[data-theme="dark"] .audio-player-widget .player-play-pause {
  background: #fff; color: #111;
}
.podcast-widget[data-theme="dark"] .audio-player-widget .player-play-pause.playing,
.podcast-widget[data-theme="dark"] .audio-player-widget .player-play-pause.is-playing,
.podcast-widget[data-theme="dark"] .audio-player-widget .player-play-pause[aria-label*="Pause" i],
.podcast-widget[data-theme="dark"] .audio-player-widget .player-play-pause[aria-pressed="true"],
.podcast-widget[data-theme="dark"] .audio-player-widget[data-state="playing"] .player-play-pause {
  background: #000; color: #fff;
}