/* ==========================================================================
   components.css — 通用可复用组件：宣群链接、卡片、Toast、动画、毛玻璃、音乐
   依赖顺序：base.css → layout.css → components.css
   ========================================================================== */

/* ===== 群聊宣群视频链接（B 站粉色主题） ===== */
.group-link-wrap {
    display: flex;
    justify-content: center;
    margin: 2.4rem auto 2.2rem;
}

.group-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.8rem;
    border-radius: 999px;
    background: rgba(251, 114, 153, 0.1);
    border: 1px solid rgba(251, 114, 153, 0.35);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.group-link-btn:hover {
    background: rgba(251, 114, 153, 0.18);
    border-color: #fb7299;
    color: #fb7299;
    transform: translateY(-1px);
}

.group-link-btn .fa-bilibili {
    color: #fb7299;
    font-size: 1.25rem;
}

.group-link-btn .fa-arrow-up-right-from-square {
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: color 0.2s ease, transform 0.2s ease;
}

.group-link-btn:hover .fa-arrow-up-right-from-square {
    color: #fb7299;
    transform: translate(1px, -1px);
}

/* ===== 通用信息卡片（卡片 / key-value / 地址复制） ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    background: var(--bg-card-hover);
}

.card-icon {
    font-size: 1.6rem;
    margin-bottom: 0.6rem;
    display: inline-block;
}

.card h3 {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.card-main {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.card-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.2rem;
}

/* key-value 统一行布局 */
.kv-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.4rem 0;
    border-bottom: 1px dashed rgba(36, 48, 62, 0.5);
}

.kv-row:last-of-type {
    border-bottom: none;
}

.kv-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.kv-value {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    text-align: right;
    word-break: break-all;
}

.kv-value.code {
    color: var(--accent);
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 500;
}

.ip-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.7rem;
}

.ip-copy {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    width: 100%;
    padding: 0.55rem 0.8rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.1s ease;
}

.ip-copy:hover {
    border-color: var(--accent);
    background: rgba(88, 166, 255, 0.1);
}

.ip-copy:active {
    transform: scale(0.98);
}

.ip-label {
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.ip-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    font-family: 'Consolas', 'Courier New', monospace;
    word-break: break-all;
}

.ip-hint {
    margin-top: 0.7rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ===== Toast 提示框系统 ===== */
.toast-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    z-index: 100;
    pointer-events: none;
}

.toast {
    position: fixed;
    right: 1.5rem;
    bottom: 2rem; /* 初始值，实际由 JS 计算 bottom */
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 460px;
    max-width: 520px;
    background: #1a2330;
    border: 1px solid var(--primary);
    color: var(--text);
    padding: 0.85rem 1rem 0.9rem;
    border-radius: 10px;
    font-size: 0.9rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    transform: translateX(100%);
    opacity: 0;
    pointer-events: auto;
    overflow: hidden;
    transition: bottom 0.4s cubic-bezier(0.22, 1, 0.36, 1), transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.45s ease;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.hide {
    transform: translateX(100%);
    opacity: 0;
}

.toast-msg {
    flex: 1;
    word-break: break-all;
}

.toast-close {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
}

.toast-close:hover {
    background: rgba(248, 81, 73, 0.25);
    color: var(--danger);
}

.toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: var(--primary);
    transform-origin: left;
    transform: scaleX(0);
    opacity: 1;
    animation: toastProgress 2.5s linear forwards;
}

@keyframes toastProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* Toast 小屏幕适配 */
@media (max-width: 768px) {
    .toast {
        min-width: 0;
        max-width: none;
        left: 1rem;
        right: 1rem;
        width: auto; /* 由 left/right 决定，避免溢出 */
        padding: 0.8rem 0.9rem 0.85rem;
    }
}

@media (max-width: 480px) {
    .toast {
        left: 0.75rem;
        right: 0.75rem;
        width: auto; /* 由 left/right 决定 */
        gap: 0.6rem;
        font-size: 0.85rem;
    }
}

/* ===== 全局动画 ===== */
/* 动画 */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* 入场动画：淡入上移 */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-up {
    animation: fadeUp 0.6s ease both;
}

/* 「服主的话」页面：淡入更舒缓，时间更长 */
body.page-words .fade-up {
    animation-duration: 1.4s;
}

body.page-words .hero .tagline.fade-up { animation-delay: 0.2s; }
body.page-words .hero .page-title.fade-up { animation-delay: 0.35s; }
body.page-words .hero .subtitle.fade-up { animation-delay: 0.5s; }
body.page-words .hero .owner-block.fade-up { animation-delay: 0.7s; }
body.page-words .letter-card.fade-up { animation-delay: 0.9s; }
body.page-words .back-home-wrap.fade-up { animation-delay: 1.1s; }

/* 依次延迟错落入场 */
.hero h1.fade-up { animation-delay: 0.05s; }
.hero .tagline.fade-up { animation-delay: 0.15s; }
.hero .subtitle.fade-up { animation-delay: 0.25s; }
.hero .badges.fade-up { animation-delay: 0.35s; }
.info-grid.fade-up { animation-delay: 0.35s; }
.status-section.fade-up { animation-delay: 0.45s; }
.guide-section.fade-up { animation-delay: 0.65s; }
.footer.fade-up { animation-delay: 0.75s; }

/* ===== 音乐播放按钮（右下角，始终可见） ===== */
.music-controls {
    position: fixed;
    right: 20px;
    bottom: 78px; /* 避开吸底页脚 */
    z-index: 90;
}

.music-toggle {
    width: 48px;
    height: 48px;
    border: 2px solid rgba(53, 208, 127, 0.5);
    border-radius: 50%;
    background: rgba(24, 32, 44, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--primary);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    margin-left: auto; /* 右对齐，让面板从左侧展开 */
}

.music-toggle:hover {
    background: rgba(53, 208, 127, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}

/* 面板展开时：按钮高亮 + 呼吸动效（模拟播放中状态） */
.music-toggle.open,
.music-toggle.playing {
    background: rgba(53, 208, 127, 0.3);
    border-color: var(--primary);
    animation: musicPulse 1.6s ease-in-out infinite;
}

/* 呼吸缩放动画：仅作用于按钮自身（transform），不向外扩散阴影，不影响其他元素 */
@keyframes musicPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ===== 网易云音乐播放面板（点击按钮展开/收起） ===== */
.music-panel {
    position: absolute;
    right: calc(100% + 14px); /* 从音乐按钮左侧展开 */
    bottom: 0;
    box-sizing: border-box;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(18, 24, 34, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}

.music-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* 网易云外链播放器 iframe */
.music-iframe {
    display: block;
    width: 330px;
    height: 86px;
    border: none;
    border-radius: 6px;
    background: transparent;
}

@media (max-width: 480px) {
    .music-iframe {
        width: 300px;
    }
}

@media (max-width: 640px) {
    .music-controls {
        right: 14px;
        bottom: 70px;
    }
    .music-toggle {
        width: 44px;
        height: 44px;
        font-size: 1.15rem;
    }
    .music-panel {
        padding: 6px;
    }
}
