/* ============================================================
   停车缴费模块统一样式 - parking.css
   现代化卡片布局 + 渐变橙主色
   ============================================================ */

/* CSS 变量定义（含 fallback） */
.parking-page {
    --parking-primary: #FF6B35;
    --parking-primary-light: #FF8C42;
    --parking-primary-dark: #E55A2B;
    --parking-bg: #F5F6FA;
    --parking-card-bg: #FFFFFF;
    --parking-text: #333333;
    --parking-text-secondary: #999999;
    --parking-text-tertiary: #BBBBBB;
    --parking-border: #EEEEEE;
    --parking-success: #07C160;
    --parking-error: #FA5151;
    --parking-warning: #FA9D3B;
    --parking-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --parking-shadow-light: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* 页面背景 */
.parking-page {
    background: #F5F6FA;
    min-height: 100vh;
    padding-bottom: 20px;
}

/* ============================================================
   顶部导航栏优化 - 覆盖 base.html 的 .head 样式
   ============================================================ */
/* 隐藏 base.html 默认的 .head 导航 */
.parking-page ~ .head,
body:has(.parking-page) .head {
    display: none !important;
}

/* 停车页面自定义导航栏 */
.parking-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, #FF6B35, #FF8C42);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.2);
    /* 导航栏占满全宽 */
    width: 100%;
    margin: 0 0 0 0;
    box-sizing: border-box;
}

.parking-nav .nav-back {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    font-weight: 300;
    text-decoration: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    transition: background 0.2s;
    line-height: 1;
}

.parking-nav .nav-back:active {
    background: rgba(255, 255, 255, 0.35);
}

.parking-nav .nav-title {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    font-family: "Microsoft YaHei", sans-serif;
    letter-spacing: 1px;
    /* 留出 back 按钮宽度的占位，使标题真正居中 */
    margin-right: 44px;
}

/* ============================================================
   车牌输入卡片
   ============================================================ */
.parking-input-card {
    background: #fff;
    border-radius: 16px;
    margin: 20px 16px;
    padding: 0;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: margin 0.25s ease, border-radius 0.25s ease;
}

/* ============================================================
   关键修复：弹窗弹出时，输入卡片浮动到屏幕顶部
   避免被底部弹出的车牌键盘遮挡（scrollIntoView 对 fixed 弹窗无效）
   ============================================================ */
.parking-input-card.plate-editing {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    margin: 0;
    border-radius: 0;
    z-index: 100; /* 高于 .plate-mask(98) 和 .list-wrap(99) */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    max-height: 45vh; /* 限制最大高度，留出空间给底部弹窗 */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: plate-card-slide-down 0.25s ease;
}

@keyframes plate-card-slide-down {
    from { transform: translateY(-100%); opacity: 0.6; }
    to { transform: translateY(0); opacity: 1; }
}

/* 弹出状态下压缩头部装饰，节省空间 */
.parking-input-card.plate-editing .parking-input-header {
    padding: 14px 20px 12px;
}
.parking-input-card.plate-editing .parking-input-header .header-icon {
    display: none;
}
.parking-input-card.plate-editing .parking-input-header .header-title {
    font-size: 16px;
    margin-bottom: 0;
}
.parking-input-card.plate-editing .parking-input-header .header-subtitle {
    display: none;
}

/* 弹出状态下压缩内容区 */
.parking-input-card.plate-editing .parking-input-body {
    padding: 16px 20px 16px;
}

/* 弹出状态下隐藏查询按钮，避免误触 */
.parking-input-card.plate-editing .parking-btn,
.parking-input-card.plate-editing .parking-notice,
.parking-input-card.plate-editing .parking-checkbox-row {
    display: none;
}

/* 弹出状态下压缩标签 */
.parking-input-card.plate-editing .parking-input-label {
    margin-bottom: 6px;
    text-align: center;
    font-size: 12px;
}

/* 卡片头部 - 渐变背景 + 图标标题 */
.parking-input-header {
    background: linear-gradient(135deg, #FF6B35, #FF8C42);
    padding: 28px 24px 24px;
    text-align: center;
    color: #fff;
}

.parking-input-header .header-icon {
    font-size: 40px;
    line-height: 1;
    margin-bottom: 10px;
    display: inline-block;
}

.parking-input-header .header-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.parking-input-header .header-subtitle {
    font-size: 13px;
    opacity: 0.85;
    font-weight: 400;
}

/* 卡片内容区 */
.parking-input-body {
    padding: 24px 20px 20px;
}

/* 覆盖 hongmen.css 的 #plate_div 样式 */
.parking-input-body #plate_div {
    height: auto;
    background: transparent;
    border-bottom: none;
    width: 100%;
}

