/* ===== 卡券核销系统 - 公共样式 ===== */

:root {
    --primary-color: #e74c3c;
    --primary-hover: #c0392b;
    --bg-light: #f8f9fa;
    --text-dark: #333;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    min-height: 100vh;
    /* 补偿 fixed-top navbar 高度(~56px)，留 8px 呼吸间距 */
    padding-top: 64px;
}

/* ===== 顶部导航 ===== */
.navbar-brand {
    font-weight: 700;
    color: var(--primary-color) !important;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    max-width: 60%;
}

.navbar-logo {
    height: 32px;
    max-width: 120px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

/* ===== 页面容器 ===== */
.page-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px 16px 24px;
}

.page-container.wide {
    max-width: 960px;
}

/* ===== 公告横幅 ===== */
.announcement-banner {
    background: linear-gradient(135deg, #fff7e6 0%, #fff3cd 100%);
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: #856404;
}

.announcement-banner i {
    font-size: 18px;
    color: #ffc107;
    flex-shrink: 0;
    margin-top: 2px;
}

.announcement-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    line-height: 1.5;
    word-break: break-word;
}

.announcement-body strong {
    font-weight: 600;
    color: #664d03;
}

.announcement-body span {
    color: #856404;
    white-space: pre-line;
}

/* ===== 卡片样式 ===== */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    border-radius: var(--radius) var(--radius) 0 0 !important;
}

/* ===== 按钮 ===== */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-lg {
    padding: 12px 32px;
    font-size: 1.1rem;
    border-radius: 8px;
}

/* ===== 表单 ===== */
.form-control, .form-select {
    border-radius: 8px;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(231, 76, 60, 0.15);
}
.form-label {
    font-weight: 500;
    margin-bottom: 6px;
}

