/**
 * 生存战争网 - 共享布局样式
 * 所有页面共用的结构组件：头部(Header)、顶部导航栏(Nav)、站点信息(Site Info)、页脚(Footer)
 * 以及主题/语言选择器、搜索框等全局 UI 元素的布局定义
 */

/* ===== 页面布局（使页脚贴底） ===== */
html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#body {
    flex: 1 0 auto;
}

/* ===== Header（头部） - 已废弃，logo移入导航栏 ===== */

.site-name {
    flex: 0 0 auto;
    margin: 0 auto 0 0;
    padding: 8px 16px;
    border-radius: 12px;
    background: var(--card-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

#logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.logo-text {
    font-size: 20px;
    font-weight: bold;
    color: var(--text-primary);
}

/* ===== Top Navigation Bar（顶部导航栏） ===== */
#top-nav-bar {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-bottom: 1px solid var(--border-light);
    padding: 8px 0;
    position: relative;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

#top-nav-bar .row.align-items-center {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 15px;
}

.nav-menu {
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
    align-items: center;
    margin-right: auto;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    min-width: 0;
    flex-shrink: 1;
}

.nav-menu a {
    padding: 10px 20px;
    border-radius: 8px;
    color: #495057;
    font-weight: 500;
    border: 2px solid transparent;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    flex: 0 1 auto;
    min-width: 0;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #007bff, #667eea);
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.nav-menu a:hover {
    background-color: rgba(102, 126, 234, 0.08);
    color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.nav-menu a:hover::after {
    width: 60%;
}

.nav-menu a.active {
    background: linear-gradient(135deg, #007bff 0%, #667eea 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.35);
    transform: translateY(-2px);
}

.nav-menu a.active::after {
    width: 80%;
    background: rgba(255, 255, 255, 0.6);
}

.nav-menu a.active:hover {
    background: linear-gradient(135deg, #0069d9 0%, #5a6fd8 100%);
    transform: translateY(-2px);
}

/* ===== Dropdown（下拉菜单） ===== */
.dropdown-section {
    position: relative;
    z-index: 1001;
    flex-shrink: 0;
}

.dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.dropdown-toggle:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateY(-1px);
}

.dropdown-toggle .arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.dropdown.open .dropdown-toggle .arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 140px;
    background: var(--bg-color, #fff);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #000;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.dropdown-item:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.dropdown-item.active {
    background: linear-gradient(135deg, #007bff 0%, #667eea 100%);
    color: white;
}

/* ===== Main Content（主内容区） ===== */
#body {
    padding: 10px 0;
}

.post-content {
    line-height: 1.5;
}

/* ===== Site Info（站点信息） ===== */
.site-info {
    margin-bottom: 2px;
}

.site-address {
    text-align: center;
    font-size: 12px;
    color: #666;
    margin: 0;
    padding: 2px 10px;
    background: var(--light-bg);
    border-radius: 4px;
    border-left: 3px solid #007cba;
    max-width: 100%;
    box-sizing: border-box;
}

.site-address span {
    margin-right: 8px;
}

.site-info-short-url {
    font-size: 0.8em;
    color: #666;
}

/* ===== Footer（页脚） ===== */
#footer {
    clear: both;
    width: 100%;
    margin: 0;
    padding: 4px 0;
    text-align: center;
    background: var(--light-bg);
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

.copyright {
    font-size: 12px;
    color: #666;
    line-height: 1.2;
    margin: 0;
}

/* ===== Responsive Design（响应式设计） ===== */
@media (max-width: 767px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    #top-nav-bar .row.align-items-center {
        flex-wrap: wrap;
        gap: 10px;
    }

    /* 移动端：logo + 下拉按钮在第一行，导航在第二行 */
    .site-name {
        order: 1;
        flex: 1 1 auto;
        margin: 0;
        text-align: left;
    }

    .dropdown-section {
        order: 2;
        flex: 0 0 auto;
        margin-left: auto;
        display: flex;
        gap: 8px;
    }

    .nav-menu {
        order: 3;
        flex: 1 1 100%;
        gap: 10px;
        justify-content: center;
        margin-right: 0;
        flex-wrap: wrap;
        overflow: visible;
        min-width: unset;
        flex-shrink: unset;
    }

    .nav-menu a {
        flex: 0 0 auto;
        min-width: unset;
        padding: 8px 14px;
        font-size: 14px;
    }

    .dropdown-toggle {
        padding: 6px 10px;
        font-size: 13px;
    }

    .dropdown-menu {
        right: 0;
        left: auto;
        transform: translateY(-8px);
    }

    .dropdown.open .dropdown-menu {
        transform: translateY(0);
    }

    #footer {
        margin: 0;
        padding: 3px 0;
    }
}

@media (max-width: 480px) {
    .logo-icon {
        width: 32px;
        height: 32px;
    }

    .logo-text {
        font-size: 16px;
    }

    .site-name {
        padding: 6px 12px;
    }

    .dropdown-toggle {
        padding: 6px 8px;
        font-size: 12px;
    }

    .dropdown-item {
        padding: 8px 12px;
        font-size: 13px;
    }

    #footer {
        margin: 0;
        padding: 3px 0;
    }

    .copyright {
        font-size: 11px;
    }
}