/* 全局样式 */
:root {
    --primary: #4CAF50;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --light: #f8f9fa;
    --dark: #343a40;
    --border: #dee2e6;
    --bg: #ffffff;
    --text: #333333;
    --text-light: #6c757d;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background-color: #f5f5f5;
}

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

.sidebar {
    width: 250px;
    background-color: var(--dark);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.sidebar.open {
    transform: translateX(0);
}

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

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

.sidebar-nav ul {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-icon {
    margin-right: 10px;
    font-size: 18px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: absolute;
    bottom: 0;
    width: 100%;
}

.main-content {
    flex: 1;
    margin-left: 0;
    transition: margin-left 0.3s ease;
}

.main-header {
    background-color: var(--bg);
    padding: 15px 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    margin-right: 20px;
}

.content {
    padding: 20px;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.overlay.show {
    display: block;
}

.blank-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f5f5f5;
}

/* 表单样式 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(76, 175, 80, 0.25);
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    background-color: #45a049;
}

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

.btn-outline:hover {
    background-color: var(--light);
}

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

.stat-card {
    background-color: var(--bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-card.primary {
    border-left: 4px solid var(--primary);
}

.stat-card.success {
    border-left: 4px solid var(--success);
}

.stat-card.warning {
    border-left: 4px solid var(--warning);
}

.stat-card.danger {
    border-left: 4px solid var(--danger);
}

.stat-value {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 5px;
}

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

/* 快捷操作 */
.quick-actions {
    margin-bottom: 30px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--dark);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.action-item {
    background-color: var(--bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s ease;
}

.action-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.action-icon {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
}

.action-label {
    font-weight: 500;
}

/* 卡片列表 */
.card-list {
    background-color: var(--bg);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-item {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.3s ease;
}

.card-item:hover {
    background-color: var(--light);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
}

.card-subtitle {
    font-size: 14px;
    color: var(--text-light);
}

/* 标签 */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.tag {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.tag-checkbox {
    margin-right: 8px;
    cursor: pointer;
}

/* 搜索框 */
.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
}

/* 标签筛选 */
.tag-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.tag-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background-color: var(--bg);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.tag-btn.active {
    font-weight: 600;
}

/* 扫描区域 */
.scan-container {
    background-color: var(--bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.scan-header {
    text-align: center;
    margin-bottom: 20px;
}

.scan-area {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto 20px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    overflow: hidden;
}

#scanPreview {
    width: 100%;
    height: auto;
    display: block;
}

.scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0) 20%,
        rgba(0, 0, 0, 0) 80%,
        rgba(0, 0, 0, 0.3) 100%
    );
}

.scan-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

.scan-controls {
    text-align: center;
}

.scan-form {
    background-color: var(--bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tags-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

/* 统计页面 */
.stats-filter {
    margin-bottom: 30px;
}

.date-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.date-filter input {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.stats-section {
    background-color: var(--bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stat-item {
    margin-bottom: 15px;
}

.stat-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.stat-bar {
    height: 10px;
    background-color: var(--light);
    border-radius: 5px;
    overflow: hidden;
}

.stat-progress {
    height: 100%;
    transition: width 0.5s ease;
}

/* 加载状态 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--light);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

.empty-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

/* 登录页面 */
.login-form {
    background-color: var(--bg);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 400px;
}

.login-form h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary);
}

.login-tip {
    text-align: center;
    margin-top: 20px;
    color: var(--text-light);
    font-size: 12px;
}

/* 错误页面 */
.error-page {
    text-align: center;
    padding: 60px 20px;
}

.error-code {
    font-size: 72px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 20px;
}

.error-page h1 {
    font-size: 24px;
    margin-bottom: 10px;
}

.error-page p {
    color: var(--text-light);
    margin-bottom: 30px;
}

/* 提示消息 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background-color: var(--success);
}

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

.toast.info {
    background-color: var(--primary);
}

/* 隐藏类 */
.hidden {
    display: none;
}

/* 响应式设计 */
@media (min-width: 768px) {
    .sidebar {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 250px;
    }

    .menu-toggle {
        display: none;
    }

    .overlay {
        display: none !important;
    }
}
