/**
 * 棋友圈管理后台样式
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0f0f1e;
    --bg-card: #1a1a2e;
    --bg-hover: #252542;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --border-color: rgba(255, 255, 255, 0.1);
    --accent-blue: #00d4ff;
    --accent-purple: #a855f7;
    --accent-green: #00ff88;
    --accent-red: #ff6b6b;
    --accent-yellow: #ffc107;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ==================== 登录界面 ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 100%);
}

.login-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.login-card h1 {
    margin-bottom: 30px;
    font-size: 1.5em;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-form input {
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1em;
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.login-form button {
    padding: 12px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.login-form button:hover {
    transform: translateY(-2px);
}

.error-message {
    color: var(--accent-red);
    margin-top: 15px;
    font-size: 0.9em;
}

.hidden {
    display: none !important;
}

/* ==================== 管理面板布局 ==================== */
.admin-container {
    display: flex;
    min-height: 100vh;
}

/* ==================== 侧边栏 ==================== */
.sidebar {
    width: 250px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.3em;
    margin-bottom: 5px;
}

.sidebar-header .subtitle {
    color: var(--text-muted);
    font-size: 0.85em;
}

.sidebar-nav {
    flex: 1;
    padding: 15px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent-blue);
    border-right: 3px solid var(--accent-blue);
}

.nav-icon {
    font-size: 1.2em;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer button {
    width: 100%;
    padding: 10px;
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 8px;
    color: var(--accent-red);
    cursor: pointer;
}

.sidebar-footer button:hover {
    background: rgba(255, 107, 107, 0.3);
}

/* ==================== 主内容区 ==================== */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.view-section h1 {
    margin-bottom: 25px;
    font-size: 1.5em;
}

/* ==================== 统计卡片 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.stat-card.warning {
    border-color: rgba(255, 107, 107, 0.3);
    background: rgba(255, 107, 107, 0.1);
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--accent-blue);
    margin-bottom: 8px;
}

.stat-card.warning .stat-value {
    color: var(--accent-red);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* ==================== 工具栏 ==================== */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar select,
.toolbar input[type="text"] {
    padding: 10px 15px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9em;
}

.toolbar select {
    cursor: pointer;
}

.toolbar input[type="text"] {
    min-width: 200px;
}

.toolbar button {
    padding: 10px 20px;
    background: var(--accent-blue);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-weight: 500;
}

.toolbar button:hover {
    opacity: 0.9;
}

/* ==================== 数据表格 ==================== */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: rgba(0, 0, 0, 0.3);
    font-weight: 600;
    color: var(--text-secondary);
}

.data-table tr:hover {
    background: var(--bg-hover);
}

.data-table .actions {
    display: flex;
    gap: 8px;
}

.data-table .actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
}

.btn-approve {
    background: rgba(0, 255, 136, 0.2);
    color: var(--accent-green);
}

.btn-hide {
    background: rgba(255, 193, 7, 0.2);
    color: var(--accent-yellow);
}

.btn-delete {
    background: rgba(255, 107, 107, 0.2);
    color: var(--accent-red);
}

.btn-pin {
    background: rgba(168, 85, 247, 0.2);
    color: var(--accent-purple);
}

.btn-view {
    background: rgba(0, 212, 255, 0.2);
    color: var(--accent-blue);
}

/* ==================== 状态标签 ==================== */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8em;
}

.status-active {
    background: rgba(0, 255, 136, 0.2);
    color: var(--accent-green);
}

.status-pending {
    background: rgba(255, 193, 7, 0.2);
    color: var(--accent-yellow);
}

.status-hidden {
    background: rgba(255, 107, 107, 0.2);
    color: var(--accent-red);
}

.status-deleted {
    background: rgba(100, 100, 100, 0.3);
    color: var(--text-muted);
}

/* ==================== 分页 ==================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 15px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
}

.pagination button:hover,
.pagination button.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== 敏感词列表 ==================== */
.words-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.word-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
}

.word-tag.block {
    border-color: rgba(255, 107, 107, 0.3);
}

.word-tag.warn {
    border-color: rgba(255, 193, 7, 0.3);
}

.word-tag.replace {
    border-color: rgba(0, 212, 255, 0.3);
}

.word-tag .remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.word-tag .remove:hover {
    color: var(--accent-red);
}

/* ==================== 表单 ==================== */
.form-container {
    max-width: 600px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1em;
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.form-group input[type="checkbox"] {
    margin-right: 8px;
}

.primary-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
}

.primary-btn:hover {
    opacity: 0.9;
}

/* ==================== 弹窗 ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 15px;
    border: 1px solid var(--border-color);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
}

.modal-header button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2em;
    cursor: pointer;
}

.modal-header button:hover {
    color: var(--accent-red);
}

.modal-body {
    padding: 20px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .admin-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 10px;
    }

    .nav-item {
        flex-direction: column;
        padding: 10px 15px;
        font-size: 0.8em;
    }

    .nav-item.active {
        border-right: none;
        border-bottom: 3px solid var(--accent-blue);
    }

    .main-content {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==================== 趋势图 ==================== */
.trend-chart {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    min-height: 180px;
}

.trend-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 150px;
    gap: 10px;
}

.trend-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.trend-bar {
    width: 100%;
    max-width: 50px;
    background: linear-gradient(180deg, var(--accent-blue), var(--accent-purple));
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 5px;
    transition: height 0.5s ease;
    margin-top: auto;
}

.trend-bar:hover {
    opacity: 0.8;
    transform: scaleX(1.05);
}

.trend-value {
    font-size: 0.8em;
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.trend-label {
    margin-top: 8px;
    font-size: 0.75em;
    color: var(--text-muted);
}

/* ==================== 设备统计 ==================== */
.device-stats {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
}

.device-stat-section {
    margin-bottom: 20px;
}

.device-stat-section:last-child {
    margin-bottom: 0;
}

.stat-bar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.stat-bar-label {
    width: 80px;
    font-size: 0.85em;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.stat-bar-track {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.stat-bar-value {
    width: 40px;
    text-align: right;
    font-size: 0.85em;
    color: var(--text-muted);
}