/* 门户网站导航栏组件样式 */

/* 导航栏容器 - 直接将 sticky 应用到容器上 */
#portal-navbar-container {
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    width: 100%;
    /* 确保容器不会阻止 sticky 工作 */
    overflow: visible;
}

/* Navigation */
.navbar {
    background-color: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    height: 80px;
    width: 100%;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    /* 确保显示正常 */
    display: block;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-brand .logo {
    height: 42px;
}

.brand-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

.nav-city-selector {
    display: flex;
    align-items: center;
    padding: 0 16px;
    position: relative;
}

.nav-city-selector .city-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.9rem;
    color: var(--text-main);
    text-decoration: none;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-city-selector .city-trigger i.fa-map-marker-alt {
    color: var(--primary-color);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.nav-city-selector .city-trigger:hover {
    background-color: rgba(0, 51, 102, 0.05);
    color: var(--primary-color);
}

.nav-city-selector .city-trigger i.fa-chevron-down {
    font-size: 0.75rem;
    color: var(--text-sub);
    transition: transform 0.3s ease;
}

.nav-city-selector .city-trigger:hover i.fa-chevron-down {
    color: var(--primary-color);
}

/* 城市选择模态框样式 */
.city-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
    animation: fadeIn 0.3s ease;
}

/* 当模态框打开时，禁用body滚动 */
body.city-modal-open {
    overflow: hidden;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.city-modal-content {
    background-color: #fff;
    margin: 10vh auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 720px;
    height: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@keyframes slideDown {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.city-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    background: linear-gradient(135deg, rgba(0, 51, 102, 0.95) 0%, rgba(212, 175, 55, 0.95) 100%) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.city-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: white !important;
    letter-spacing: 0.3px;
}

.city-modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: white !important;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-md, 4px);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    line-height: 1;
    opacity: 0.9;
}

.city-modal-close:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    opacity: 1;
}

.city-modal-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* 标签页导航 */
.city-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 24px;
    background-color: #fafafa;
    flex-shrink: 0;
}

.city-tab {
    background: none;
    border: none;
    padding: 14px 24px;
    font-size: 0.95rem;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: -1px;
}

.city-tab i {
    font-size: 0.85rem;
}

.city-tab:hover {
    color: var(--primary-color);
}

.city-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 500;
}

/* 标签页内容 */
.city-tab-content {
    display: none;
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.city-tab-content.active {
    display: block;
}

/* 城市网格布局 */
.city-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.city-item {
    padding: 10px 16px;
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: var(--text-main);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.city-item:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: rgba(0, 51, 102, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 51, 102, 0.15);
}

/* 字母索引导航 */
.city-alphabet-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.city-alphabet-nav-item {
    padding: 6px 12px;
    background-color: #f5f5f5;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #666;
    transition: all 0.2s ease;
    min-width: 32px;
    text-align: center;
}

.city-alphabet-nav-item:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.city-alphabet-nav-item.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    font-weight: 500;
}

/* 城市选择模态框响应式设计 */
@media (max-width: 768px) {
    .city-modal-content {
        width: 95%;
        margin: 5vh auto;
        height: 85vh;
    }
    
    .city-modal-header {
        padding: 16px 20px;
    }
    
    .city-modal-header h3 {
        font-size: 1.1rem;
    }
    
    .city-tabs {
        padding: 0 20px;
    }
    
    .city-tab {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .city-tab-content {
        padding: 20px;
    }
    
    .city-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
        gap: 8px;
    }
    
    .city-item {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .city-alphabet-nav {
        gap: 4px;
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    
    .city-alphabet-nav-item {
        padding: 5px 10px;
        font-size: 0.8rem;
        min-width: 28px;
    }
}

.nav-links {
    display: flex;
    gap: 40px;
}

.nav-links a {
    font-weight: 500;
    color: var(--text-sub);
    font-size: 0.95rem;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

.nav-actions {
    display: flex;
    gap: 16px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    #portal-navbar-container {
        position: sticky !important;
        top: 0 !important;
    }
    
    .navbar {
        height: 60px;
    }
    
    .navbar .container {
        padding: 0 16px;
    }
    
    .nav-brand .logo {
        height: 32px;
    }
    
    .brand-name {
        font-size: 1.2rem;
    }
    
    .nav-links {
        gap: 20px;
        display: none; /* 移动端可以隐藏或使用汉堡菜单 */
    }
    
    .nav-actions {
        gap: 8px;
    }
    
    .nav-actions .btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

