/* ==========================================================================
   公共主题样式：主题变量、卡片式顶栏、暗色模式
   仅作用于前台（public_layout：首页 / 分类页）
   ========================================================================== */

:root,
[data-theme="red"] {
    --theme-primary: #ff6b6b;
    --theme-primary-light: #ff8e53;
    --theme-primary-gradient: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    --theme-primary-shadow: rgba(255, 107, 107, 0.32);
    --theme-background: #f5f6f8;
    --theme-surface: #ffffff;
    --theme-card: #fff8f0;
    --theme-card-gradient: linear-gradient(135deg, #fff8f0 0%, #fff0f0 100%);
    --theme-text: #333333;
    --theme-text-secondary: #7a8494;
    --theme-border: #eef0f4;
}

[data-theme="blue"] {
    --theme-primary: #4a90e2;
    --theme-primary-light: #5fa3f0;
    --theme-primary-gradient: linear-gradient(135deg, #4a90e2 0%, #5fa3f0 100%);
    --theme-primary-shadow: rgba(74, 144, 226, 0.32);
    --theme-background: #f0f4f8;
    --theme-surface: #ffffff;
    --theme-card: #f0f8ff;
    --theme-card-gradient: linear-gradient(135deg, #f0f8ff 0%, #e6f2ff 100%);
    --theme-text: #2c3e50;
    --theme-text-secondary: #5a6c7d;
    --theme-border: #e1e8ed;
}

[data-theme="green"] {
    --theme-primary: #27ae60;
    --theme-primary-light: #2ecc71;
    --theme-primary-gradient: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    --theme-primary-shadow: rgba(39, 174, 96, 0.32);
    --theme-background: #f0f7f4;
    --theme-surface: #ffffff;
    --theme-card: #f0faf4;
    --theme-card-gradient: linear-gradient(135deg, #f0faf4 0%, #e6f5eb 100%);
    --theme-text: #1e3a2f;
    --theme-text-secondary: #4a6356;
    --theme-border: #d4e6dc;
}

[data-theme="dark"] {
    --theme-primary: #6366f1;
    --theme-primary-light: #8b5cf6;
    --theme-primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --theme-primary-shadow: rgba(99, 102, 241, 0.4);
    --theme-background: #0f0f1a;
    --theme-surface: #1a1a2e;
    --theme-card: #252538;
    --theme-card-gradient: linear-gradient(135deg, #252538 0%, #1e1e32 100%);
    --theme-text: #f0f0f5;
    --theme-text-secondary: #a0a0b0;
    --theme-border: #33334a;
}

body {
    background: var(--theme-background) !important;
    color: var(--theme-text);
    transition: background-color 0.3s ease, color 0.3s ease;
}

body::before {
    display: none !important;
}

/* --------------------------------------------------------------------------
   顶部导航（卡片式）
   -------------------------------------------------------------------------- */
.top-nav {
    padding: 12px 16px 0;
    width: 100%;
    box-sizing: border-box;
}

.top-nav-box {
    max-width: 1048px;
    margin: 0 auto;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--theme-surface);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s ease;
}

.top-nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    min-width: 0;
}

.top-nav-logo .logo-img,
.top-nav-logo .logo-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
}

.top-nav-logo .logo-img {
    object-fit: cover;
}

.top-nav-logo .logo-placeholder {
    background: var(--theme-primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 17px;
}

.logo-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.logo-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.logo-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--theme-text);
}

.logo-version {
    font-size: 10px;
    color: var(--theme-primary);
    background: color-mix(in srgb, var(--theme-primary) 12%, transparent);
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 500;
}

.logo-subtitle {
    font-size: 11px;
    color: var(--theme-text-secondary);
    max-width: 20em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-nav-menu {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-menu-item {
    padding: 6px 14px;
    font-size: 13px;
    color: var(--theme-text-secondary);
    cursor: pointer;
    border-radius: 16px;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
    text-decoration: none;
}

.nav-menu-item:hover,
.nav-menu-item.active {
    color: var(--theme-primary);
    background: color-mix(in srgb, var(--theme-primary) 12%, transparent);
}

.top-nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 主题切换 */
.theme-switcher {
    position: relative;
    z-index: 1001;
}

.theme-switcher-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
    background: var(--theme-surface);
    color: var(--theme-text-secondary);
    border: 1px solid var(--theme-border);
    font-size: 14px;
}

.theme-switcher-btn:hover {
    background: var(--theme-background);
    color: var(--theme-primary);
    border-color: var(--theme-primary);
}

.theme-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--theme-surface);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px;
    min-width: 140px;
    z-index: 9999;
    border: 1px solid var(--theme-border);
    display: none;
}

.theme-dropdown.show {
    display: block;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
    color: var(--theme-text);
}

.theme-option:hover {
    background: var(--theme-background);
}

.theme-option.active {
    background: var(--theme-primary-gradient);
    color: #fff;
}

.theme-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.theme-dot-red { background: linear-gradient(135deg, #ff6b6b, #ff8e53); }
.theme-dot-blue { background: linear-gradient(135deg, #4a90e2, #5fa3f0); }
.theme-dot-green { background: linear-gradient(135deg, #27ae60, #2ecc71); }
.theme-dot-dark { background: linear-gradient(135deg, #6366f1, #8b5cf6); }

.theme-name {
    font-size: 13px;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .top-nav-menu {
        display: none;
    }

    .logo-subtitle {
        display: none;
    }

    .theme-switcher-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* --------------------------------------------------------------------------
   公共容器与页脚（供前台各页面复用）
   -------------------------------------------------------------------------- */
.container-fluid-custom {
    max-width: 1080px;
    padding: 0 20px;
    margin: auto;
    width: 100%;
    position: relative;
    z-index: 1;
}

.footer-container {
    margin-top: 44px;
}

.footer-statement {
    text-align: center;
    margin: 0 0 6px;
    padding: 20px 0 0;
    color: var(--theme-text-secondary);
    font-size: 0.8rem;
    line-height: 1.7;
}

.footer-copyright {
    text-align: center;
    padding: 22px 0 30px;
    color: var(--theme-text-secondary);
    font-size: 0.85rem;
}

.footer-copyright a {
    color: var(--theme-primary);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.footer-copyright a:hover {
    filter: brightness(0.9);
}

.footer-divider {
    margin: 0 8px;
    color: var(--theme-text-secondary);
    opacity: 0.6;
}

.footer-friendly-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 10px;
    padding: 16px 0 4px;
    font-size: 0.82rem;
    color: var(--theme-text-secondary);
}

.footer-friendly-links-label {
    font-weight: 600;
    color: var(--theme-text-secondary);
}

.footer-friendly-links-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 14px;
}

.footer-friendly-links-list a {
    color: var(--theme-text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-friendly-links-list a:hover {
    color: var(--theme-primary);
    text-decoration: underline;
}

@media (max-width: 540px) {
    .container-fluid-custom {
        padding: 0 14px;
    }
}
