/* ===== 后台管理页面样式 ===== */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.1);
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #1e1b4b;
    --bg-input: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: 0.2s ease;
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

#admin-app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── 顶部导航 ──────────────────────────────────────── */

.admin-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: var(--bg-sidebar);
    flex-shrink: 0;
}

.admin-nav-left {
    display: flex;
    align-items: center;
}

.admin-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.admin-nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-user {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
}

#admin-logout-btn {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
}

#admin-logout-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.admin-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.admin-back-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ─── 布局 ──────────────────────────────────────────── */

.admin-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* ─── 侧边栏 ────────────────────────────────────────── */

.admin-sidebar {
    width: 220px;
    min-width: 220px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 12px 8px;
    overflow-y: auto;
}

.admin-menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.admin-menu-item:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.admin-menu-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.admin-menu-item svg {
    flex-shrink: 0;
}

/* ─── 主内容区 ──────────────────────────────────────── */

.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.admin-page {
    display: none;
}

.admin-page.active {
    display: block;
}

.admin-page h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}

/* ─── 统计卡片 ──────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

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

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary);
}

/* ─── 表格 ──────────────────────────────────────────── */

.admin-table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: var(--bg-input);
}

.admin-actions-cell {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.admin-loading,
.admin-error,
.admin-empty {
    padding: 32px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

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

/* ─── 徽章 ──────────────────────────────────────────── */

.admin-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    line-height: 1.5;
}

.admin-badge-admin {
    background: #ede9fe;
    color: #7c3aed;
}

.admin-badge-user {
    background: #f1f5f9;
    color: #64748b;
}

.admin-badge-active {
    background: #dcfce7;
    color: #16a34a;
}

.admin-badge-banned {
    background: #fef2f2;
    color: #dc2626;
}

.admin-badge-preset {
    background: #e0e7ff;
    color: #4f46e5;
}

/* ─── 按钮 ──────────────────────────────────────────── */

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
}

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

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-text {
    background: transparent;
    color: var(--primary);
    padding: 6px 12px;
}

.btn-text:hover {
    background: var(--primary-light);
}

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

.btn-xs {
    padding: 3px 8px;
    font-size: 11px;
}

.admin-danger {
    color: var(--danger) !important;
}

.admin-danger:hover {
    background: rgba(239, 68, 68, 0.08) !important;
}

/* ─── 区块 ──────────────────────────────────────────── */

.admin-section {
    margin-bottom: 32px;
}

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

.admin-section-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.admin-hint {
    font-size: 12px;
    color: var(--text-light);
}

/* ─── 音乐网格 ──────────────────────────────────────── */

.admin-music-grid {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.admin-music-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.admin-music-item:last-child {
    border-bottom: none;
}

.admin-music-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.admin-music-name {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-music-file {
    font-size: 12px;
    color: var(--text-light);
    white-space: nowrap;
}

/* ─── 配置列表 ──────────────────────────────────────── */

.admin-config-list {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.admin-config-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.admin-config-item:last-child {
    border-bottom: none;
}

.admin-config-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.admin-config-value {
    font-size: 13px;
}

.admin-config-value code {
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--primary);
}

/* ─── 模态框 ────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 440px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    display: flex;
    border-radius: 6px;
    transition: var(--transition);
}

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

.modal-body {
    padding: 20px 24px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 24px;
    border-top: 1px solid var(--border);
}

/* ─── 表单 ──────────────────────────────────────────── */

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

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: border-color var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-file-upload {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-file-upload input[type="file"] {
    font-size: 13px;
}

.form-file-hint {
    font-size: 12px;
    color: var(--text-light);
}

/* ─── 反馈管理 ──────────────────────────────────────── */

.feedback-filters {
    display: flex;
    gap: 8px;
}

.feedback-filters .form-input {
    padding: 8px 12px;
    font-size: 13px;
}

.feedback-badge-pending {
    background: #fef3c7;
    color: #d97706;
}

.feedback-badge-progress {
    background: #dbeafe;
    color: #2563eb;
}

.feedback-badge-accepted {
    background: #dcfce7;
    color: #16a34a;
}

.feedback-badge-rejected {
    background: #f1f5f9;
    color: #94a3b8;
}

.feedback-badge-feature {
    background: #ede9fe;
    color: #7c3aed;
}

.feedback-badge-bug {
    background: #fef2f2;
    color: #dc2626;
}

.feedback-badge-improve {
    background: #f0f9ff;
    color: #0284c7;
}

.feedback-badge-other {
    background: #f1f5f9;
    color: #64748b;
}

.feedback-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.feedback-detail-content {
    background: var(--bg-input);
    padding: 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    margin-bottom: 16px;
    max-height: 200px;
    overflow-y: auto;
}

.feedback-detail-reply {
    margin-top: 12px;
}

.feedback-detail-reply label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.feedback-detail-reply textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    resize: vertical;
    min-height: 80px;
}

.feedback-detail-reply textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ─── 响应式 ────────────────────────────────────────── */

@media (max-width: 768px) {
    .admin-sidebar {
        display: none;
    }

    .admin-content {
        padding: 20px 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-value {
        font-size: 28px;
    }

    .admin-table {
        font-size: 12px;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 12px;
    }
}
