/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f1419;
    --bg-secondary: #161b22;
    --bg-card: #1c2128;
    --bg-card-hover: #21262d;
    --border-color: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent: #39d0d8;
    --accent-dark: #2a9d8f;
    --accent-gradient: linear-gradient(135deg, #39d0d8, #2a9d8f);
    --success: #3fb950;
    --warning: #d29922;
    --danger: #f85149;
}

html, body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    min-height: 100vh;
    line-height: 1.6;
}

/* ========== 登录页面 ========== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 48px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.login-box h1 {
    font-size: 24px;
    text-align: center;
    margin-bottom: 32px;
    color: var(--accent);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.login-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 16px;
}

/* ========== 按钮 ========== */
.btn-primary {
    display: inline-block;
    padding: 12px 24px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(57, 208, 216, 0.3);
}

.btn-secondary {
    display: inline-block;
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: 8px 12px;
}

.btn-text:hover {
    color: var(--accent);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-danger {
    background: var(--danger);
}

.btn-edit {
    background: var(--accent);
}

/* ========== 主布局 ========== */
.admin-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header h1 {
    font-size: 18px;
    color: var(--accent);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-container {
    display: flex;
    min-height: calc(100vh - 65px);
}

.sidebar {
    width: 220px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 24px 0;
    position: sticky;
    top: 65px;
    height: calc(100vh - 65px);
    overflow-y: auto;
}

.nav-menu {
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent);
    color: #fff;
}

.nav-icon {
    font-size: 18px;
}

.main-content {
    flex: 1;
    padding: 32px;
    max-width: 1200px;
}

.page-section {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 20px;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-input {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    width: 250px;
}

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ========== 商城列表 ========== */
.platform-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.platform-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s;
}

.platform-item:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

/* 置顶商城样式 */
.platform-item.platform-pinned {
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(57, 208, 216, 0.05) 0%, var(--bg-card) 100%);
    position: relative;
}

.platform-item.platform-pinned::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent-gradient);
    border-radius: 12px 0 0 12px;
}

.pin-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--accent-gradient);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    border-radius: 4px;
    margin-left: 8px;
}

.pin-badge::before {
    content: '📌';
    font-size: 10px;
}

.platform-icon {
    font-size: 32px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border-radius: 12px;
}

.platform-info {
    flex: 1;
}

.platform-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.platform-category {
    font-size: 12px;
    color: var(--text-secondary);
}

.platform-tags {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.tag {
    padding: 4px 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}

.tag-blogger {
    background: rgba(57, 208, 216, 0.2);
    color: var(--accent);
}

.tag-genfa {
    background: rgba(63, 185, 80, 0.2);
    color: var(--success);
}

.platform-actions {
    display: flex;
    gap: 8px;
}

/* ========== 分类列表 ========== */
.category-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.category-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-icon {
    font-size: 24px;
}

.category-name {
    font-size: 16px;
    font-weight: 600;
}

/* ========== 跟发组列表 ========== */
.genfa-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.genfa-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

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

.genfa-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.genfa-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.genfa-members {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.member-tag {
    padding: 6px 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    font-size: 13px;
}

/* ========== 设置表单 ========== */
.settings-form {
    max-width: 600px;
}

.settings-form textarea {
    resize: vertical;
    min-height: 100px;
}

/* ========== 日志列表 ========== */
.logs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    gap: 16px;
    font-size: 14px;
}

.log-time {
    color: var(--text-secondary);
    font-size: 12px;
    min-width: 150px;
}

.log-action {
    flex: 1;
}

.log-admin {
    color: var(--accent);
}

/* ========== 自动监控 ========== */
.monitor-panel {
    max-width: 600px;
}

.monitor-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.monitor-info h3 {
    font-size: 15px;
    margin-bottom: 4px;
}

.monitor-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Switch 开关 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-color);
    border-radius: 28px;
    transition: 0.3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .slider {
    background: var(--accent);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.form-select {
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.sync-status {
    margin-top: 16px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* 同步进度条 */
.sync-progress {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 8px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.progress-detail {
    font-size: 12px;
    color: var(--text-secondary);
}

.sync-complete {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(63, 185, 80, 0.1);
    border: 1px solid rgba(63, 185, 80, 0.3);
    border-radius: 8px;
    color: var(--success);
    font-size: 13px;
}

/* ========== 分页 ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination button {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
}

.pagination button:hover {
    background: var(--bg-card-hover);
}

.pagination button.active {
    background: var(--accent);
    border-color: var(--accent);
}

/* ========== 弹窗 ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
}

.modal-box {
    position: relative;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    overflow-y: auto;
}

.modal-lg {
    max-width: 600px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    width: 32px;
    height: 32px;
    background: var(--bg-primary);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
}

.modal-close:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-checkboxes {
    display: flex;
    gap: 24px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-item input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
}

/* ========== Toast 提示 ========== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    z-index: 2000;
    display: none;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ========== 最近日志 ========== */
.recent-logs {
    margin-top: 32px;
}

.recent-logs h3 {
    font-size: 16px;
    margin-bottom: 16px;
}

.recent-log-item {
    display: flex;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.recent-log-item:last-child {
    border-bottom: none;
}

.recent-log-time {
    color: var(--text-secondary);
    min-width: 140px;
    font-size: 12px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .admin-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
        padding: 0 16px;
    }
    
    .nav-item {
        padding: 12px 16px;
        white-space: nowrap;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .header-actions {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-input {
        width: 100%;
    }
}
