/**
 * Buzzsprout Custom Player Styles
 *
 * Transparent background — designed to sit inside your own Elementor container.
 * Layout: [skip-back | play | skip-fwd | speed] [artwork] [title + date + progress] [i | share | ×]
 */

/* =========================================
   1. VARIABLES & BASE CONTAINER
   ========================================= */

.bsp-player {
    /* Main Theme Colors - Edit these to change everywhere */
    --bsp-text:           #000000;
    --bsp-text-secondary: #777777;
    --bsp-progress-bg:    #d0d0d0;
    --bsp-progress-fill:  #1a1a1a;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: transparent;
    width: 100%;
    box-sizing: border-box;
}

.bsp-player *,
.bsp-player *::before,
.bsp-player *::after {
    box-sizing: border-box;
}

/* =========================================
   2. BUTTON RESET & BASE
   ========================================= */

/* Reset Elementor/theme defaults safely, BUT DO NOT force colors/fonts here so we can edit them later! */
.bsp-player button {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    text-decoration: none !important;
    cursor: pointer !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    
    /* We don't use !important here so we can style them naturally below */
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    white-space: normal;
    transition: opacity 0.15s ease;
}

.bsp-player button:hover,
.bsp-player button:focus {
    opacity: 0.65;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

/* =========================================
   3. LAYOUT STRUCTURE
   ========================================= */

.bsp-player__inner {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.bsp-player__transport {
    display: flex;
    align-items: center;
    gap: 1vw;
    flex-shrink: 0;
}

.bsp-player__content {
    flex: 1;
    min-width: 0;
}

.bsp-player__header {
    min-width: 0;
}

.bsp-player__actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

/* =========================================
   4. TRANSPORT BUTTONS (Controls)
   ========================================= */

/* Skip 15s/30s Buttons */
.bsp-player .bsp-player__skip-btn {
    gap: 1px;
    color: var(--bsp-text);
    font-size: 1rem;
    font-weight: 600;
}
.bsp-player .bsp-player__skip-btn svg { width: 20px; height: 20px; }
.bsp-player__skip-num { display: block; min-width: 14px; text-align: center; }

/* Play Button */
.bsp-player .bsp-player__play-btn {
    color: var(--bsp-text);
    width: 34px;
    height: 34px;
}
.bsp-player .bsp-player__play-btn svg { width: 35px; height: auto; }

/* Speed Button (1x) */
.bsp-player .bsp-player__speed-btn {
    color: var(--bsp-text-secondary);
    font-size: 1rem;
    font-weight: 600;
}

/* =========================================
   5. ARTWORK
   ========================================= */

.bsp-player__artwork {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bsp-progress-bg, #d0d0d0);
    display: flex;
    align-items: center;
    justify-content: center;
}
.bsp-player__artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}
.bsp-player__artwork-icon {
    width: 28px;
    height: 28px;
    opacity: 0.35;
    color: var(--bsp-text, #000);
    flex-shrink: 0;
}

/* =========================================
   6. TITLES & META
   ========================================= */

.bsp-player__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--bsp-text);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bsp-player__date {
    font-size: 0.875rem;
    color: var(--bsp-text-secondary);
    line-height: 1.3;
    margin-top: 2px;
}

/* =========================================
   7. ACTION ICON BUTTONS (Info/Share/Close)
   ========================================= */

.bsp-player .bsp-player__info-btn {
    color: var(--bsp-text);
}

.bsp-player .bsp-player__info-btn:hover {
    color: var(--bsp-text);
    opacity: 1;
}

/* Show/hide the two info icons based on expanded state */
.bsp-player__info-btn .bsp-info-icon--on { display: none; }
.bsp-player__info-btn[aria-expanded="true"] .bsp-info-icon--off { display: none; }
.bsp-player__info-btn[aria-expanded="true"] .bsp-info-icon--on { display: inline; }

/* =========================================
   8. PROGRESS BAR & WAVEFORM
   ========================================= */

.bsp-player__progress-wrap {
    position: relative;
    height: 20px;
    display: flex;
    align-items: center;
}

.bsp-player__waveform {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 5px;
    background: var(--bsp-progress-bg);
    border-radius: 2px;
    overflow: hidden;
    pointer-events: none;
}

.bsp-player__waveform-progress {
    height: 100%;
    width: 0%;
    background: var(--bsp-progress-fill);
    border-radius: 2px;
    transition: width 0.1s linear;
}

.bsp-player__progress {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    -webkit-appearance: none;
    appearance: none;
}

/* =========================================
   9. INFO PANEL (Hidden by default)
   ========================================= */

.bsp-player__info-panel {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--bsp-text);
    padding-top: 12px;
    border-top: 2px solid #e8e8e8;
    margin-top: 10px;
}

