/* 基础样式 - 移动端优先 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --primary-dark: #5a67d8;
    --secondary-color: #764ba2;
    --success-color: #48bb78;
    --warning-color: #ed8936;
    --danger-color: #f56565;
    --bg-color: #f7fafc;
    --card-bg: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-color: #e2e8f0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* 页面容器 */
.page {
    min-height: 100vh;
    padding-bottom: 80px; /* 底部导航高度 */
}

.hidden {
    display: none !important;
}

/* 认证页面 */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.auth-container .logo {
    font-size: 80px;
    margin-bottom: 20px;
}

.auth-container h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.auth-container .subtitle {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 40px;
}

.auth-status {
    background: rgba(255,255,255,0.2);
    padding: 30px;
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.auth-request {
    background: rgba(255,255,255,0.95);
    color: var(--text-primary);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.auth-request p {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--danger-color);
}

/* 头部 */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

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

.date-display {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 5px;
}

/* 今日概览 */
.overview {
    padding: 20px;
}

.overview h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.stat-card {
    background: var(--card-bg);
    padding: 15px 10px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-card.da .stat-value {
    color: var(--danger-color);
}

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

.stat-card.money .stat-value {
    color: var(--warning-color);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* 录入区域 */
.input-section {
    padding: 20px;
    background: var(--card-bg);
    margin: 0 20px 20px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.input-section h2 {
    font-size: 18px;
    margin-bottom: 15px;
}

textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 16px;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.3s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.input-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* 按钮 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

/* 解析结果 */
.parse-result {
    padding: 20px;
    background: #f0fff4;
    margin: 0 20px 20px;
    border-radius: 16px;
    border: 1px solid #9ae6b4;
}

.parse-result h3 {
    color: var(--success-color);
    margin-bottom: 15px;
}

/* 记录列表 */
.records-section {
    padding: 20px;
}

.records-section h2 {
    font-size: 18px;
    margin-bottom: 15px;
}

.records-list {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.record-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.record-item:last-child {
    border-bottom: none;
}

.record-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.record-location {
    font-weight: 600;
    color: var(--primary-color);
}

.record-count {
    font-size: 14px;
    color: var(--text-secondary);
}

.record-workers {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.worker-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.worker-tag.da {
    background: #fed7d7;
    color: #c53030;
}

.worker-tag.xiao {
    background: #c6f6d5;
    color: #22543d;
}

.worker-tag.unknown {
    background: #fef5e7;
    color: #975a16;
}

.record-costs {
    font-size: 14px;
    color: var(--text-secondary);
}

.empty {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 15px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 2px;
}

.nav-label {
    font-size: 11px;
}

/* 统计页面 */
.stats-content {
    padding: 20px;
}

.filter-bar {
    margin-bottom: 20px;
}

.filter-bar select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: var(--card-bg);
}

.stats-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.summary-item {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
}

.summary-label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.summary-value {
    display: block;
    font-size: 28px;
    font-weight: bold;
    color: var(--primary-color);
}

/* 导出页面 */
.export-content {
    padding: 20px;
}

.export-section {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.export-section h3 {
    margin-bottom: 15px;
}

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

.date-range input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
}

/* 响应式 - 大屏幕 */
@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .input-section,
    .parse-result {
        margin: 0 auto 20px;
        max-width: 600px;
    }
}