.parking-input-label {
    font-size: 13px;
    color: #999;
    margin-bottom: 10px;
    padding-left: 2px;
    font-weight: 500;
}

.plate-input-group {
    display: flex;
    gap: 5px;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
}

/* 第一个框（省份）特殊样式 - 蓝底白字模拟车牌 */
.plate-input-group input#province {
    background: #2A5CAA;
    color: #fff;
    border-color: #2A5CAA;
}

.plate-input-group input#letter {
    background: #2A5CAA;
    color: #fff;
    border-color: #2A5CAA;
}

.plate-input-group input[type="text"] {
    width: 34px;
    height: 46px;
    border: 2px solid #E0E0E0;
    border-radius: 6px;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    font-family: "Microsoft YaHei", sans-serif;
    color: #333;
    background: #FAFBFC;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    margin: 0;
    padding: 0;
    caret-color: #FF6B35;
}

.plate-input-group input[type="text"]:focus,
.plate-input-group input[type="text"]:active {
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.12);
    background: #fff;
    outline: none;
}

.plate-input-group input#province:focus,
.plate-input-group input#letter:focus,
.plate-input-group input#province:active,
.plate-input-group input#letter:active {
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.12);
}

/* 车牌输入框新能源扩展位 */
.plate-input-group input#plate5 {
    display: none;
}
.plate-input-group.has-new-energy input#plate5 {
    display: block;
}

/* 新能源勾选区 */
.parking-checkbox-row {
    margin-top: 16px;
    text-align: center;
    font-size: 13px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.parking-checkbox-row input[type="checkbox"] {
    width: 15px !important;
    height: 15px !important;
    background: transparent !important;
    vertical-align: middle;
    accent-color: #FF6B35;
    cursor: pointer;
}
.parking-checkbox-row label {
    cursor: pointer;
    user-select: none;
}

/* 单选切换（车牌/卡号） */
.parking-radio-row {
    text-align: center;
    font-size: 15px;
    color: #666;
    margin-bottom: 8px;
}
.parking-radio-row input[type="radio"] {
    vertical-align: middle;
    margin-right: 4px;
    accent-color: #FF6B35;
}

/* 错误提示文字 */
.parking-notice {
    color: #FA5151;
    font-size: 13px;
    text-align: center;
    margin: 10px 0 4px;
    line-height: 1.6;
    padding: 8px 12px;
    background: #FFF5F5;
    border-radius: 8px;
}

/* ============================================================
   弹窗遮罩与关闭按钮
   ============================================================ */
.plate-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
    display: none;
}

.plate-close {
    position: absolute;
    top: -36px;
    right: 10px;
    color: #fff;
    font-size: 28px;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    z-index: 100;
}

/* ============================================================
   结算卡片
   ============================================================ */
.parking-card {
    background: #fff;
    margin: 20px 16px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.parking-card-header {
    background: #FF6B35;
    background: linear-gradient(135deg, #FF6B35, #FF8C42);
    color: #fff;
    padding: 28px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.parking-card-header .plate-number {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 2px;
    font-family: "Microsoft YaHei", sans-serif;
}

.parking-card-header .parking-type-tag {
    background: rgba(255, 255, 255, 0.25);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 400;
}

.parking-card-body {
    padding: 8px 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #EEEEEE;
}
.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: #999999;
    font-size: 14px;
    flex-shrink: 0;
}

.info-value {
    color: #333333;
    font-size: 15px;
    font-weight: 500;
    text-align: right;
}

.info-value.highlight {
    color: #FF6B35;
    font-size: 17px;
    font-weight: 700;
}

.info-value.success {
    color: #07C160;
    font-size: 17px;
    font-weight: 700;
}

.parking-card-footer {
    background: #FAFBFC;
    padding: 20px;
    border-top: 1px solid #EEEEEE;
}

.amount-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.amount-row .amount-label {
    color: #333;
    font-size: 15px;
}

.amount-row .amount {
    font-size: 30px;
    font-weight: 700;
    color: #FF6B35;
    font-family: "Microsoft YaHei", sans-serif;
}

.amount-row .amount-unit {
    font-size: 16px;
    font-weight: 500;
    color: #FF6B35;
    margin-left: 2px;
}

/* 积分行 */
.point-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}
.point-row .point-value {
    font-size: 22px;
    font-weight: 700;
    color: #FF6B35;
}
.point-row .point-unit {
    font-size: 13px;
    color: #999;
    margin-left: 4px;
}

/* ============================================================
   按钮
   ============================================================ */
.parking-btn {
    display: block;
    width: calc(100% - 32px);
    margin: 20px auto;
    height: 50px;
    line-height: 50px;
    text-align: center;
    background: #FF6B35;
    background: linear-gradient(135deg, #FF6B35, #FF8C42);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    font-family: "Microsoft YaHei", sans-serif;
    border-radius: 25px;
    border: none;
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.35);
    transition: all 0.2s;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    letter-spacing: 1px;
}

.parking-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 6px rgba(255, 107, 53, 0.3);
}

