/* =========================================
   AT8 音乐播放器 - 前台样式
   ========================================= */

#at8mp-player {
    position: fixed;
    bottom: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 桌面端：右下角 / 左下角 */
#at8mp-player.at8mp-bottom-right { right: 24px; }
#at8mp-player.at8mp-bottom-left  { left: 24px; }

/* ========== 开关按钮（无背景，纯音符图标）========== */
#at8mp-player.at8mp-toggle,
.at8mp-toggle {
    width: 52px;
    height: 52px;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.25s ease;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

#at8mp-player.at8mp-toggle:hover,
#at8mp-player.at8mp-toggle:focus,
#at8mp-player.at8mp-toggle:active,
.at8mp-toggle:hover,
.at8mp-toggle:focus,
.at8mp-toggle:active {
    background: transparent;
    border: none;
    box-shadow: none;
    outline: none;
}

/* 按钮内 SVG 音符 */
.at8mp-toggle svg {
    width: 44px;
    height: 44px;
    fill: #ad1457;
    transition: transform 0.3s ease;
}

.at8mp-toggle:hover svg,
.at8mp-toggle:focus svg {
    transform: rotate(-5deg) scale(1.08);
}

#at8mp-player.at8mp-playing .at8mp-toggle {
    animation: at8mp-pulse 1.6s infinite;
}

@keyframes at8mp-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.12); }
}

/* ========== 面板 ========== */
.at8mp-panel {
    position: absolute;
    bottom: 68px;
    width: 280px;
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    color: #333;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

#at8mp-player.is-open .at8mp-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.at8mp-bottom-right .at8mp-panel { right: 0; }
.at8mp-bottom-left  .at8mp-panel { left: 0; }

/* 信息 */
.at8mp-info {
    margin-bottom: 12px;
}

.at8mp-title {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.at8mp-status {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

/* 控制按钮 */
.at8mp-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

.at8mp-ctrl {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
    color: #ad1457;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.at8mp-ctrl:hover {
    background: #ad1457;
    color: #fff;
    transform: scale(1.08);
}

.at8mp-play {
    width: 44px;
    height: 44px;
    font-size: 18px;
}

/* 进度条与音量 */
.at8mp-progress-wrap,
.at8mp-volume-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.at8mp-progress,
.at8mp-volume {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.1);
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.at8mp-progress::-webkit-slider-thumb,
.at8mp-volume::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ad1457;
    -webkit-appearance: none;
    appearance: none;
}

.at8mp-progress::-moz-range-thumb,
.at8mp-volume::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ad1457;
    border: none;
}

.at8mp-time {
    font-size: 11px;
    color: #888;
    min-width: 32px;
    text-align: center;
}

.at8mp-volume-icon {
    font-size: 13px;
    line-height: 1;
}

/* 歌曲列表 */
.at8mp-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 150px;
    overflow-y: auto;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding-top: 8px;
}

.at8mp-song,
.at8mp-empty {
    padding: 7px 10px;
    font-size: 13px;
    color: #555;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.at8mp-song:hover {
    background: rgba(173, 20, 87, 0.08);
    color: #ad1457;
}

.at8mp-song.is-active {
    background: rgba(173, 20, 87, 0.12);
    color: #ad1457;
    font-weight: 600;
}

.at8mp-empty {
    color: #aaa;
    cursor: default;
}

/* ========== 移动端：Logo / 菜单内联模式 ========== */
#at8mp-player.at8mp-mobile-inline {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: 1;
    display: inline-flex;
    vertical-align: middle;
    margin-left: 8px;
}

/* Logo 下方：独占一行并居中 */
#at8mp-player.at8mp-mobile-inline.at8mp-mobile-logo-below {
    display: block;
    margin: 8px 0 0 0;
    text-align: center;
}

#at8mp-player.at8mp-mobile-inline.at8mp-mobile-logo-below .at8mp-toggle {
    margin: 0 auto;
}

/* 菜单中间：紧跟菜单按钮 */
#at8mp-player.at8mp-mobile-inline.at8mp-mobile-menu-center {
    margin-left: 8px;
    margin-right: 0;
}

#at8mp-player.at8mp-mobile-inline .at8mp-toggle svg {
    fill: #ffffff;
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

#at8mp-player.at8mp-mobile-inline .at8mp-toggle {
    width: 36px;
    height: 36px;
}

/* 移动端内联模式：面板固定居中于视口（页面）正中央。
   面板在 JS 打开时会被移到 body 下（.at8mp-centered），
   因此不受 Astra header 的 transform / position 影响，稳定居中 */
#at8mp-player.at8mp-mobile-inline .at8mp-panel,
.at8mp-panel.at8mp-centered {
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: min(280px, 86vw);
    max-height: 80vh;
    overflow-y: auto;
    z-index: 100000;
    transform: translate(-50%, -50%) translateY(8px);
}

#at8mp-player.at8mp-mobile-inline.is-open .at8mp-panel,
.at8mp-panel.at8mp-centered.is-open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%);
}

/* ========== 移动端：侧边中间（旧模式，保留兼容）========== */
@media (max-width: 768px) {
    #at8mp-player.at8mp-mobile-left-mid,
    #at8mp-player.at8mp-mobile-right-mid {
        bottom: auto;
        top: 50%;
        transform: translateY(-50%);
    }

    #at8mp-player.at8mp-mobile-right-mid { right: 12px; left: auto; }
    #at8mp-player.at8mp-mobile-left-mid  { left: 12px; right: auto; }

    #at8mp-player.at8mp-mobile-left-mid .at8mp-panel,
    #at8mp-player.at8mp-mobile-right-mid .at8mp-panel {
        bottom: auto;
        top: 0;
        width: 260px;
    }

    #at8mp-player.at8mp-mobile-right-mid .at8mp-panel {
        right: 64px;
        left: auto;
    }

    #at8mp-player.at8mp-mobile-left-mid .at8mp-panel {
        left: 64px;
        right: auto;
    }
}
