/* ==========================================
   zt_theme_server 主题管理后台 - 完整样式表
   暗色主题 · 毛玻璃效果 · 现代UI
   ========================================== */

/* ---- CSS 变量 ---- */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --bg-input: rgba(255, 255, 255, 0.06);
    --bg-glass: rgba(255, 255, 255, 0.04);

    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;

    --border-default: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.18);
    --border-focus: rgba(102, 126, 234, 0.6);

    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --accent-hover: #5a6fd6;

    --success: #3fb950;
    --success-bg: rgba(63, 185, 80, 0.12);
    --danger: #f85149;
    --danger-bg: rgba(248, 81, 73, 0.12);
    --warning: #d29922;
    --warning-bg: rgba(210, 153, 34, 0.12);
    --info: #58a6ff;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);

    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', 'Segoe UI', sans-serif;
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ---- 顶部导航 ---- */
.header {
    background: rgba(22, 27, 34, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    padding: 0 32px;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-default);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header .logout {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.header .logout:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

/* ---- 主容器 ---- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px;
}

/* ---- 页面标题 ---- */
.page-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 28px;
}

/* ---- 卡片 ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    transition: var(--transition);
}

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

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
}

/* ---- 统计行 ---- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

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

.stat-value.accent {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-value.success {
    color: var(--success);
}

/* ---- 添加主题区域 ---- */
.add-section {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 30px;
}

.add-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-section h3::before {
    content: '+';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    font-size: 16px;
    font-weight: 700;
}

/* ---- 表单 ---- */
.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 160px;
}

.form-group label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:hover,
.form-group select:hover {
    border-color: var(--border-hover);
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--border-focus);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input[type="file"] {
    padding: 8px;
    cursor: pointer;
}

.form-group input[type="file"]::file-selector-button {
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    padding: 6px 14px;
    color: var(--text-secondary);
    cursor: pointer;
    margin-right: 10px;
    transition: var(--transition);
}

.form-group input[type="file"]::file-selector-button:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---- 按钮 ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(248, 81, 73, 0.25);
}

.btn-danger:hover {
    background: rgba(248, 81, 73, 0.2);
    border-color: rgba(248, 81, 73, 0.4);
}

.btn-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(63, 185, 80, 0.25);
}

.btn-success:hover {
    background: rgba(63, 185, 80, 0.2);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
}

.btn-outline:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 6px;
}

/* ---- 主题网格 ---- */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.theme-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.theme-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.theme-card .preview {
    height: 160px;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.theme-card .preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.theme-card:hover .preview img {
    transform: scale(1.03);
}

.theme-card .preview .no-image {
    color: var(--text-muted);
    font-size: 14px;
}

.theme-card .info {
    padding: 16px;
}

.theme-card .name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-card .name .id-tag {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.theme-card .meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.theme-card .meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

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

/* ---- 状态标签 ---- */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: var(--success-bg);
    color: var(--success);
}

.status-inactive {
    background: rgba(139, 148, 158, 0.12);
    color: var(--text-secondary);
}

/* ---- 消息提示 ---- */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 14px 22px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    display: none;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(8px);
    animation: slideInRight 0.3s ease;
    max-width: 400px;
}

.toast-success {
    background: rgba(63, 185, 80, 0.9);
    color: #fff;
}

.toast-error {
    background: rgba(248, 81, 73, 0.9);
    color: #fff;
}

.toast-warning {
    background: rgba(210, 153, 34, 0.9);
    color: #fff;
}

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

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ---- 弹窗 ---- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 440px;
    max-width: 92vw;
    box-shadow: var(--shadow-lg);
}

.modal h3 {
    font-size: 18px;
    margin-bottom: 12px;
}

.modal p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.modal .modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---- 加载状态 ---- */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.loading::before {
    content: '';
    display: block;
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-default);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 14px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- 空状态 ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state .text {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 4px;
}

.empty-state .hint {
    color: var(--text-muted);
    font-size: 13px;
}

/* ---- 表格 ---- */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
}

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

thead {
    background: var(--bg-input);
}

thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-default);
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

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

.pagination .page-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
}

.pagination .page-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.pagination .page-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

.pagination .page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ---- 搜索框 ---- */
.search-bar {
    position: relative;
    max-width: 360px;
}

.search-bar input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.search-bar input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.search-bar .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}

/* ---- 工具栏 ---- */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---- 响应式 ---- */
@media (max-width: 768px) {
    .header {
        padding: 0 16px;
        height: 56px;
    }

    .header h1 {
        font-size: 18px;
    }

    .container {
        padding: 20px 16px;
    }

    .theme-grid {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
    }

    .form-row {
        flex-direction: column;
    }

    .form-group {
        min-width: 100%;
    }

    .toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .card {
        padding: 16px;
    }

    .add-section {
        padding: 16px;
    }
}