.parking-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.parking-btn-secondary {
    background: #fff;
    color: #FF6B35;
    border: 1px solid #FF6B35;
    box-shadow: none;
}

.parking-btn-secondary:active {
    background: #FFF5F0;
}

.parking-btn-success {
    background: #07C160;
    background: linear-gradient(135deg, #07C160, #2DC770);
    box-shadow: 0 4px 12px rgba(7, 193, 96, 0.3);
}

/* ============================================================
   错误页/离线页通用
   ============================================================ */
.parking-error-container {
    text-align: center;
    padding: 60px 24px 24px;
}

.parking-error-icon {
    font-size: 72px;
    margin-bottom: 24px;
    line-height: 1;
}

.parking-error-title {
    font-size: 20px;
    color: #333;
    font-weight: 600;
    margin-bottom: 12px;
}

.parking-error-desc {
    font-size: 14px;
    color: #999;
    margin-bottom: 32px;
    line-height: 1.7;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

.parking-error-plate {
    color: #FF6B35;
    font-weight: 600;
}

.parking-countdown {
    font-size: 15px;
    color: #FF6B35;
    margin-bottom: 24px;
    font-weight: 500;
}

.parking-error-actions {
    padding: 0 32px;
}

.parking-error-actions .parking-btn {
    margin-top: 12px;
}

.parking-error-tip {
    font-size: 12px;
    color: #BBBBBB;
    margin-top: 40px;
    line-height: 1.6;
}

/* 离线重试图标动画 */
.parking-error-icon.pulsing {
    animation: parking-pulse 1.5s ease-in-out infinite;
}

@keyframes parking-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.95); }
}

/* ============================================================
   上次结果恢复浮层
   ============================================================ */
.last-result-banner {
    position: fixed;
    bottom: 24px;
    left: 16px;
    right: 16px;
    background: rgba(51, 51, 51, 0.92);
    color: #fff;
    padding: 14px 16px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    z-index: 90;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    animation: parking-slide-up 0.3s ease;
}

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

.last-result-banner .banner-text {
    flex: 1;
    line-height: 1.5;
}
.last-result-banner .banner-text strong {
    color: #FFB088;
    font-weight: 600;
}
.last-result-banner .banner-close {
    color: #999;
    font-size: 18px;
    padding: 0 4px;
    margin-left: 8px;
    cursor: pointer;
}

/* ============================================================
   微信支付页加载
   ============================================================ */
.weixin-pay-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 80%;
    max-width: 300px;
}

.weixin-pay-loading p {
    color: #666;
    font-size: 15px;
    margin: 16px 0 8px;
}

.weixin-pay-loading .weixin-pay-tip {
    color: #BBB;
    font-size: 13px;
    margin: 8px 0 24px;
}

.weixin-pay-loading .retry-pay-btn {
    display: none;
    margin: 16px auto 0;
    padding: 10px 32px;
    background: #FF6B35;
    color: #fff;
    border: none;
    border-radius: 22px;
    font-size: 15px;
    cursor: pointer;
}

.weixin-pay-error {
    text-align: center;
    padding: 60px 24px;
}
.weixin-pay-error .error-icon {
    font-size: 56px;
    margin-bottom: 16px;
}
.weixin-pay-error .error-title {
    font-size: 18px;
    color: #333;
    margin-bottom: 8px;
}
.weixin-pay-error .error-desc {
    font-size: 14px;
    color: #999;
    margin-bottom: 24px;
}

