/* ============================================
   星言 - 故事分享平台 自定义样式（v2.0 完整版）
   含：BGM悬浮面板、AI朗读控件、双分区、高赞列表
   ============================================ */

/* 全局样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* 导航栏和页脚 - 深邃星空背景 */
.navbar-brand {
    font-size: 1.5rem;
    letter-spacing: 2px;
}

.navbar.starry-sky,
footer.bg-dark {
    background-image:
        /* 朦胧星云效果 */
        radial-gradient(ellipse 600px 200px at 15% 50%, rgba(100, 120, 200, 0.15), transparent),
        radial-gradient(ellipse 400px 150px at 75% 30%, rgba(140, 100, 180, 0.10), transparent),
        radial-gradient(ellipse 300px 120px at 50% 80%, rgba(80, 140, 200, 0.08), transparent),
        /* 细碎柔和星光 - 小星 */
        radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 25% 65%, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 40% 15%, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 55% 75%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 70% 35%, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 85% 55%, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 95% 15%, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 5% 80%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 33% 42%, rgba(255,255,255,0.75), transparent),
        radial-gradient(1px 1px at 62% 88%, rgba(255,255,255,0.65), transparent),
        radial-gradient(1px 1px at 48% 50%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 78% 10%, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 18% 90%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 88% 78%, rgba(255,255,255,0.7), transparent),
        /* 稍亮的星 */
        radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,0.95), transparent),
        radial-gradient(1.5px 1.5px at 60% 55%, rgba(200,220,255,0.9), transparent),
        radial-gradient(1.5px 1.5px at 82% 25%, rgba(255,255,255,0.85), transparent),
        radial-gradient(1.5px 1.5px at 45% 70%, rgba(220,230,255,0.8), transparent),
        radial-gradient(2px 2px at 30% 10%, rgba(255,255,255,0.7), transparent),
        radial-gradient(2px 2px at 72% 60%, rgba(200,210,255,0.65), transparent),
        /* 深邃深蓝基底 */
        linear-gradient(180deg, #0a1628 0%, #0d1f3c 40%, #111d35 70%, #0b1526 100%);
    background-size: cover;
    background-position: center;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

/* 确保导航栏文字白色可见 */
.navbar.starry-sky .navbar-brand,
.navbar.starry-sky .nav-link,
.navbar.starry-sky .navbar-toggler-icon {
    color: rgba(255, 255, 255, 0.95) !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.navbar.starry-sky .nav-link:hover {
    color: #ffffff !important;
    text-shadow: 0 0 8px rgba(200, 220, 255, 0.5);
}

.navbar.starry-sky .form-control {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
}

.navbar.starry-sky .form-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.navbar.starry-sky .form-control:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.1);
}

.navbar.starry-sky .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 0.9);
}

.navbar.starry-sky .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.7);
    color: #fff;
}

/* 覆盖Bootstrap的bg-primary，仅对导航栏 */
.navbar.starry-sky.bg-primary {
    background: none !important;
}

/* ============================================
   文章卡片
   ============================================ */
.article-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
    border-radius: 12px;
    overflow: hidden;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1) !important;
}

.article-card .card-title a {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card .card-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 文章详情页 */
.article-detail {
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.article-content {
    line-height: 1.8;
    font-size: 1.05rem;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 评论区 */
.comment-list .border-bottom:last-child {
    border-bottom: none !important;
}

/* ============================================
   首页双分区 - 高赞故事列表
   ============================================ */
.section-header {
    border-left: 3px solid #4e73df;
    padding-left: 0.75rem;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0;
}

.hot-articles-list {
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.hot-article-item {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.hot-article-item:last-child {
    border-bottom: none;
}

.hot-article-item:hover {
    background: #f8f9ff;
}

.hot-rank {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    flex-shrink: 0;
    margin-right: 0.75rem;
    margin-top: 2px;
}

.hot-rank.top3 {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: #fff;
}

.hot-content {
    flex: 1;
    min-width: 0;
}

.hot-content a {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hot-meta {
    margin-top: 0.25rem;
}

/* ============================================
   BGM悬浮音乐面板（规避核心内容区域）
   ============================================ */
.bgm-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1050;
    width: 280px;
    transition: all 0.3s ease;
}

.bgm-panel-header {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4e73df, #224abe);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(78, 115, 223, 0.4);
    transition: transform 0.2s;
    margin-left: auto;
}

.bgm-panel-header:hover {
    transform: scale(1.1);
}

.bgm-panel-body {
    display: none;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    margin-bottom: 0.5rem;
    max-height: 500px;
    overflow-y: auto;
}

.bgm-panel-body.show {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* BGM当前播放 */
.bgm-now-playing {
    display: flex;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 0.75rem;
}

.bgm-cover {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.bgm-disc-icon {
    color: #fff;
    font-size: 1.5rem;
}

.bgm-disc-icon.spinning {
    animation: spin 3s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.bgm-info {
    flex: 1;
    min-width: 0;
}

.bgm-title {
    font-weight: 600;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bgm-artist {
    font-size: 0.75rem;
    color: #6c757d;
}

/* BGM控制按钮 */
.bgm-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* BGM音量 */
.bgm-volume {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    font-size: 0.8rem;
    color: #6c757d;
}

.bgm-volume .form-range {
    flex: 1;
}

/* BGM播放列表 */
.bgm-playlist {
    margin-top: 0.5rem;
}

.bgm-playlist-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bgm-playlist-item {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bgm-playlist-item:hover {
    background: #f0f0ff;
}

.bgm-playlist-item.active {
    background: linear-gradient(135deg, #4e73df22, #224abe11);
    color: #4e73df;
    font-weight: 600;
}

.bgm-footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
}

/* ============================================
   AI朗读控件
   ============================================ */
.tts-control-bar {
    border: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #f8f9ff, #fff);
}

.tts-control-bar .btn {
    font-size: 0.8rem;
}

.tts-progress .progress {
    border-radius: 3px;
}

.tts-status {
    font-style: italic;
}

/* ============================================
   管理后台侧边栏
   ============================================ */
.sidebar {
    border-right: 1px solid #dee2e6;
}

.sidebar .nav-link {
    color: #333;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: all 0.2s;
}

.sidebar .nav-link:hover {
    background-color: #e9ecef;
}

.sidebar .nav-link.active {
    background-color: #4e73df;
    color: #fff !important;
}

/* 统计卡片 */
.card.text-white {
    border-radius: 12px;
    border: none;
}

/* 按钮样式 */
.btn {
    border-radius: 8px;
}

/* 分页样式 */
.pagination .page-link {
    border-radius: 8px;
    margin: 0 2px;
}

/* 表单样式 */
.form-control:focus,
.form-select:focus {
    border-color: #4e73df;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

/* 卡片通用 */
.card {
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* 点赞/收藏按钮激活状态 */
.btn-outline-danger.active,
.btn-outline-warning.active {
    font-weight: bold;
}

/* 加载动画 */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* 空状态 */
.display-1.text-muted {
    opacity: 0.3;
}

/* ============================================
   响应式调整
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        min-height: auto !important;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }

    .article-detail {
        padding: 1rem;
    }

    .article-card {
        margin-bottom: 1rem;
    }

    .bgm-panel {
        right: 10px;
        bottom: 10px;
        width: 240px;
    }

    .tts-control-bar .d-flex {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .tts-progress {
        margin-top: 0.5rem;
    }
}
