/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 100%;
    min-height: 100vh;
}

/* 页面切换 */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* 登录页 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 24px;
    color: #333;
    margin-bottom: 8px;
}

.login-header .subtitle {
    font-size: 14px;
    color: #999;
}

/* 表单样式 */
.form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    background: #fafafa;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.required {
    color: #ff4757;
}

.help-text {
    font-size: 12px;
    color: #999;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(17, 153, 142, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #555;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* 头部样式 */
.header {
    background: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    font-size: 14px;
    color: #666;
}

/* 导航标签 */
.nav-tabs {
    background: white;
    display: flex;
    overflow-x: auto;
    padding: 0 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    -webkit-overflow-scrolling: touch;
}

.nav-tab {
    flex-shrink: 0;
    padding: 14px 18px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.nav-tab:hover {
    color: #667eea;
}

.nav-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

/* 主内容区 */
.main-content {
    padding: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.tab-content {
    display: none;
}

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

.content-header {
    margin-bottom: 20px;
}

.content-header h2 {
    font-size: 24px;
    color: #333;
}

/* 支出类型标签 */
.expense-type-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    flex-shrink: 0;
    padding: 10px 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

/* 筛选栏 */
.filter-bar {
    background: white;
    padding: 16px;
    border-radius: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.filter-bar select,
.filter-bar input {
    flex: 1;
    min-width: 120px;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

/* 指标卡片 */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.metric-label {
    font-size: 14px;
    color: #999;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.metric-value.positive {
    color: #52c41a;
}

.metric-value.negative {
    color: #ff4d4f;
}

/* 预警容器 */
#warnings-container {
    margin-bottom: 24px;
}

.warning-card {
    background: #fff2e8;
    border-left: 4px solid #ff9c6e;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.warning-title {
    font-weight: 600;
    color: #d46b08;
    margin-bottom: 4px;
}

.warning-detail {
    font-size: 14px;
    color: #873800;
}

/* 门店对比 */
.store-comparison-item {
    background: white;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.store-comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.store-name {
    font-weight: 600;
    font-size: 16px;
}

.store-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.store-metric {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.store-metric .label {
    color: #999;
}

.store-metric .value {
    font-weight: 500;
}

/* 列表项 */
.list-item {
    background: white;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.list-item-title {
    font-weight: 600;
    font-size: 16px;
}

.list-item-subtitle {
    font-size: 14px;
    color: #999;
    margin-bottom: 8px;
}

.list-item-content {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

.list-item-amount {
    font-size: 18px;
    font-weight: 600;
    color: #52c41a;
}

.list-item-amount.expense {
    color: #ff4d4f;
}

/* 操作按钮 */
.item-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

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

/* 信息框 */
.info-box {
    background: #e6f7ff;
    border-left: 4px solid #1890ff;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    color: #0050b3;
}

/* 错误消息 */
.error-message {
    color: #ff4d4f;
    font-size: 14px;
    margin-top: 12px;
    text-align: center;
}

/* Toast 提示 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.toast.show {
    opacity: 1;
}

.toast.success {
    background: #52c41a;
}

.toast.error {
    background: #ff4d4f;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 18px;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
    font-size: 15px;
    color: #666;
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid #eee;
}

/* 表格样式 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

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

.data-table th {
    background: #fafafa;
    font-weight: 600;
    font-size: 14px;
    color: #555;
}

.data-table td {
    font-size: 14px;
    color: #666;
}

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

/* 凭证预览 */
.voucher-preview {
    margin-top: 10px;
}

.voucher-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    display: block;
}

/* 分区样式 */
.section {
    margin-bottom: 24px;
}

.section h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 16px;
}

.data-section,
.settings-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.data-section h3,
.settings-section h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #667eea;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-bar select,
    .filter-bar input {
        width: 100%;
    }

    .store-metrics {
        grid-template-columns: 1fr;
    }

    .item-actions {
        flex-wrap: wrap;
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}