/* ============================================================
   响应式适配
   ============================================================ */
@media screen and (max-width: 360px) {
    .plate-input-group input[type="text"] {
        width: 28px;
        height: 42px;
        font-size: 18px;
    }
    .plate-input-group {
        gap: 3px;
    }
    .parking-input-header .header-icon {
        font-size: 32px;
    }
    .parking-input-header .header-title {
        font-size: 16px;
    }
    .parking-card-header .plate-number {
        font-size: 22px;
    }
    .amount-row .amount {
        font-size: 26px;
    }
    .parking-btn {
        height: 46px;
        line-height: 46px;
        font-size: 15px;
    }
}

@media screen and (min-width: 768px) {
    .parking-card,
    .parking-input-card {
        max-width: 480px;
        margin-left: auto;
        margin-right: auto;
    }
    .parking-btn {
        max-width: 448px;
    }
}

/* ============================================================
   车牌键盘弹窗优化 - 底部弹出，不遮住输入区域
   覆盖 hongmen.css 的 .list-wrap 定位
   ============================================================ */

/* 弹窗从底部弹出，固定在屏幕底部 */
.parking-page .list-wrap {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    margin-top: 0 !important;
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
    padding: 12px 10px 20px;
    z-index: 99;
    animation: plate-slide-up 0.25s ease;
}

@keyframes plate-slide-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* 遮罩层减轻透明度，不遮暗输入区域 */
.parking-page .plate-mask {
    background: rgba(0, 0, 0, 0.25) !important;
}

/* 弹窗内键盘区域 */
.parking-page .plate-l {
    height: auto !important;
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
}

.parking-page .plate-l .plate-box {
    padding: 0 !important;
}

/* 键盘按钮优化 */
.parking-page .plate-box ul li a {
    background: #F7F8FA !important;
    border: 1px solid #E8E8E8 !important;
    border-radius: 6px !important;
    color: #333 !important;
    font-size: 18px !important;
    height: 44px !important;
    line-height: 44px !important;
    transition: all 0.15s;
}

.parking-page .plate-box ul li a:active {
    background: #FF6B35 !important;
    color: #fff !important;
    border-color: #FF6B35 !important;
    transform: scale(0.95);
}

.parking-page .plate-box ul li a.active {
    background: #FF6B35 !important;
    border-color: #FF6B35 !important;
    color: #fff !important;
}

/* 确定和删除按钮 */
.parking-page .plate-l .plate-box .control-que {
    background: #FF6B35 !important;
    color: #fff !important;
    border-radius: 6px !important;
    border: none !important;
    font-size: 16px !important;
    height: 44px !important;
    line-height: 44px !important;
}

.parking-page .plate-l .plate-box .control-que.del {
    background: #E8E8E8 !important;
    color: #666 !important;
}

/* 关闭按钮位置调整 */
.parking-page .plate-close-btn {
    top: -40px !important;
    right: 10px !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 20px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    color: #FF6B35 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ============================================================
   当前输入位高亮效果
   ============================================================ */
.plate-input-group input.plate-current {
    border-color: #FF6B35 !important;
    background: #FFF5F0 !important;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2) !important;
    animation: plate-blink 1s ease-in-out infinite;
}

.plate-input-group input.plate-current#province,
.plate-input-group input.plate-current#letter {
    background: #FF6B35 !important;
    border-color: #FF6B35 !important;
    animation: none;
}

@keyframes plate-blink {
    0%, 100% { box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2); }
    50% { box-shadow: 0 0 0 5px rgba(255, 107, 53, 0.35); }
}

/* ============================================================
   页面初次加载动画
   ============================================================ */
.parking-page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #F5F6FA;
    z-index: 99997;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.3s ease;
}

.parking-page-loader.hide {
    opacity: 0;
    pointer-events: none;
}

.parking-page-loader .loader-icon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: loader-bounce 0.8s ease-in-out infinite;
}

.parking-page-loader .loader-text {
    font-size: 14px;
    color: #999;
    font-family: "Microsoft YaHei", sans-serif;
}

.parking-page-loader .loader-dots {
    margin-top: 12px;
}

.parking-page-loader .loader-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #FF6B35;
    margin: 0 3px;
    animation: loader-dot 1.2s ease-in-out infinite;
}

.parking-page-loader .loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.parking-page-loader .loader-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loader-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes loader-dot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}
