/* ==================== 基础样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* ==================== 左右布局 ==================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ==================== 左侧菜单 ==================== */
.sidebar {
    width: 220px;
    background: #1a1a2e;
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.sidebar-header p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
}

.sidebar-menu {
    flex: 1;
    padding: 16px 0;
}

.menu-item {
    display: block;
    padding: 12px 24px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.menu-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-left-color: #4f8cff;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer .user-info {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
}

.sidebar-footer .btn-logout {
    display: inline-block;
    padding: 6px 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    transition: all 0.2s;
}

.sidebar-footer .btn-logout:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ==================== 右侧内容区 ==================== */
.main-content {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
}

/* ==================== 登录页面 ==================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #1a1a2e;
}

.login-container {
    background: white;
    padding: 48px 40px;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 32px;
    color: #1a1a2e;
    font-size: 24px;
    font-weight: 600;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.login-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: #4f8cff;
}

.error-message {
    background: #fef2f2;
    color: #dc2626;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
}

/* ==================== 按钮 ==================== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background: #4f8cff;
    color: white;
}

.btn-primary:hover {
    background: #3b7de8;
}

.btn-block {
    display: block;
    width: 100%;
}

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

/* ==================== 页面头部 ==================== */
.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 24px;
    color: #1a1a2e;
    font-weight: 600;
    margin-bottom: 6px;
}

.page-desc {
    color: #666;
    font-size: 14px;
}

/* ==================== 统计卡片 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.stat-value {
    font-size: 32px;
    font-weight: 600;
    color: #1a1a2e;
}

.stat-label {
    color: #666;
    font-size: 14px;
    margin-top: 4px;
}

.stat-link {
    display: inline-block;
    margin-top: 12px;
    color: #4f8cff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.stat-link:hover {
    text-decoration: underline;
}

/* ==================== 表格 ==================== */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #fafafa;
    font-weight: 600;
    color: #555;
    font-size: 13px;
    white-space: nowrap;
}

.data-table tr:hover {
    background: #fafafa;
}

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

/* ==================== 表单元素 ==================== */
.input-inline {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.input-inline:focus {
    outline: none;
    border-color: #4f8cff;
}

.input-number {
    width: 90px;
    text-align: right;
}

.input-color {
    width: 50px;
    height: 34px;
    padding: 2px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.unit {
    color: #888;
    font-size: 12px;
    margin-left: 6px;
}

select.input-inline {
    min-width: 120px;
}

/* ==================== 徽章 ==================== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-primary {
    background: #e0edff;
    color: #2563eb;
}

.badge-danger {
    background: #fee2e2;
    color: #dc2626;
}

.badge-info {
    background: #e0f2fe;
    color: #0284c7;
}

.badge-secondary {
    background: #f3f4f6;
    color: #4b5563;
}

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

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

.badge-purple {
    background: #f3e8ff;
    color: #9333ea;
}

.badge-gold {
    background: #fef9c3;
    color: #ca8a04;
}

/* ==================== 选项卡 ==================== */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab-btn:hover {
    color: #4f8cff;
}

.tab-btn.active {
    color: #4f8cff;
    border-bottom-color: #4f8cff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ==================== 信息框 ==================== */
.info-box {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 16px 20px;
    border-radius: 0 6px 6px 0;
    margin-top: 20px;
}

.info-box h3 {
    margin-bottom: 8px;
    color: #b45309;
    font-size: 14px;
    font-weight: 600;
}

.info-box p {
    color: #666;
    margin-bottom: 4px;
    font-size: 14px;
}

/* ==================== 颜色预览 ==================== */
.color-preview {
    display: inline-block;
    width: 60px;
    height: 26px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* ==================== 分组标题 ==================== */
.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 24px 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.section-title:first-child {
    margin-top: 0;
}

/* ==================== 卡牌列表 ==================== */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-item {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.card-name {
    font-weight: 500;
    color: #1a1a2e;
    min-width: 120px;
}

.card-desc {
    color: #666;
    font-size: 13px;
}

.card-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ==================== Toast 提示 ==================== */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 12px 24px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    font-size: 14px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: #16a34a;
}

.toast.error {
    background: #dc2626;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .sidebar-menu {
        display: flex;
        flex-wrap: wrap;
        padding: 8px;
    }

    .menu-item {
        padding: 8px 16px;
        border-left: none;
        border-bottom: 2px solid transparent;
    }

    .menu-item.active {
        border-left: none;
        border-bottom-color: #4f8cff;
    }

    .main-content {
        padding: 20px;
    }

    .table-container {
        overflow-x: auto;
    }

    .data-table {
        min-width: 600px;
    }
}
