/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-bg: #f5f7fa;
    --white: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --border-color: #e1e8ed;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
                 'Microsoft YaHei', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--light-bg);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

/* ==================== 登录页面 ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 30s linear infinite;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.login-box {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 50px 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 450px;
    width: 100%;
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header h1 {
    font-size: 2em;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-weight: 700;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.95em;
}

.login-form .form-group {
    margin-bottom: 25px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9em;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1em;
    transition: all 0.3s ease;
    background: var(--white);
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 0.9em;
    border-left: 4px solid #c33;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* ==================== 管理后台布局 ==================== */
.admin-container {
    display: flex;
    min-height: 100vh;
    background: var(--light-bg);
}

/* ==================== 侧边栏 ==================== */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 30px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.sidebar-header h2 {
    font-size: 1.5em;
    margin-bottom: 8px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    font-size: 0.85em;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    margin-top: 10px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: var(--white);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    margin: 4px 0;
}

.nav-item:hover {
    background: rgba(255,255,255,0.15);
    border-left-color: var(--white);
    transform: translateX(2px);
}

.nav-item.active {
    background: rgba(255,255,255,0.2);
    border-left-color: var(--white);
    font-weight: 600;
}

.nav-item .icon {
    font-size: 1.3em;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.15);
}

.btn-logout {
    width: 100%;
    padding: 12px;
    background: rgba(255,255,255,0.2);
    color: var(--white);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: block;
    font-weight: 500;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* ==================== 主内容区 ==================== */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    overflow-y: auto;
    min-height: 100vh;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
    background: var(--white);
    padding: 24px 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.content-header h1 {
    font-size: 2em;
    color: var(--text-primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--light-bg);
    padding: 4px 6px;
    border-radius: var(--radius-md);
}

.search-box input {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95em;
    width: 280px;
    transition: all 0.3s ease;
    background: var(--white);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    width: 320px;
}

.search-box input::placeholder {
    color: var(--text-light);
}

/* ==================== 统计卡片 ==================== */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card:nth-child(1)::before {
    background: linear-gradient(180deg, #667eea, #764ba2);
}

.stat-card:nth-child(2)::before {
    background: linear-gradient(180deg, #f093fb, #f5576c);
}

.stat-card:nth-child(3)::before {
    background: linear-gradient(180deg, #4facfe, #00f2fe);
}

.stat-icon {
    font-size: 3em;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-radius: var(--radius-lg);
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 2.2em;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.95em;
    margin-top: 6px;
    font-weight: 500;
}

/* ==================== 表格容器 ==================== */
.table-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

.data-table th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
    transform: scale(1.001);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table td strong {
    color: var(--text-primary);
    font-weight: 600;
}

.data-table .loading,
.data-table .no-data {
    text-align: center;
    color: var(--text-light);
    padding: 50px;
    font-size: 1.1em;
}

.actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    padding: 8px 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.2em;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    transform: scale(1.1);
}

.btn-edit {
    color: #17a2b8;
}

.btn-edit:hover {
    background: rgba(23, 162, 184, 0.1);
}

.btn-delete {
    color: #dc3545;
}

.btn-delete:hover {
    background: rgba(220, 53, 69, 0.1);
}

/* ==================== 分页 ==================== */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.95em;
    font-weight: 500;
}

.pagination-buttons {
    display: flex;
    gap: 8px;
}

.btn-page {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    background: var(--white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-weight: 500;
    min-width: 38px;
    text-align: center;
}

.btn-page:hover:not(.active) {
    background: var(--light-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-page.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.pagination-ellipsis {
    padding: 8px 4px;
    color: var(--text-light);
    display: flex;
    align-items: center;
}

/* ==================== 批量操作 ==================== */
.batch-actions {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--white);
    padding: 16px 30px;
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 1000;
    animation: slideUpFade 0.3s ease-out;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

#selectedCount {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.05em;
}

/* ==================== 按钮样式 ==================== */
.btn {
    padding: 11px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: var(--white);
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* ==================== 模态框 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.modal-header {
    padding: 28px 30px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

.modal-header h2 {
    font-size: 1.6em;
    color: var(--text-primary);
    font-weight: 700;
}

.close {
    font-size: 2em;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
    transition: all 0.3s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close:hover {
    color: var(--danger-color);
    background: rgba(220, 53, 69, 0.1);
    transform: rotate(90deg);
}

.modal-form {
    padding: 30px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9em;
}

.form-group label::after {
    content: ' *';
    color: var(--danger-color);
    display: none;
}

.form-group:has(input[required]) label::after,
.form-group:has(textarea[required]) label::after {
    display: inline;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95em;
    font-family: inherit;
    transition: all 0.3s ease;
    background: var(--white);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f8f9fa;
}

/* ==================== 消息提示 ==================== */
.message {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 30px;
    border-radius: var(--radius-lg);
    color: var(--white);
    font-weight: 500;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    z-index: 3000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
}

.message::before {
    font-size: 1.3em;
}

.message.show {
    top: 30px;
}

.message-success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.message-success::before {
    content: '✓';
}

.message-error {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.message-error::before {
    content: '✕';
}

.message-warning {
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: var(--text-primary);
}

.message-warning::before {
    content: '⚠';
}

.message-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
}

.message-info::before {
    content: 'ℹ';
}

/* ==================== Checkbox 样式 ==================== */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
    }

    .content-header h1 {
        font-size: 1.5em;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
    }

    .search-box {
        width: 100%;
        flex-direction: column;
        padding: 0;
        background: transparent;
    }

    .search-box input {
        width: 100% !important;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }

    .table-container {
        overflow-x: auto;
    }

    .data-table {
        min-width: 800px;
    }

    .pagination {
        flex-direction: column;
        gap: 15px;
    }

    .batch-actions {
        bottom: 20px;
        left: 20px;
        right: 20px;
        transform: none;
        flex-direction: column;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-form {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .stat-icon {
        width: 60px;
        height: 60px;
        font-size: 2.5em;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.9em;
    }
}

/* ==================== 加载动画 ==================== */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 0.8s linear infinite;
}

/* ==================== 工具类 ==================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

/* ==================== 打印样式 ==================== */
@media print {
    .sidebar,
    .header-actions,
    .batch-actions,
    .actions,
    .pagination {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }
}
