﻿/* ==================== 全局重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

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

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    outline: none;
    cursor: pointer;
    font-family: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: 1rem;
}

img {
    max-width: 100%;
    height: auto;
}

/* ==================== 移动端容器 ==================== */
.mobile-body {
    background: #f0f2f5;
    min-height: 100vh;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: #f0f2f5;
    position: relative;
    padding-bottom: 70px;
}

/* ==================== 头部 ==================== */
.app-header {
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    color: white;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    position: relative;
    min-height: 50px;
}

.header-back {
    position: absolute;
    left: 16px;
    color: white;
    font-size: 1.2rem;
    padding: 4px 8px;
}

.header-title {
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
}

.header-logout {
    position: absolute;
    right: 16px;
    color: white;
    font-size: 0.85rem;
    padding: 4px 8px;
}

/* ==================== 闪存消息 ==================== */
.flash-message {
    padding: 12px 16px;
    text-align: center;
    font-size: 0.9rem;
    position: sticky;
    top: 50px;
    z-index: 99;
}

.flash-success {
    background: #e8f5e9;
    color: #2e7d32;
    border-bottom: 1px solid #c8e6c9;
}

.flash-error {
    background: #ffebee;
    color: #c62828;
    border-bottom: 1px solid #ffcdd2;
}

/* ==================== 主内容区 ==================== */
.app-main {
    padding: 12px;
}

/* ==================== 卡片样式 ==================== */
.card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1a237e;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

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

.form-label {
    display: block;
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-input,
.form-select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: #fafafa;
    transition: all 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #1a237e;
    background: white;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-input {
    min-height: 100px;
    resize: vertical;
}

/* ==================== 按钮样式 ==================== */
.btn {
    display: block;
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(26, 35, 126, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(26, 35, 126, 0.3);
}

.btn-secondary {
    background: #f5f5f5;
    color: #555;
    border: 1px solid #ddd;
}

.btn-secondary:active {
    background: #eee;
}

.btn-success {
    background: linear-gradient(135deg, #2e7d32 0%, #43a047 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #c62828 0%, #e53935 100%);
    color: white;
}

.btn-sm {
    display: inline-block;
    width: auto;
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-group {
    display: flex;
    gap: 10px;
}

.btn-group .btn {
    flex: 1;
}

/* ==================== 底部导航 ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 6px 0;
    box-shadow: 0 -1px 6px rgba(0,0,0,0.08);
    z-index: 100;
    border-top: 1px solid #eee;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 12px;
    color: #999;
    transition: color 0.2s;
}

.nav-item.active {
    color: #1a237e;
}

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

.nav-text {
    font-size: 0.7rem;
}

/* ==================== 用户信息卡片 ==================== */
.user-card {
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    color: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.user-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.user-info {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* ==================== 孩子卡片 ==================== */
.child-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.child-card.inactive {
    opacity: 0.6;
    background: #f5f5f5;
}

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

.child-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: #333;
}

.child-class {
    font-size: 0.8rem;
    color: #666;
    background: #f0f0f0;
    padding: 2px 10px;
    border-radius: 20px;
}

/* ==================== 菜品卡片 ==================== */
.dish-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.dish-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #f0f0f0;
}

.dish-info {
    padding: 14px;
}

.dish-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.dish-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #666;
    font-size: 0.85rem;
}

.dish-price {
    color: #e53935;
    font-size: 1.1rem;
    font-weight: 600;
}

.dish-stock {
    color: #666;
}

.dish-stock.low {
    color: #ff9800;
}

.dish-stock.out {
    color: #999;
}

/* ==================== 日期选择 ==================== */
.date-section {
    margin-bottom: 16px;
}

.date-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a237e;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #e8eaf6;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.date-weekday {
    font-size: 0.8rem;
    color: #666;
    font-weight: normal;
}

/* ==================== 复选框样式 ==================== */
.checkbox-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #fafafa;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.checkbox-item:active {
    background: #f0f0f0;
}

.checkbox-item input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-right: 12px;
    accent-color: #1a237e;
}

/* ==================== 订单确认页 ==================== */
.order-confirm-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

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

.order-total {
    display: flex;
    justify-content: space-between;
    padding: 16px 0;
    margin-top: 8px;
    border-top: 2px solid #1a237e;
    font-size: 1.1rem;
    font-weight: 600;
}

