/**
 * 苏格导航 - 样式文件
 * 紫粉渐变主题，响应式设计
 */

/* ============================================
   CSS 变量定义
   ============================================ */
:root {
    /* 主色调 - 紫粉渐变 */
    --primary-color: #a855f7;
    --secondary-color: #ec4899;
    --gradient-start: #667eea;
    --gradient-end: #f093fb;
    --gradient-dynamic-start: #8b5cf6;
    --gradient-dynamic-end: #f472b6;
    
    /* 背景色 */
    --bg-primary: linear-gradient(135deg, #667eea 0%, #f093fb 100%);
    --bg-secondary: rgba(255, 255, 255, 0.1);
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-header: rgba(255, 255, 255, 0.95);
    --bg-sidebar: rgba(255, 255, 255, 0.15);
    
    /* 文字颜色 */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.8);
    
    /* 边框 */
    --border-color: rgba(255, 255, 255, 0.2);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    
    /* 阴影 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    
    /* 尺寸 */
    --header-height: 60px;
    --sidebar-width: 160px;
    --search-ads-height: 150px;
    
    /* 过渡 */
    --transition: all 0.3s ease;
    --transition-fast: all 0.15s ease;
}

/* 夜间模式变量 */
[data-theme="dark"] {
    --bg-primary: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    --bg-secondary: rgba(0, 0, 0, 0.2);
    --bg-card: rgba(30, 30, 50, 0.7);
    --bg-header: rgba(30, 30, 50, 0.3);
    --bg-sidebar: rgba(0, 0, 0, 0.25);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ============================================
   基础重置样式
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

input {
    font-family: inherit;
    outline: none;
}

/* ============================================
   顶部固定导航栏
   ============================================ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 1000;
    transition: var(--transition);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.header-container {
    max-width: 1400px;
    height: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* 左侧 Logo 区域 - 对齐左侧导航栏 */
.header-left {
    width: var(--sidebar-width);
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
}

.logo:hover {
    opacity: 0.8;
}

.logo img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.site-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    white-space: nowrap;
}

/* 中间搜索框 */
.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 700px;
}

.search-box {
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    align-items: center;
    padding: 6px;
    gap: 4px;
    border: 2px solid rgba(168, 85, 247, 0.3);
}

.search-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 4px;
    flex-shrink: 0;
}

.search-tab {
    padding: 8px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.search-tab:hover {
    background: rgba(168, 85, 247, 0.1);
    color: var(--primary-color);
}

.search-tab.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--text-light);
}

.search-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
}

.search-input {
    flex: 1;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 15px;
    min-width: 0;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--text-light);
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    flex-shrink: 0;
}

.search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4);
}

.search-btn i {
    font-size: 16px;
}

/* 右侧功能区 */
.header-right {
    width: var(--sidebar-width);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.header-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 18px;
    transition: var(--transition);
}

.header-btn:hover {
    background: rgba(168, 85, 247, 0.1);
    color: var(--primary-color);
}

.header-btn.admin-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--text-light);
}

.header-btn.admin-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ============================================
   搜索区广告区域
   ============================================ */
.search-ads-section {
    margin-top: var(--header-height);
    height: var(--search-ads-height);
    padding: 20px 24px 0;
}

.search-ads-container {
    max-width: 1400px;
    height: 100%;
    margin: 0 auto;
    display: flex;
    gap: 20px;
    padding-left: var(--sidebar-width);
    padding-right: 200px;
}

.search-ad-item {
    flex: 1;
    height: 100%;
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.search-ad-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.search-ad-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.search-ad-item:hover img {
    transform: scale(1.05);
}

/* ============================================
   主体内容区域
   ============================================ */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 24px;
    display: flex;
    gap: 24px;
    min-height: calc(100vh - var(--header-height) - var(--search-ads-height) - 60px);
}

/* 左侧导航栏 */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-height) + 20px);
    height: fit-content;
    max-height: calc(100vh - var(--header-height) - 40px);
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.sidebar-nav {
    background: var(--bg-sidebar);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 16px 12px;
    border: 1px solid var(--border-color);
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    color: var(--text-light);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--text-light);
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* 中间内容区 */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 导航分组 */
.nav-section {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.nav-section:hover {
    box-shadow: var(--shadow-md);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.section-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--border-radius-sm);
    color: var(--text-light);
    font-size: 16px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 导航卡片网格 */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.nav-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(168, 85, 247, 0.05);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid transparent;
}

