/* 统一CSS管理文件 - 整合所有样式 */

/* 1. 基础变量系统 */
:root {
    --primary-color: #006abc;
    --secondary-color: #6c757d;
    --success-color: #0ac500;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #e2e5e8;
    --font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --line-height-base: 1.6;
    --border-radius: 8px;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 2. 基础重置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family-sans-serif);
    line-height: var(--line-height-base);
    color: #333;
    background-color: #f5f7fa;
    min-width: 1200px;
}

.container {
    width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 3. 头部样式 */
header {
    background-color: white;
    box-shadow: var(--shadow-sm);
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    height: 40px;
}

/* 4. 导航样式 */
nav {
    background-color: var(--primary-color);
    padding: 0;
}

.navbar {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar li {
    position: relative;
}

.navbar a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 12px 20px;
    font-size: 14px;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.navbar a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dropdown-menu {
    display: none;
    position: absolute;
    background-color: white;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    min-width: 180px;
    z-index: 1000;
    border: 1px solid var(--border-color);
}

.dropdown-menu a {
    color: var(--dark-color);
    padding: 10px 15px;
}

.dropdown-menu a:hover {
    background-color: var(--light-color);
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-arrow {
    font-size: 10px;
    margin-left: 5px;
    opacity: 0.7;
    transition: transform 0.3s;
}

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

/* 5. 主内容区样式 */
.main-content {
    padding: 20px 0;
}

/* 6. 筛选区域样式 */
.filter-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-buttons {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background-color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 7. 工具网格样式 - 修复卡片堆积问题 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}

.tool-card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    min-height: 140px;
    overflow: hidden;
    border: 1px solid transparent;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: inherit;
    border-color: var(--border-color);
}

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.tool-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
    line-height: 1.3;
    flex: 1;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    white-space: nowrap;
}

.badge-primary {
    background-color: #e3ecff;
    color: var(--primary-color);
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.tool-description {
    color: var(--secondary-color);
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
    flex: 1;
}

.tool-description p {
    margin: 0 0 5px 0;
}

/* 8. 其他组件样式 */
.section {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 30px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

/* 赞助商网格 */
.partners-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
}

.partner-item {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    text-align: center;
    transition: border-color 0.3s;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--light-color);
}

.partner-item:hover {
    border-color: var(--primary-color);
}

.partner-item img {
    max-width: 100%;
    max-height: 60px;
    object-fit: contain;
}

/* 文章推荐 - 三列布局 */
.articles-section {
    margin-bottom: 30px;
}

.articles-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.article-column {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.column-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
    position: relative;
    padding-left: 12px;
}

.column-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 16px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.column-more {
    font-size: 13px;
    color: #999;
    text-decoration: none;
    transition: color 0.3s;
}

.column-more:hover {
    color: var(--primary-color);
}

.column-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.column-item {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    font-size: 14px;
    transition: color 0.3s;
}

.column-item:hover {
    color: var(--primary-color);
}

.column-item:hover .item-title {
    color: var(--primary-color);
}

.item-dot {
    color: #ccc;
    margin-right: 8px;
    font-size: 12px;
    flex-shrink: 0;
}

.item-title {
    flex: 1;
    color: var(--dark-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.item-date {
    color: #999;
    font-size: 12px;
    flex-shrink: 0;
}

/* 友情链接 */
.friend-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.friend-link {
    display: inline-block;
    padding: 6px 12px;
    background-color: var(--light-color);
    color: var(--primary-color);
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.3s;
}

.friend-link:hover {
    background-color: #e3ecff;
    text-decoration: none;
    color: var(--primary-color);
}

/* 9. 页脚样式 */
footer {
    background-color: white;
    padding: 20px 0;
    text-align: center;
    font-size: 14px;
    color: var(--secondary-color);
    border-top: 1px solid var(--border-color);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
}

.footer-link {
    color: var(--secondary-color);
    text-decoration: none;
}

.footer-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.split {
    margin: 0 10px;
    color: #ddd;
}

/* 10. 响应式设计 */
@media (max-width: 1250px) {
    .container {
        width: 100%;
        padding: 0 20px;
    }
    
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-section {
        flex-direction: column;
        gap: 15px;
    }
    
    .filter-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ==================== 统一搜索框样式 ==================== */

/* 搜索框容器 */
.search-box-container {
    display: inline-flex;
    position: relative;
    align-items: center;
}

/* 统一搜索框样式 */
.unified-search-input {
    width: 600px;
    height: 46px;
    padding: 10px 44px 10px 15px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
    flex: none;
}

/* 搜索框焦点状态 */
.unified-search-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 106, 188, 0.2), inset 0 1px 2px rgba(0,0,0,0.05);
}

/* 搜索框占位符样式 */
.unified-search-input::placeholder {
    color: #999;
    font-size: 14px;
}

/* 清空按钮 */
.search-clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    transition: color 0.3s;
    z-index: 10;
}

.search-clear-btn:hover {
    color: #666;
}

/* 历史记录下拉框 */
.history-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 600px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-top: 4px;
}

.history-header {
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 14px;
}

.btn-clear-history {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 3px;
    transition: all 0.3s;
}

.btn-clear-history:hover {
    color: #dc3545;
    background-color: #f8f9fa;
}

#history-list,
#history_ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

#history-list li,
#history_ul li {
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s;
}

#history-list li:hover,
#history_ul li:hover {
    background-color: #f8f9fa;
}

#history-list li:last-child,
#history_ul li:last-child {
    border-bottom: none;
}

/* DNS选择器样式 */
.dns-container {
    position: relative;
    display: inline-block;
}

.dns-list {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    width: 200px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: none;
    margin-top: 4px;
}

.dns-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dns-list li {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s;
}

.dns-list li:hover {
    background-color: #f5f5f5;
}

.dns-list li span {
    float: right;
    color: #999;
    font-size: 12px;
}

/* 运营商选择区域 */
.operator-selection {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.operator-checkboxes {
    display: flex;
    flex-wrap: nowrap;
    gap: 15px;
}

.dns-selection {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
}

/* 自定义复选框样式 */
.custom-control {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.custom-control-input {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    cursor: pointer;
}

.custom-control-label {
    cursor: pointer;
    user-select: none;
}

/* 单选按钮样式 */
.form-check-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #666;
}

.form-check-input {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    cursor: pointer;
}

/* 小号输入框（用于DNS输入） */
.form-control-sm {
    height: 34px;
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    transition: border-color 0.3s;
}

.form-control-sm:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 106, 188, 0.2);
}

.form-control-sm:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}