/* ==================== 记录列表 ==================== */
.record-item {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

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

.record-date {
    font-weight: 600;
    color: #333;
}

.record-status {
    font-size: 0.8rem;
    padding: 2px 10px;
    border-radius: 20px;
}

.status-ordered {
    background: #e3f2fd;
    color: #1565c0;
}

.status-eaten {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-cancelled {
    background: #ffebee;
    color: #c62828;
}

/* ==================== 弹出层 ==================== */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: flex-end;
}

.overlay.active {
    display: flex;
}

.overlay-content {
    background: white;
    width: 100%;
    max-width: 480px;
    border-radius: 20px 20px 0 0;
    padding: 24px 20px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.overlay-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: center;
}

.overlay-close {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
}

/* ==================== 日历弹出层 ==================== */
.calendar-overlay .overlay-content {
    max-height: 90vh;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-top: 12px;
}

.calendar-weekday {
    text-align: center;
    font-size: 0.8rem;
    color: #999;
    padding: 8px 0;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    position: relative;
}

.calendar-day:hover {
    background: #f0f0f0;
}

.calendar-day.selected {
    background: #1a237e;
    color: white;
}

.calendar-day.disabled {
    color: #ccc;
    cursor: not-allowed;
}

.calendar-day .day-number {
    font-weight: 500;
}

.calendar-day .day-week {
    font-size: 0.65rem;
    margin-top: 2px;
}

/* ==================== 标签切换 ==================== */
.tab-nav {
    display: flex;
    background: white;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

.tab-item {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.tab-item.active {
    color: #1a237e;
    border-bottom-color: #1a237e;
    font-weight: 500;
}

.tab-content {
    display: none;
}

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

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

.empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.empty-text {
    font-size: 0.95rem;
}

/* ==================== 统计卡片 ==================== */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1a237e;
}

/* ==================== 列表项 ==================== */
.list-item {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.list-item-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.list-item-sub {
    font-size: 0.85rem;
    color: #666;
}

/* ==================== 响应式 ==================== */
@media screen and (min-width: 481px) {
    .app-container {
        max-width: 480px;
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
    }
}

/* ==================== 加载动画 ==================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f0f0f0;
    border-top-color: #1a237e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==================== 登录页特殊样式 ==================== */
.login-page {
    background: linear-gradient(135deg, #1a237e 0%, #283593 50%, #3949ab 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    background: white;
    border-radius: 20px;
    padding: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.login-box {
    background: white;
    border-radius: 16px;
    padding: 32px 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.login-title {
    text-align: center;
    font-size: 1.3rem;
    color: #1a237e;
    margin-bottom: 24px;
    font-weight: 600;
}

/* ==================== 添加/删除按钮组 ==================== */
.action-btns {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.action-btn {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    border: none;
}

.action-btn-add {
    background: #e8f5e9;
    color: #2e7d32;
}

.action-btn-del {
    background: #ffebee;
    color: #c62828;
}

/* ==================== 分页 ==================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 20px 0;
}

.page-btn {
    padding: 8px 14px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #333;
    cursor: pointer;
}

.page-btn.active {
    background: #1a237e;
    color: white;
    border-color: #1a237e;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== 搜索栏 ==================== */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* ==================== 模态框 ==================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.modal-text {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.modal-btns {
    display: flex;
    gap: 10px;
}

.modal-btns .btn {
    flex: 1;
    margin-bottom: 0;
}

/* ==================== 步骤指示器 ==================== */
.steps {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
}

.step {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
}

.step.active {
    background: #1a237e;
    color: white;
}

.step-line {
    width: 40px;
    height: 2px;
    background: #e0e0e0;
    margin: 0 8px;
}

.step-line.active {
    background: #1a237e;
}

/* ==================== 多选标签 ==================== */
.tag-select {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-option {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    color: #666;
}

.tag-option.selected {
    background: #1a237e;
    color: white;
    border-color: #1a237e;
}

/* ==================== 请假类型选择 ==================== */
.leave-types {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leave-type-item {
    display: flex;
    align-items: center;
    padding: 14px;
    background: #fafafa;
    border-radius: 10px;
    cursor: pointer;
}

.leave-type-item input {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    accent-color: #1a237e;
}

/* ==================== 表格样式（移动端适配） ==================== */
.mobile-table {
    width: 100%;
}

.mobile-table-row {
    background: white;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mobile-table-cell {
    flex: 1;
    min-width: 45%;
}

.mobile-table-label {
    font-size: 0.75rem;
    color: #999;
    margin-bottom: 2px;
}

.mobile-table-value {
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
}

/* ==================== 人脸采集 ==================== */
.face-capture-area {
    width: 100%;
    max-width: 320px;
    height: 240px;
    margin: 0 auto 16px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.face-capture-area video,
.face-capture-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.face-capture-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 160px;
    height: 200px;
    border: 2px dashed rgba(255,255,255,0.5);
    border-radius: 50% 50% 45% 45%;
}
