﻿:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 260px;
    --header-height: 64px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.admin-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--gray-100);
    display: flex;
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.5;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.brand {
    padding: 24px 20px;
    font-weight: 700;
    font-size: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand::before {
    content: "";
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
    border-radius: 8px;
    display: inline-block;
}

.sidebar nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 14px;
    border-radius: var(--radius);
    margin-bottom: 4px;
    transition: all 0.2s ease;
    position: relative;
}

.sidebar nav a::before {
    content: "";
    width: 20px;
    height: 20px;
    background: currentColor;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
}

.sidebar nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar nav a.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.user-bar {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.user-bar span {
    color: #cbd5e1;
    font-weight: 500;
}

.user-bar a {
    color: #60a5fa;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.user-bar a:hover {
    background: rgba(96, 165, 250, 0.1);
    color: #93c5fd;
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.page-header {
    padding: 0 32px;
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.page-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header h1::before {
    content: "";
    width: 4px;
    height: 24px;
    background: var(--primary);
    border-radius: 2px;
}

.content-area {
    padding: 24px 32px;
    overflow: auto;
    flex: 1;
    background: var(--gray-100);
}

/* 卡片 */
.card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    border: 1px solid var(--gray-200);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-200);
    border-color: var(--gray-400);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: #059669;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* 表格 */
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table.data-table th,
table.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

table.data-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

table.data-table tbody tr {
    transition: background 0.15s ease;
}

table.data-table tbody tr:hover {
    background: var(--gray-50);
}

table.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* 表单 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group.full {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--gray-700);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    transition: all 0.2s ease;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
    white-space: pre-wrap;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--gray-400);
}

/* 提示框 */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border: 1px solid #fde68a;
}

/* 工具栏 */
.toolbar {
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* 缩略图 */
.thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    transition: transform 0.2s ease;
}

.thumb:hover {
    transform: scale(1.05);
}

.qr-preview {
    max-width: 160px;
    border-radius: var(--radius);
}

/* 上传预览 */
.upload-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
    min-height: 0;
}

.upload-thumb-item {
    position: relative;
    display: inline-block;
}

.upload-thumb-item .thumb {
    width: 96px;
    height: 96px;
    display: block;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.upload-thumb-item:hover .thumb {
    border-color: var(--primary);
}

.btn-remove-upload {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-upload:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.upload-file-input {
    margin-top: 8px;
    padding: 8px;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    width: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-file-input:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* 状态标签 */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.status-green {
    background: var(--success-light);
    color: #065f46;
}

.status-yellow {
    background: var(--warning-light);
    color: #92400e;
}

.status-red {
    background: var(--danger-light);
    color: #991b1b;
}

/* 分隔线 */
.divider {
    height: 1px;
    background: var(--gray-200);
    margin: 24px 0;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-500);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 登录页面 */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-box {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-title {
    text-align: center;
    margin-bottom: 32px;
}

.login-title h1 {
    font-size: 24px;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.login-title p {
    color: var(--gray-500);
    font-size: 14px;
}

/* 响应式 */
@media (max-width: 1024px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body.admin-body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: relative;
        box-shadow: none;
    }

    .main-content {
        margin-left: 0;
    }

    .content-area {
        padding: 16px;
    }

    .page-header {
        padding: 0 16px;
    }

    .card {
        padding: 16px;
    }

    table.data-table {
        font-size: 13px;
    }

    table.data-table th,
    table.data-table td {
        padding: 10px 12px;
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* 选择框美化 */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

/* 文件输入美化 */
input[type="file"] {
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 12px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

input[type="file"]::file-selector-button:hover {
    background: var(--primary-hover);
}
