/* ==========================================
   花花义工预约 - 前端 H5 样式
   移动端优先，暖橙 + 米白
   ========================================== */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    background: #FFF8F0;
    color: #1F2937;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}
body { padding-bottom: env(safe-area-inset-bottom); }
a { color: #F97316; text-decoration: none; }
input, button, textarea, select { font-family: inherit; font-size: inherit; }
img { max-width: 100%; display: block; }

/* ========== 顶部导航 ========== */
.app-header {
    background: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #F3E8DC;
    position: sticky;
    top: 0;
    z-index: 100;
}
.app-header-title {
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
    display: flex;
    align-items: center;
    gap: 8px;
}
.app-header-title svg { color: #F97316; }
.app-header-title img { width: 22px; height: 22px; object-fit: contain; border-radius: 5px; }
.app-header-right { display: flex; align-items: center; gap: 12px; }
.app-header-link {
    font-size: 13px;
    color: #6B7280;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ========== 主容器 ========== */
.app-main { padding: 16px; max-width: 640px; margin: 0 auto; }
.app-container { min-height: 100vh; display: flex; flex-direction: column; }
.app-body { flex: 1; padding-bottom: 80px; }

/* ========== 底部 Tab ========== */
.app-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #F3E8DC;
    display: flex;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 100;
}
.app-tab {
    flex: 1;
    text-align: center;
    padding: 4px 0;
    color: #9CA3AF;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
}
.app-tab.active { color: #F97316; }
.app-tab svg { width: 22px; height: 22px; }

/* ========== 卡片 ========== */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    border: 1px solid #FDF3E7;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 20px;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
    background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 6px rgba(249,115,22,.25);
}
.btn-primary:active { box-shadow: 0 1px 3px rgba(249,115,22,.25); }
.btn-danger { background: #DC2626; border-color: #DC2626; color: #fff; }
.btn-outline { background: transparent; border-color: #F97316; color: #F97316; }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }

/* ========== 输入框 ========== */
.input, .select, .textarea {
    width: 100%;
    padding: 12px 14px;
    background: #FFFCF8;
    border: 1px solid #F3E8DC;
    border-radius: 8px;
    color: #1F2937;
    transition: border-color .15s;
    font-size: 15px;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: #F97316;
    background: #fff;
}
.input[readonly] { background: #F9FAFB; color: #6B7280; }
.form-row { margin-bottom: 14px; }
.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #4B5563;
    font-weight: 500;
}
.form-label .req { color: #DC2626; margin-left: 2px; }
.form-hint { font-size: 12px; color: #9CA3AF; margin-top: 4px; }

/* ========== 徽标 ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.6;
    background: #F3F4F6;
    color: #6B7280;
}
.badge-green { background: #D1FAE5; color: #065F46; }
.badge-red { background: #FEE2E2; color: #991B1B; }
.badge-orange { background: #FED7AA; color: #9A3412; }
.badge-gray { background: #E5E7EB; color: #4B5563; }

/* ========== 登录页 ========== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #FDBA74 0%, #FFF8F0 50%);
    display: flex;
    flex-direction: column;
    padding: 60px 24px 24px;
}
.login-logo {
    text-align: center;
    margin-bottom: 40px;
}
.login-logo-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 12px;
    background: #fff;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(249,115,22,.2);
    color: #F97316;
}
.login-logo-icon img { width: 48px; height: 48px; object-fit: contain; border-radius: 8px; }
.login-title { font-size: 22px; font-weight: 600; color: #7C2D12; }
.login-sub { font-size: 13px; color: #9A3412; margin-top: 6px; }
.login-box {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,.06);
}
.login-msg {
    padding: 10px 12px;
    background: #FEF2F2;
    color: #991B1B;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 14px;
    display: none;
}
.login-msg.show { display: block; }
.login-msg.success { background: #ECFDF5; color: #065F46; }
.login-tip {
    text-align: center;
    font-size: 12px;
    color: #9CA3AF;
    margin-top: 20px;
    line-height: 1.7;
}

/* ========== 日历 ========== */
.calendar {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    border: 1px solid #FDF3E7;
}
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.calendar-title { font-size: 16px; font-weight: 600; color: #1F2937; }
.calendar-nav {
    background: #FFF8F0;
    border: 1px solid #F3E8DC;
    color: #9A3412;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.calendar-nav:disabled { opacity: .4; cursor: not-allowed; }
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
    padding: 6px 0;
    color: #9CA3AF;
    font-size: 12px;
    border-bottom: 1px solid #F3F4F6;
    margin-bottom: 6px;
}
.calendar-weekdays span:first-child, .calendar-weekdays span:last-child { color: #F97316; }
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.calendar-cell {
    aspect-ratio: 1 / 1.1;
    min-height: 44px;
    background: #FFFCF8;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 2px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .15s;
    position: relative;
    font-size: 13px;
}
.calendar-cell:active:not(.disabled) { transform: scale(.95); }
.calendar-cell.empty { background: transparent; cursor: default; }
.calendar-cell.disabled {
    background: #F9FAFB;
    color: #D1D5DB;
    cursor: not-allowed;
}
.calendar-cell.disabled .cell-count { color: #D1D5DB; }
.calendar-cell.full {
    background: #FEF2F2;
    color: #9CA3AF;
    cursor: not-allowed;
}
.calendar-cell.full .cell-count { color: #DC2626; }
.calendar-cell.today { border-color: #F97316; }
.calendar-cell.today::before {
    content: '今';
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 9px;
    color: #F97316;
    font-weight: 600;
}
.calendar-cell.selected {
    background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(249,115,22,.3);
}
.calendar-cell.selected .cell-count { color: rgba(255,255,255,.9); }
.calendar-cell.available .cell-count { color: #059669; }
.cell-day { font-size: 15px; font-weight: 500; line-height: 1.2; }
.cell-count {
    font-size: 10px;
    color: #6B7280;
    margin-top: 2px;
    line-height: 1.2;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.calendar-legend {
    display: flex;
    gap: 14px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #F3F4F6;
    font-size: 11px;
    color: #6B7280;
    flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; }

/* ========== 底部弹出面板 ========== */
.sheet-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 200;
    display: none;
    align-items: flex-end;
}
.sheet-mask.show { display: flex; }
.sheet {
    background: #fff;
    width: 100%;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    animation: slideUp .25s ease-out;
    overflow-y: auto;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.sheet-handle {
    width: 40px;
    height: 4px;
    background: #E5E7EB;
    border-radius: 2px;
    margin: 0 auto 16px;
}
.sheet-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
    text-align: center;
}
.sheet-sub {
    font-size: 13px;
    color: #6B7280;
    text-align: center;
    margin-bottom: 20px;
}
.slot-picker { display: flex; flex-direction: column; gap: 8px; }
.slot-option {
    padding: 12px 14px;
    background: #FFFCF8;
    border: 1px solid #F3E8DC;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all .15s;
}
.slot-option.selected {
    background: #FFF7ED;
    border-color: #F97316;
    box-shadow: 0 0 0 3px rgba(249,115,22,.1);
}
.slot-option-label { font-size: 14px; font-weight: 500; color: #1F2937; }
.slot-option-time { font-size: 12px; color: #6B7280; margin-top: 2px; }
.slot-option-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
}
.slot-option.selected .slot-option-check {
    background: #F97316;
    border-color: #F97316;
    color: #fff;
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,.8);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 3000;
    max-width: 80vw;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}
.toast.show { opacity: 1; }

/* ========== 预约卡片 ========== */
.booking-item {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid #FDF3E7;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.booking-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}
.booking-date {
    font-size: 17px;
    font-weight: 600;
    color: #1F2937;
    display: flex;
    align-items: center;
    gap: 6px;
}
.booking-weekday { font-size: 12px; color: #9CA3AF; font-weight: normal; margin-left: 6px; }
.booking-info {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 6px 12px;
    font-size: 13px;
    color: #4B5563;
    padding: 10px 0;
    border-top: 1px dashed #F3E8DC;
    border-bottom: 1px dashed #F3E8DC;
    margin: 10px 0;
}
.booking-info dt { color: #9CA3AF; }
.booking-info dd { color: #1F2937; }
.booking-no { font-family: SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.booking-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.booking-actions .btn { flex: 1; }

/* ========== 预约列表(列表样式) ========== */
.booking-list {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #FDF3E7;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    padding: 2px 14px;
    overflow: hidden;
}
.booking-row {
    padding: 14px 0;
    border-bottom: 1px solid #F3F4F6;
}
.booking-row:last-child { border-bottom: none; }
.booking-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.booking-row-date {
    font-size: 15px;
    font-weight: 600;
    color: #1F2937;
    display: flex;
    align-items: center;
    gap: 6px;
}
.booking-row-weekday { font-size: 12px; color: #9CA3AF; font-weight: normal; margin-left: 2px; }
.booking-row-meta { font-size: 13px; color: #6B7280; margin-top: 6px; word-break: break-all; }
.booking-row-sub {
    font-size: 12px; color: #9CA3AF; margin-top: 3px;
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
}
.booking-row-extra { font-size: 12px; margin-top: 8px; padding: 6px 8px; border-radius: 6px; word-break: break-all; }
.booking-row-actions { display: flex; gap: 8px; margin-top: 12px; }
.booking-row-actions .btn { flex: 1; }

/* ========== 凭证页 ========== */
.voucher-card {
    background: linear-gradient(180deg, #FFF7ED 0%, #fff 100%);
    border-radius: 16px;
    padding: 24px 20px;
    text-align: center;
    border: 1px solid #FED7AA;
    box-shadow: 0 4px 20px rgba(249,115,22,.1);
    position: relative;
    overflow: hidden;
}
.voucher-card::before, .voucher-card::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: #FFF8F0;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
}
.voucher-card::before { left: -10px; }
.voucher-card::after { right: -10px; }
.voucher-title { font-size: 14px; color: #9A3412; margin-bottom: 8px; }
.voucher-no {
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 22px;
    font-weight: 700;
    color: #7C2D12;
    letter-spacing: 2px;
    margin-bottom: 20px;
    word-break: break-all;
}
.voucher-qr {
    display: inline-block;
    padding: 12px;
    background: #fff;
    border-radius: 12px;
    border: 1px dashed #FDBA74;
    margin-bottom: 20px;
}
.voucher-qr img, .voucher-qr canvas { display: block; }
.voucher-info {
    text-align: left;
    padding: 16px;
    background: rgba(255,255,255,.7);
    border-radius: 10px;
    margin-top: 12px;
}
.voucher-info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}
.voucher-info-row .label { color: #9CA3AF; }
.voucher-info-row .value { color: #1F2937; font-weight: 500; }

/* ========== 个人中心 ========== */
.profile-header {
    background: linear-gradient(135deg, #FDBA74 0%, #F97316 100%);
    color: #fff;
    padding: 20px 16px 22px;
    margin: -16px -16px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid rgba(255,255,255,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #F97316;
    overflow: hidden;
    flex-shrink: 0;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info { flex: 1; min-width: 0; }
.profile-name { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.profile-phone { font-size: 12px; opacity: .9; }

.menu-list { background: #fff; border-radius: 12px; overflow: hidden; border: 1px solid #FDF3E7; }
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #FDF3E7;
    cursor: pointer;
    color: #1F2937;
    text-decoration: none;
    font-size: 14px;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: #FFF8F0; }
.menu-item-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: #FFF7ED;
    color: #F97316;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.menu-item-arrow { margin-left: auto; color: #D1D5DB; }

/* ========== Tab 切换 ========== */
.tab-bar {
    display: flex;
    background: #fff;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 12px;
    border: 1px solid #FDF3E7;
}
.tab-item {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    font-size: 13px;
    color: #6B7280;
    cursor: pointer;
    border-radius: 6px;
    transition: all .15s;
}
.tab-item.active {
    background: #F97316;
    color: #fff;
    font-weight: 500;
}

/* ========== 空状态 ========== */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: #9CA3AF;
}
.empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    color: #D1D5DB;
    display: flex;
    align-items: center;
    justify-content: center;
}
.empty-text { font-size: 14px; }

/* ========== 加载中 ========== */
.loading {
    text-align: center;
    padding: 40px;
    color: #9CA3AF;
    font-size: 13px;
}
.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid #F3E8DC;
    border-top-color: #F97316;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 提示条 ========== */
.notice {
    background: #FFF7ED;
    border: 1px solid #FED7AA;
    color: #9A3412;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.6;
}
.notice svg { flex-shrink: 0; margin-top: 2px; }

/* ========== 宽屏自适应(≥768px)：加宽内容列并对齐头部/底部，限制日历/凭证/弹层宽度 ========== */
@media (min-width: 768px) {
    .app-main { max-width: 860px; }
    .app-header,
    .app-tabbar {
        padding-left: 16px;
        padding-right: 16px;
        padding-left: max(16px, calc((100% - 860px) / 2));
        padding-right: max(16px, calc((100% - 860px) / 2));
    }
    .calendar { max-width: 680px; margin-left: auto; margin-right: auto; }
    .voucher-card { max-width: 460px; margin-left: auto; margin-right: auto; }
    .sheet-mask { align-items: center; justify-content: center; }
    .sheet { max-width: 480px; margin: 16px; border-radius: 16px; }
}

/* ========== 小屏适配 (<=360px)：防止日历格子文字溢出、头部负边距联动 ========== */
@media (max-width: 360px) {
    .app-main { padding: 12px; }
    .app-body { padding-bottom: 76px; }
    .calendar { padding: 12px; }
    .calendar-grid { gap: 3px; }
    .calendar-weekdays { gap: 3px; }
    .calendar-cell { min-height: 40px; padding: 3px 1px; }
    .cell-day { font-size: 14px; }
    .cell-count { font-size: 9px; }
    .profile-header { margin: -12px -12px 12px; padding: 18px 14px 20px; }
    .voucher-no { font-size: 19px; letter-spacing: 1px; }
    .booking-info { grid-template-columns: 56px 1fr; gap: 5px 10px; }
}
