/* 全局样式 */
:root {
    --primary-color: #1f6aa5;
    --primary-hover: #144870;
    --danger-color: #d32f2f;
    --danger-hover: #b71c1c;
    --bg-color: #1a1a1a;
    --card-bg: #2b2b2b;
    --text-color: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #404040;
    --header-bg: #f0f0f0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-color: #2b2b2b;
    --text-secondary: #666666;
    --border-color: #d0d0d0;
    --header-bg: #f0f0f0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
}

/* 头部 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-bottom: 15px;
    background: linear-gradient(135deg, var(--primary-color), #1a5490);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 24px;
    color: white;
    font-weight: bold;
}

.header-buttons {
    display: flex;
    gap: 8px;
}

/* 卡片 */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-input {
    flex: 1;
    height: 38px;
    padding: 0 15px;
    font-size: 13px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 按钮 */
.btn {
    height: 38px;
    padding: 0 20px;
    font-size: 13px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #666;
    color: white;
}

.btn-secondary:hover {
    background: #555;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-info {
    background: #17a2b8;
    color: white;
    width: 100%;
    margin-top: 10px;
}

.btn-info:hover {
    background: #138496;
}

.btn-sm {
    height: 24px;
    padding: 0 10px;
    font-size: 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: var(--primary-color);
    color: white;
}

.btn-sm:hover {
    background: var(--primary-hover);
}

.btn-sm.btn-secondary {
    background: #666;
}

.btn-sm.btn-secondary:hover {
    background: #555;
}

.icon-btn {
    width: 48px;
    height: 38px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transition: background 0.3s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 搜索历史 */
.search-history {
    margin-top: 10px;
    padding: 10px;
    background: var(--header-bg);
    border-radius: 8px;
}

.history-item {
    padding: 5px 10px;
    margin: 2px 0;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
}

.history-item:hover {
    background: var(--primary-color);
    color: white;
}

.history-delete {
    cursor: pointer;
    color: var(--danger-color);
}

/* 结果区域 */
.results-header {
    display: flex;
    padding: 10px;
    background: var(--header-bg);
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: bold;
    color: var(--primary-color);
    font-size: 11px;
}

.result-column {
    padding: 0 5px;
}

.col-title {
    width: 35%;
}

.col-tracker {
    width: 12%;
}

.col-category {
    width: 10%;
}

.col-size {
    width: 10%;
}

.col-seeders {
    width: 8%;
}

.col-peers {
    width: 8%;
}

.col-date {
    width: 12%;
}

.col-actions {
    width: 5%;
    text-align: center;
}

.results-container {
    max-height: 600px;
    overflow-y: auto;
}

.result-item {
    display: flex;
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
    font-size: 12px;
}

.result-item:hover {
    background: var(--header-bg);
}

.result-item span {
    padding: 0 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-title {
    font-weight: bold;
    cursor: pointer;
}

.result-title:hover {
    color: var(--primary-color);
}

.seeder-high {
    color: #4caf50;
}

.seeder-medium {
    color: #ff9800;
}

.seeder-low {
    color: #f44336;
}

.no-results {
    text-align: center;
    padding: 50px;
    color: var(--text-secondary);
    font-size: 13px;
}

.result-actions {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.action-btn {
    padding: 4px 8px;
    font-size: 11px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: var(--primary-color);
    color: white;
}

.action-btn:hover {
    background: var(--primary-hover);
}

/* 状态栏 */
.status-bar {
    display: flex;
    justify-content: space-between;
    padding: 8px 15px;
    background: var(--card-bg);
    border-radius: 8px;
    font-size: 10px;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

#resultCount {
    color: var(--primary-color);
    font-weight: bold;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal-large {
    max-width: 1200px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--primary-color), #1a5490);
    border-radius: 12px 12px 0 0;
    color: white;
}

.modal-header h2 {
    font-size: 16px;
    font-weight: bold;
}

.modal-close {
    font-size: 28px;
    color: white;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* 设置网格 */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.settings-column {
    background: var(--bg-color);
    border-radius: 10px;
    padding: 10px;
    border: 1px solid var(--border-color);
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--header-bg);
    border-radius: 8px;
    margin-bottom: 10px;
}

.column-header h3 {
    font-size: 14px;
    font-weight: bold;
    color: var(--primary-color);
}

.column-controls {
    display: flex;
    gap: 4px;
}

.checkbox-container {
    max-height: 500px;
    overflow-y: auto;
    padding: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 5px;
    margin: 2px 0;
}

.checkbox-item.subcategory {
    padding-left: 25px;
    font-size: 11px;
}

.checkbox-item input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.checkbox-item label {
    cursor: pointer;
    font-size: 12px;
}

.indexer-status {
    padding: 5px 10px;
    text-align: center;
    font-size: 10px;
    color: var(--text-secondary);
    background: var(--header-bg);
    border-radius: 6px;
    margin-bottom: 8px;
}

/* 表单 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: bold;
}

.form-control {
    width: 100%;
    height: 35px;
    padding: 0 12px;
    font-size: 11px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-color);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* 响应式 */
@media (max-width: 1200px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .search-bar {
        flex-wrap: wrap;
    }

    .search-input {
        width: 100%;
    }

    .results-header {
        display: none;
    }

    .result-item {
        flex-direction: column;
        gap: 5px;
    }

    .result-item span {
        width: 100% !important;
    }
}