.nav-card:hover {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.2);
    transform: translateY(-2px);
}

.card-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 10px;
    flex-shrink: 0;
    overflow: hidden;
}

.card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-icon i {
    font-size: 22px;
    color: var(--primary-color);
}

.card-content {
    flex: 1;
    min-width: 0;
}

.card-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 右侧广告区 */
.ads-sidebar {
    width: 200px;
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-height) + 20px);
    height: fit-content;
}

.ads-container {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.ads-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.ads-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ad-item {
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.ad-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.ad-item img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    transition: var(--transition);
}

.ad-item:hover img {
    transform: scale(1.03);
}

.ad-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    padding: 6px;
    background: rgba(168, 85, 247, 0.05);
}

/* ============================================
   页脚
   ============================================ */
.footer {
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px 24px;
    margin-top: 40px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 14px;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--text-light);
}

.copyright {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ============================================
   移动端菜单
   ============================================ */
.mobile-menu-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--text-light);
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    font-size: 24px;
    z-index: 999;
    transition: var(--transition);
}

.mobile-menu-btn:hover {
    transform: scale(1.05);
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.overlay.active {
    display: block;
}

/* ============================================
   动态渐变背景动画
   ============================================ */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body.dynamic-gradient {
    background: linear-gradient(-45deg, 
        var(--gradient-dynamic-start), 
        var(--gradient-dynamic-end), 
        var(--gradient-start), 
        var(--gradient-end));
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 1200px) {
    .ads-sidebar {
        width: 160px;
    }
}

@media (max-width: 992px) {
    .header-left {
        width: auto;
    }
    
    .header-right {
        width: auto;
    }
    
    .site-name {
        display: none;
    }
    
    .search-ads-container {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .main-container {
        flex-wrap: wrap;
    }
    
    .sidebar {
        display: none;
        position: fixed;
        left: 0;
        top: var(--header-height);
        width: 220px;
        height: calc(100vh - var(--header-height));
        z-index: 997;
        background: rgba(30, 30, 50, 0.9);
        backdrop-filter: blur(20px);
        border-right: 1px solid var(--border-color);
        border-radius: 0;
    }
    
    .sidebar.mobile-open {
        display: block;
    }
    
    .sidebar-nav {
        border-radius: 0;
        border: none;
    }
    
    .content {
        width: 100%;
    }
    
    .nav-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .ads-sidebar {
        width: 100%;
        position: static;
    }
    
    .ads-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .ad-item {
        width: calc(50% - 8px);
    }
    
    .ad-item img {
        aspect-ratio: 16/9;
    }
    
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    :root {
        --search-ads-height: 120px;
    }
    
    .header-container {
        padding: 0 16px;
    }
    
    .search-box {
        max-width: 100%;
        padding: 4px;
        border-width: 1px;
    }
    
    .search-tabs {
        padding: 0 2px;
    }
    
    .search-tab {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .search-input-wrapper {
        padding: 0 4px;
    }
    
    .search-input {
        padding: 6px 8px;
        font-size: 14px;
    }
    
    .search-btn span {
        display: none;
    }
    
    .search-btn {
        padding: 8px 14px;
    }
    
    .search-ads-section {
        padding: 16px 16px 0;
    }
    
    .search-ads-container {
        padding-left: 0;
        padding-right: 0;
    }
    
    .main-container {
        padding: 16px;
    }
    
    .nav-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .nav-card {
        padding: 12px;
    }
    
    .card-icon {
        width: 40px;
        height: 40px;
    }
    
    .card-title {
        font-size: 15px;
    }
    
    .nav-section {
        padding: 20px;
    }
    
    .footer-links {
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .nav-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .search-box {
        gap: 2px;
    }
    
    .search-tabs {
        display: none;
    }
    
    .search-ads-container {
        flex-direction: column;
        height: auto;
    }
    
    .search-ad-item {
        height: 100px;
    }
    
    :root {
        --search-ads-height: 340px;
    }
    
    .ad-item {
        width: 100%;
    }
}

/* ============================================
   工具类
   ============================================ */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
