/**
 * 头部导航共用样式
 * 用于 index.php 和 news-detail.php
 */

/* 顶部导航栏 */
.top-nav {
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
}

/* LOGO 容器 */
.logo-container {
    display: flex;
    align-items: center;
}

.site-logo {
    height: 50px !important;
    width: auto !important;
    max-width: none !important;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    transition: transform 0.3s ease;
}

.site-logo:hover {
    transform: scale(1.05);
}

.top-nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* 语言切换器 */
.language-switcher {
    position: relative;
    display: inline-block;
}

.lang-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    color: var(--text-color);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    min-width: 100px;
}

.lang-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--primary-color);
}

body.dark-theme .lang-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: none;
    min-width: 140px;
    z-index: 1000;
}

body.dark-theme .lang-dropdown {
    background: #1a2332;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

.lang-option {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
    white-space: nowrap;
}

.lang-option:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.dark-theme .lang-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.lang-option.active {
    color: var(--primary-color);
    font-weight: 600;
}

.lang-option span {
    flex: 1;
    white-space: nowrap;
}

.lang-option .checkmark {
    margin-left: auto;
    color: var(--primary-color);
    display: none;
    flex-shrink: 0;
}

.lang-option.active .checkmark {
    display: block;
}

/* 主题切换器 */
.theme-switcher {
    position: relative;
    display: inline-block;
}

.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    color: var(--text-color);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--primary-color);
}

body.dark-theme .theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.theme-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: none;
    min-width: 180px;
    z-index: 1000;
}

body.dark-theme .theme-dropdown {
    background: #1a2332;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

.theme-option {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
    white-space: nowrap;
}

.theme-option:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.dark-theme .theme-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.theme-option.active {
    color: var(--primary-color);
    font-weight: 600;
}

.theme-option i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.theme-option span {
    flex: 1;
    white-space: nowrap;
}

.theme-option .checkmark {
    margin-left: auto;
    color: var(--primary-color);
    display: none;
    flex-shrink: 0;
}

.theme-option.active .checkmark {
    display: block;
}

/* 头部导航链接 */
.header-nav-links {
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s ease;
    padding: 5px 8px;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-divider {
    color: #ddd;
    margin: 0 3px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    /* 移动端顶部导航容器 */
    .top-nav .container {
        padding: 0 0.5rem;
    }

    /* 移动端缩小LOGO */
    .site-logo {
        height: 36px !important;
    }

    /* 移动端隐藏顶部导航链接 */
    .header-nav-links,
    .nav-lang-divider {
        display: none;
    }

    /* 移动端调整切换器按钮大小 */
    .lang-toggle-btn,
    .theme-toggle-btn {
        padding: 8px 10px;
        min-width: 80px;
        font-size: 13px;
    }

    .lang-toggle-btn span,
    .theme-toggle-btn span {
        display: none; /* 隐藏文字，只显示图标 */
    }

    .lang-toggle-btn {
        min-width: 44px; /* 只显示图标时的最小触摸目标 */
    }

    .theme-toggle-btn {
        min-width: 44px;
    }

    /* 移动端下拉菜单适配 */
    .lang-dropdown {
        min-width: 120px;
    }

    .theme-dropdown {
        min-width: 160px;
    }
}