/* ===== 礼品选择工具条 ===== */
.goods-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.goods-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    padding: 6px 10px;
    font-size: 0.82rem;
    color: #8a6d3b;
    background: #fcf8e3;
    border: 1px solid #faebcc;
    border-radius: 8px;
}
.goods-hint i { color: #f0ad4e; flex-shrink: 0; }
.goods-hint span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goods-hint-close {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: #8a6d3b;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    flex-shrink: 0;
}
.goods-hint.d-none { display: none; }

.view-switch {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.view-switch button {
    border: 0;
    background: #fff;
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 6px 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.view-switch button + button { border-left: 1px solid var(--border-color); }
.view-switch button.active {
    background: var(--primary-color);
    color: #fff;
}

/* ===== 礼品卡片网格 ===== */
.goods-grid {
    display: grid;
    gap: 16px;
}
.goods-grid.is-list {
    grid-template-columns: 1fr;
    gap: 10px;
}
.goods-grid.is-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.goods-card {
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    position: relative;
    background: #fff;
    display: flex;
}
.goods-grid.is-list .goods-card { flex-direction: row; align-items: stretch; }
.goods-grid.is-grid .goods-card { flex-direction: column; }

.goods-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.goods-card.selected {
    border-color: var(--primary-color);
    background: #fdf2f0;
}

.goods-thumb {
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 8px;
    background: var(--bg-light);
}
.goods-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.goods-grid.is-list .goods-thumb { width: 88px; height: 88px; }
.goods-grid.is-grid .goods-thumb { width: 100%; aspect-ratio: 1 / 1; }

.goods-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.goods-grid.is-list .goods-info { padding-left: 10px; }
.goods-grid.is-grid .goods-info { padding-top: 8px; }

.goods-card .goods-title {
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.goods-grid.is-grid .goods-card .goods-title { -webkit-line-clamp: 1; }

.goods-meta {
    color: var(--text-muted);
    font-size: 0.76rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.goods-subtitle {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.goods-bottom {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 4px;
}
.goods-card .goods-price {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.95rem;
}
.goods-detail-btn {
    border: 1px solid var(--primary-color);
    background: #fff;
    color: var(--primary-color);
    border-radius: 6px;
    font-size: 0.76rem;
    padding: 2px 10px;
    cursor: pointer;
    flex-shrink: 0;
}
.goods-detail-btn:hover { background: var(--primary-color); color: #fff; }

.goods-check {
    position: absolute;
    top: 6px;
    right: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    z-index: 1;
}
.goods-card.selected .goods-check { display: flex; }

/* ===== 结果页 ===== */
.result-icon {
    font-size: 64px;
    color: #27ae60;
    margin-bottom: 16px;
}

.result-card {
    text-align: center;
    padding: 40px 20px;
}

.order-no {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    background: #fdf2f0;
    padding: 8px 16px;
    border-radius: 8px;
    display: inline-block;
    letter-spacing: 1px;
}

.verify-code {
    font-size: 1.5rem;
    font-weight: 700;
    color: #198754;
    background: #d1e7dd;
    padding: 10px 24px;
    border-radius: 8px;
    display: inline-block;
    letter-spacing: 3px;
    border: 2px dashed #198754;
}

.pickup-time-info {
    display: inline-block;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px 20px;
    color: #664d03;
    font-size: 0.95rem;
    text-align: left;
}

.pickup-time-info i {
    color: #ffc107;
    margin-right: 6px;
}

.pickup-time-info strong {
    color: #664d03;
}

/* 门店自提提示 */
.store-pickup-notice .alert {
    border-radius: 8px;
    font-size: 0.9rem;
}

/* ===== 核销码二维码 ===== */
.qrcode-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qrcode-wrapper {
    display: inline-block;
    padding: 12px;
    background: #fff;
    border: 2px solid #198754;
    border-radius: 12px;
    line-height: 0;
}

.qrcode-wrapper img,
.qrcode-wrapper canvas {
    width: 180px !important;
    height: 180px !important;
    max-width: 180px !important;
    max-height: 180px !important;
}

.qrcode-container .text-muted.small {
    font-size: 0.8rem;
}

.qrcode-container .text-muted.small i {
    color: #198754;
}

.store-pickup-notice .alert i {
    color: #0d6efd;
    margin-right: 4px;
}

/* 已确认门店信息 */
.confirmed-store-info .alert {
    border-radius: 8px;
}

.confirmed-store-info .alert i.bi-shop {
    color: #198754;
    margin-right: 6px;
}

.confirmed-store-info .alert .small {
    color: #6c757d;
    margin-top: 4px;
}

.confirmed-store-info .btn-outline-secondary {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
}

/* ===== 门店详细信息卡片 ===== */
.store-detail-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 16px;
    text-align: left;
}

.store-detail-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #dee2e6;
}

.store-detail-header i {
    color: #198754;
    font-size: 1.2rem;
}

.store-detail-header strong {
    font-size: 1.05rem;
    color: #333;
}

.store-detail-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.9rem;
    color: #555;
}

.store-detail-item i {
    color: #6c757d;
    margin-top: 2px;
    flex-shrink: 0;
}

.store-detail-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.store-detail-item a:hover {
    text-decoration: underline;
}

/* ===== 物流时间轴 ===== */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
}

.timeline-item:first-child::before {
    background: var(--primary-color);
    width: 12px;
    height: 12px;
    left: -25px;
    top: 3px;
}

.timeline-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.timeline-info {
    font-size: 0.95rem;
    margin-top: 2px;
}

/* ===== 登录页横幅图片 ===== */
.login-banner {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    margin-bottom: 12px;
    object-fit: contain;
}

/* ===== 加载状态 ===== */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.loading-overlay.show {
    display: flex;
}

/* ===== Toast 消息 ===== */
.toast-container {
    position: fixed;
    /* navbar 固定在顶部，toast 需要在 navbar 下方显示 */
    top: 80px;
    right: 20px;
    z-index: 10000;
}

/* ===== 底部 ===== */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== 订单信息页 ===== */
.order-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}
.order-info-row:last-child {
    border-bottom: none;
}
.order-info-row .text-muted {
    flex-shrink: 0;
    margin-right: 12px;
    min-width: 70px;
}
.order-info-row span:last-child {
    text-align: right;
    word-break: break-all;
}

.goods-info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}
.goods-info-item:last-child {
    border-bottom: none;
}
.goods-info-item img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}
.goods-no-img {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 24px;
}
.goods-info-title {
    font-weight: 500;
}