.bsp-player__info-panel p {
    margin: 0 0 8px;
}

.bsp-player__info-panel p:last-child {
    margin-bottom: 0;
}

/* =========================================
   10. MULTI-EPISODE LIST SPACING
   ========================================= */

.bsp-player-list .bsp-player--list-item {
    padding: 18px 0;
    border-bottom: 1px solid #eee;
}

.bsp-player-list .bsp-player--list-item:first-child {
    padding-top: 0;
}

.bsp-player-list .bsp-player--list-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* =========================================
   11. RESPONSIVE / MOBILE
   ========================================= */

@media (max-width: 600px) {
    .bsp-player__inner {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    /* Invisible element that forces a row break after row 1 */
    .bsp-player__inner::after {
        content: '';
        order: 2;
        flex-basis: 100%;
        height: 0;
    }

    /* Row 1: artwork + content */
    .bsp-player__artwork {
        order: 1;
        width: 48px;
        height: 48px;
    }

    .bsp-player__content {
        order: 2;
        flex: 1;
        min-width: 0;
    }

    /* Row 2: transport + info button, centered */
    .bsp-player__transport {
        order: 3;
        gap: 20px;
    }

    /* Reorder transport: speed | ←15 | play | 30→ */
    .bsp-player__speed-btn               { order: 1; }
    .bsp-player__skip-btn[data-skip="-15"] { order: 2; }
    .bsp-player__play-btn                { order: 3; }
    .bsp-player__skip-btn[data-skip="30"] { order: 4; }

    .bsp-player__actions {
        order: 3;
    }

    .bsp-player__title {
        font-size: 13px;
    }

    .bsp-player__date {
        font-size: 12px;
    }
}

/* =========================================
   12. EPISODE LIST (DOCK COMPANION)
   ========================================= */

.bsp-episode-list {
    width: 100%;
}

.bsp-episode-list__row {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid #eee;
}

.bsp-episode-list__row:first-child { padding-top: 0; }
.bsp-episode-list__row:last-child  { border-bottom: none; padding-bottom: 0; }

/* Artwork */
.bsp-episode-list__artwork {
    flex-shrink: 0;
    width: 130px;
    height: 130px;
    border-radius: 8px;
    overflow: hidden;
}

.bsp-episode-list__artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Body */
.bsp-episode-list__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Meta: "S2 E5 · 27 February 2025" */
.bsp-episode-list__meta {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--bsp-text-secondary, #777);
    line-height: 1.4;
}

/* Title */
.bsp-episode-list__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--bsp-text, #000);
    line-height: 1.3;
}

.bsp-episode-list__row--active .bsp-episode-list__title {
    opacity: 0.65;
}

/* Excerpt — 2-line clamp, click to expand */
.bsp-episode-list__excerpt {
    font-size: 0.875rem;
    color: var(--bsp-text-secondary, #777);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
    outline: none;
    transition: opacity 0.15s ease;
}

.bsp-episode-list__excerpt:hover { opacity: 0.75; }

.bsp-episode-list__excerpt:focus-visible {
    text-decoration: underline;
}

.bsp-episode-list__excerpt[aria-expanded="true"] {
    display: block;
    overflow: visible;
}

/* Play pill */
.bsp-episode-list__play-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
    align-self: flex-start;
    margin-top: 4px;
    padding: 8px 16px 8px 13px !important;
    border-radius: 999px !important;
    background: var(--bsp-progress-fill, #1a1a1a) !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    transition: opacity 0.15s ease !important;
}

.bsp-episode-list__play-btn:hover,
.bsp-episode-list__play-btn:focus {
    opacity: 0.8 !important;
    background: var(--bsp-progress-fill, #1a1a1a) !important;
    box-shadow: none !important;
}

.bsp-episode-list__play-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.bsp-el-duration {
    line-height: 1;
}

@media (max-width: 600px) {
    .bsp-episode-list__artwork {
        width: 80px;
        height: 80px;
    }
    .bsp-episode-list__row {
        gap: 14px;
    }
    .bsp-episode-list__title {
        font-size: 0.9375rem;
    }
}

/* =========================================
   13. DOCK PLAYER — EMPTY STATE
   ========================================= */

/* Disable controls via data attribute so they re-enable automatically
   when _bspLoad updates player.dataset.audio */
.bsp-player[data-audio=""] .bsp-player__play-btn,
.bsp-player[data-audio=""] .bsp-player__skip-btn,
.bsp-player[data-audio=""] .bsp-player__speed-btn,
.bsp-player[data-audio=""] .bsp-player__info-btn {
    opacity: 0.25;
    pointer-events: none;
    cursor: default !important;
}

.bsp-player__dock-hint {
    color: var(--bsp-text-secondary, #777);
    font-style: italic;
    font-weight: 400;
}
