/* =============================================
   WP Audio Sticky Player — Frontend
   ============================================= */

#wasp-sticky-player,
#wasp-sticky-player *,
#wasp-sticky-player *::before,
#wasp-sticky-player *::after {
    box-sizing: border-box;
}

#wasp-sticky-player {
    position: fixed;
    bottom: var(--wasp-bottom, 0px);
    left: 50%;
    transform: translateX(-50%);
    width: var(--wasp-pc-max-w, 960px);
    max-width: 96%;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
                 Meiryo, "Segoe UI", Roboto, sans-serif;
}

/* --------------- Player Bar --------------- */

#wasp-player-content {
    background: var(--wasp-bg, #f5f6f7);
    border: 2px solid var(--wasp-accent, #024fa0);
    border-radius: var(--wasp-pc-radius, 12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.wasp-player-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
}

.wasp-player-label {
    font-size: 14px;
    font-weight: bold;
    color: var(--wasp-accent, #024fa0);
    white-space: nowrap;
    flex-shrink: 0;
}

.wasp-player-controls {
    flex: 1;
    min-width: 0;
}

.wasp-player-controls audio {
    width: 100%;
    max-width: 500px;
    height: 40px;
    display: block;
}

#wasp-player-close {
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 6px 10px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

#wasp-player-close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #333;
}

/* --------------- Toggle Button (collapsed) --------------- */

#wasp-player-toggle {
    display: none;
    position: fixed;
    right: 16px;
    bottom: calc(var(--wasp-bottom, 0px) + 16px);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--wasp-accent, #024fa0);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 24px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    z-index: 100000;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

#wasp-player-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

/* --------------- Collapsed State --------------- */

#wasp-sticky-player[data-state="collapsed"] #wasp-player-content {
    display: none;
}

#wasp-sticky-player[data-state="collapsed"] #wasp-player-toggle {
    display: flex;
}

/* --------------- Hidden State --------------- */

#wasp-sticky-player[data-state="hidden"] {
    display: none;
}

/* =============================================
   Mobile (max-width: 600px)
   ============================================= */

@media (max-width: 600px) {
    #wasp-sticky-player {
        width: var(--wasp-sp-width, 95%);
        max-width: 100%;
        bottom: var(--wasp-sp-bottom, var(--wasp-bottom, 0px));
    }

    #wasp-player-content {
        border-radius: var(--wasp-sp-radius, 8px);
    }

    .wasp-player-inner {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 14px;
        position: relative;
        padding-right: 40px;
    }

    /* ラベル: 横幅いっぱい使って折り返し可 */
    .wasp-player-label {
        width: 100%;
        font-size: 12px;
        white-space: normal;
        line-height: 1.5;
    }

    /* 閉じるボタン: 右上に固定 */
    #wasp-player-close {
        position: absolute;
        top: 8px;
        right: 8px;
        font-size: 16px;
        padding: 4px 8px;
    }

    /* audio: 横幅いっぱい、明示的に表示 */
    .wasp-player-controls {
        width: 100%;
        flex: none;
    }

    .wasp-player-controls audio {
        width: 100%;
        max-width: 100%;
        min-height: 40px;
        height: 44px;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* トグルボタン */
    #wasp-player-toggle {
        width: 48px;
        height: 48px;
        font-size: 20px;
        right: 12px;
        bottom: calc(var(--wasp-sp-bottom, var(--wasp-bottom, 0px)) + 12px);
    }
}