/* ===== 响应式 ===== */
@media (max-width: 576px) {
    .page-container {
        padding: 16px 12px;
    }

    .view-switch button {
        padding: 5px 10px;
    }

    .btn-lg {
        width: 100%;
        padding: 14px;
    }
}

/* ===== 一键拨号悬浮按钮 ===== */
.floating-phone-btn {
    position: fixed;
    right: 20px;
    bottom: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
    z-index: 1050;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}
.floating-phone-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.5);
    color: #fff;
}
.floating-phone-btn:active {
    transform: scale(0.95);
}

/* ===== 弹窗公告 ===== */
#announcementModal .modal-content {
    border-radius: var(--radius);
    border: none;
}
#announcementModal .modal-title {
    color: var(--primary-color);
    font-weight: 700;
}
#announcementModal .announcement-modal-content {
    color: #555;
    line-height: 1.8;
    font-size: 0.95rem;
}

/* ===== 轮播图 ===== */
.slider-container {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
    /* 横向手势交给 JS 处理，纵向仍由页面滚动（iOS 13+/微信 X5/Android Chrome 均支持） */
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}
.slider-track {
    display: flex;
    will-change: transform;
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}
.slider-track.dragging {
    cursor: grabbing;
    transition: none !important;
}
.slider-item {
    flex: 0 0 100%;
    min-width: 100%;
}
.slider-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    pointer-events: none;
    -webkit-user-drag: none;
}
.slider-item a {
    display: block;
    -webkit-user-drag: none;
}
.slider-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}
.slider-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    transition: background 0.3s, transform 0.3s;
    cursor: pointer;
    /* 指示点渲染为 button：先重置默认外观，再用上面的属性保持原有圆点观感 */
    border: 0;
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
    position: relative;
}
/* 命中区撑到 30x30，手指和鼠标都能点准，圆点本身不变大 */
.slider-dot::before {
    content: "";
    position: absolute;
    top: -11px;
    right: -11px;
    bottom: -11px;
    left: -11px;
}
.slider-dot.active {
    background: #fff;
    transform: scale(1.3);
}
.slider-dot:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* 左右切换箭头：桌面悬停或键盘聚焦时出现，移动端常显 */
.slider-arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-top: -17px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.32);
    color: #fff;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
}
.slider-arrow-prev { left: 8px; }
.slider-arrow-next { right: 8px; }
.slider-container:hover .slider-arrow,
.slider-container:focus-within .slider-arrow,
.slider-arrow:focus-visible {
    opacity: 1;
}
.slider-arrow:hover {
    background: rgba(0, 0, 0, 0.5);
}
.slider-arrow:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
/* 没有悬停能力的设备（触屏平板等）始终显示箭头：
   这类屏幕宽度常超过 576px，只靠 hover 显形会让用户只剩下拖拽一条路 */
@media (hover: none) {
    .slider-arrow {
        opacity: 1;
    }
}
/* 只有一张图时不需要箭头和指示点 */
.slider-container.is-single .slider-arrow,
.slider-container.is-single .slider-dots {
    display: none;
}

@media (max-width: 576px) {
    .slider-item img {
        height: 150px;
    }
    .slider-arrow {
        width: 40px;
        height: 40px;
        margin-top: -20px;
        opacity: 1;
    }
    .slider-arrow-prev { left: 6px; }
    .slider-arrow-next { right: 6px; }
}

/* ===== 订单进度追踪器 ===== */
.progress-steps {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 10px 0;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.progress-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    z-index: 1;
    transition: all 0.3s;
}

.progress-circle.completed {
    background: #27ae60;
    color: #fff;
}

.progress-circle.active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.2);
}

.progress-circle.failed {
    background: #dc3545;
    color: #fff;
}

.progress-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
    line-height: 1.2;
}

.progress-circle.completed + .progress-label,
.progress-circle.active + .progress-label {
    color: var(--text-dark);
    font-weight: 600;
}

.progress-line {
    position: absolute;
    top: 20px;
    left: 50%;
    width: 100%;
    height: 3px;
    background: #e9ecef;
    z-index: 0;
}

.progress-line.completed {
    background: #27ae60;
}

.progress-line.failed {
    background: #dc3545;
}

.progress-step:last-child .progress-line {
    display: none;
}
