/* ============================================================
   前台 SPA 样式 — Vue 3 + Arco Design Vue
   ============================================================ */

/* ---------- CSS 变量 ---------- */
:root {
    --shop-primary: #165dff;
    --shop-success: #00b42a;
    --shop-warning: #ff7d00;
    --shop-danger:  #f53f3f;
    --shop-bg:      #f7f8fa;
    --shop-card:    #ffffff;
    --shop-text:    #1d2129;
    --shop-text2:   #4e5969;
    --shop-text3:   #86909c;
    --shop-line:    #e5e6eb;
    --shop-radius:  8px;
    --shop-max-w:   1200px;
}

/* ---------- 全局重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    color: var(--shop-text);
    background: var(--shop-bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--shop-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; vertical-align: middle; }

/* ---------- 布局 ---------- */
.shop-layout { min-height: 100vh; display: flex; flex-direction: column; }
.shop-header {
    background: var(--shop-card);
    border-bottom: 1px solid var(--shop-line);
    position: sticky; top: 0; z-index: 100;
}
.shop-header-inner {
    max-width: var(--shop-max-w); margin: 0 auto;
    padding: 0 20px; height: 56px;
    display: flex; align-items: center; gap: 16px;
}
.shop-logo {
    display: flex; align-items: center; gap: 8px;
    font-size: 16px; font-weight: 600; color: var(--shop-text);
    text-decoration: none; flex-shrink: 0;
}
.shop-logo img { height: 28px; border-radius: 4px; }
.shop-logo .dot {
    width: 22px; height: 22px; border-radius: 6px;
    background: linear-gradient(135deg, var(--shop-primary), #4080ff);
}
.shop-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.shop-nav a, .shop-nav .nav-item {
    padding: 6px 12px; border-radius: 6px; color: var(--shop-text2);
    font-size: 13px; text-decoration: none; cursor: pointer;
    transition: background .15s, color .15s;
}
.shop-nav a:hover, .shop-nav .nav-item:hover {
    background: #f2f3f5; color: var(--shop-text); text-decoration: none;
}
.shop-nav a.active { color: var(--shop-primary); font-weight: 500; }
.shop-nav .user-entry {
    display: flex; align-items: center; gap: 6px;
}
.shop-nav .user-avatar {
    width: 24px; height: 24px; border-radius: 50%; object-fit: cover;
}
.shop-nav .user-entry { position: relative; cursor: pointer; }
.user-menu {
    position: absolute; right: 0; top: 36px; z-index: 200;
    min-width: 120px; background: #fff; border: 1px solid var(--shop-line);
    border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.08);
    padding: 6px; display: flex; flex-direction: column;
}
.user-menu .user-menu-item {
    padding: 8px 10px; border-radius: 6px; color: var(--shop-text2); text-decoration: none;
}
.user-menu .user-menu-item:hover { background: #f2f3f5; color: var(--shop-text); text-decoration: none; }
.user-menu .user-menu-item.danger { color: var(--shop-danger); }

.shop-main {
    flex: 1;
    max-width: var(--shop-max-w); width: 100%;
    margin: 0 auto; padding: 24px 20px 40px;
}

.shop-footer {
    background: var(--shop-card);
    border-top: 1px solid var(--shop-line);
    padding: 20px; text-align: center;
    color: var(--shop-text3); font-size: 12px; line-height: 1.8;
}

/* ---------- Hero ---------- */
.hero-section {
    text-align: center; padding: 40px 20px 32px;
}
.hero-section h1 { margin: 0 0 8px; font-size: 24px; font-weight: 700; }
.hero-section p { margin: 0; color: var(--shop-text3); font-size: 14px; }

/* ---------- 公告 ---------- */
.notice-bar {
    background: #fffbe6; border: 1px solid #ffe58f; border-radius: var(--shop-radius);
    padding: 10px 16px; margin-bottom: 20px; font-size: 13px; color: #ad6800;
    line-height: 1.6; white-space: pre-line;
}

/* ---------- 商品网格 ---------- */
.prod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.prod-card {
    background: var(--shop-card);
    border: 1px solid var(--shop-line);
    border-radius: 10px;
    overflow: hidden;
    transition: transform .18s, box-shadow .18s;
    cursor: pointer; text-decoration: none; color: inherit;
    display: flex; flex-direction: column;
}
.prod-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,.06);
    text-decoration: none;
}
.prod-card.sold-out { opacity: .55; pointer-events: none; }
.prod-cover {
    width: 100%; aspect-ratio: 16/10; overflow: hidden;
    background: #f2f3f5; display: flex; align-items: center; justify-content: center;
}
.prod-cover img { width: 100%; height: 100%; object-fit: cover; }
.prod-cover-ph { font-size: 40px; color: #c9cdd4; }
.prod-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; }
.prod-body h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.prod-body .desc { color: var(--shop-text3); font-size: 12px; margin-bottom: 10px; flex: 1; }
.prod-price {
    display: flex; align-items: baseline; gap: 8px;
}
.prod-price .amt {
    font-size: 20px; font-weight: 700; color: var(--shop-danger);
}
.prod-price .amt::before { content: '¥'; font-size: 13px; }
.prod-price .stock-tag {
    font-size: 11px; padding: 2px 6px; border-radius: 4px;
    background: #e8ffea; color: var(--shop-success);
}
.prod-price .stock-tag.out { background: #fff1f0; color: var(--shop-danger); }

/* ---------- 商品详情 ---------- */
.detail-wrap { display: grid; grid-template-columns: 1fr 380px; gap: 20px; }
@media (max-width: 768px) { .detail-wrap { grid-template-columns: 1fr; } }
.detail-info {
    background: var(--shop-card); border: 1px solid var(--shop-line);
    border-radius: 10px; padding: 24px;
}
.detail-info .cover { border-radius: 8px; overflow: hidden; margin-bottom: 16px; }
.detail-info .cover img { width: 100%; display: block; }
.detail-info h1 { margin: 0 0 8px; font-size: 20px; }
.detail-info .sub { color: var(--shop-text3); font-size: 13px; margin-bottom: 12px; }
.detail-info .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.detail-info .desc-html { color: var(--shop-text2); font-size: 13px; line-height: 1.8; white-space: pre-line; }

.buybox {
    background: var(--shop-card); border: 1px solid var(--shop-line);
    border-radius: 10px; padding: 24px; align-self: start;
    position: sticky; top: 72px;
}
.buybox .price-line {
    font-size: 28px; font-weight: 700; color: var(--shop-danger);
    margin-bottom: 20px;
}
.buybox .price-line::before { content: '¥'; font-size: 16px; }
.buybox .total-row {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 12px 0; border-top: 1px solid var(--shop-line);
    margin-top: 8px;
}
.buybox .total-row .amt {
    font-size: 22px; font-weight: 700; color: var(--shop-danger);
}
.buybox .total-row .amt::before { content: '¥'; font-size: 14px; }

/* ---------- 订单查询 ---------- */
.order-section {
    background: var(--shop-card); border: 1px solid var(--shop-line);
    border-radius: 10px; padding: 24px; max-width: 640px; margin: 0 auto;
}
.order-actions {
    display: flex; gap: 8px; flex-wrap: wrap;
}

/* ---------- 缓存订单列表 ---------- */
.cache-section {
    margin-top: 20px; padding-top: 20px;
    border-top: 1px solid var(--shop-line);
}
.cache-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 6px;
}
.cache-title { font-weight: 600; font-size: 14px; }
.cache-tip { font-size: 12px; color: var(--shop-text3); margin-bottom: 10px; }
.cache-empty { text-align: center; padding: 20px 0; color: var(--shop-text3); }
.cache-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; border: 1px solid #e8eaed; border-radius: 6px;
    margin-bottom: 6px; cursor: pointer; transition: background .15s;
    gap: 12px;
}
.cache-row:hover { background: #f2f3f5; }
.cache-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; overflow: hidden; }
.cache-no { font-size: 13px; flex-shrink: 0; }
.cache-name { font-size: 13px; color: var(--shop-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cache-ext { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.cache-amt { font-weight: 500; font-size: 13px; }
.cache-time { color: var(--shop-text3); font-size: 12px; }

/* ---------- 订单结果 ---------- */
.order-result {
    max-width: 720px; margin: 0 auto;
}
.order-status-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-radius: 10px; margin-bottom: 16px;
}
.order-status-bar .status-left {
    display: flex; align-items: center; gap: 10px;
}
.order-status-bar .status-icon { font-size: 22px; line-height: 1; }
.order-status-bar .status-label { font-size: 16px; font-weight: 600; }
.order-status-bar.status-0 { background: #e8f3ff; color: #165dff; }
.order-status-bar.status-1 { background: #fff3e0; color: #d46b08; }
.order-status-bar.status-2 { background: #e8ffea; color: #00b42a; }
.order-status-bar.status-3 { background: #fff1f0; color: #f53f3f; }
.order-status-bar.status-4 { background: #f2f3f5; color: #86909c; }

.order-info-grid {
    background: var(--shop-card); border: 1px solid var(--shop-line);
    border-radius: 10px; padding: 4px 0; margin-bottom: 16px;
}
.info-item {
    display: flex; align-items: baseline; padding: 10px 20px;
    border-bottom: 1px solid var(--shop-line);
}
.info-item:last-child { border-bottom: none; }
.info-label {
    width: 80px; flex-shrink: 0; font-size: 13px; color: var(--shop-text3);
}
.info-value {
    flex: 1; font-size: 14px; word-break: break-all;
}

.delivery-section {
    background: var(--shop-card); border: 1px solid var(--shop-line);
    border-radius: 10px; padding: 20px; margin-bottom: 16px;
}
.delivery-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px; flex-wrap: wrap; gap: 8px;
}
.delivery-title { font-weight: 600; font-size: 14px; }

.cards-list {
    display: flex; flex-direction: column; gap: 6px;
}
.card-item {
    display: flex; align-items: center; justify-content: space-between;
    background: #fafbfc; border: 1px solid #e8eaed;
    padding: 10px 12px; border-radius: 6px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 13px; line-height: 1.5;
    cursor: pointer; transition: background .15s;
}
.card-item:hover { background: #eef1f5; }
.card-text { flex: 1; word-break: break-all; }
.card-copy {
    flex-shrink: 0; margin-left: 8px; opacity: 0.35;
    font-size: 14px; cursor: pointer;
    transition: opacity .15s;
}
.card-item:hover .card-copy { opacity: 1; }

.qr-box {
    display: flex; flex-direction: column; align-items: center;
    gap: 10px; padding: 16px 0;
}
.qr-box canvas { border-radius: 8px; }

/* ---------- 登录页 ---------- */
.login-wrap {
    display: flex; justify-content: center; padding: 40px 16px 60px;
}
.login-card {
    width: 100%; max-width: 420px;
    background: var(--shop-card);
    border: 1px solid var(--shop-line);
    border-radius: 14px;
    padding: 36px 32px 28px;
    box-shadow: 0 1px 2px rgba(0,0,0,.02), 0 8px 24px rgba(0,0,0,.04);
}
.login-head { text-align: center; margin-bottom: 28px; }
.login-head h1 { margin: 0 0 6px; font-size: 20px; font-weight: 600; }
.login-head p { margin: 0; font-size: 13px; color: var(--shop-text3); line-height: 1.6; }
.login-methods { display: flex; flex-direction: column; gap: 10px; }
.login-btn {
    display: flex; align-items: center;
    padding: 13px 16px;
    background: var(--shop-card);
    border: 1px solid var(--shop-line);
    border-radius: 10px;
    text-decoration: none; color: var(--shop-text);
    font-size: 14px; font-weight: 500;
    transition: .18s ease; cursor: pointer;
}
.login-btn:hover {
    border-color: #c9cdd4; background: #fafbfc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.04);
    text-decoration: none;
}
.login-btn .icon-box {
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; margin-right: 12px; flex-shrink: 0;
}
.login-btn .arrow { margin-left: auto; color: var(--shop-text3); }
.login-foot {
    margin-top: 28px; padding-top: 20px;
    border-top: 1px solid var(--shop-line);
    text-align: center; font-size: 12px; color: var(--shop-text3); line-height: 1.7;
}

/* ---------- 用户中心 ---------- */
.user-shell { display: grid; grid-template-columns: 220px 1fr; gap: 20px; min-height: 500px; }
@media (max-width: 768px) { .user-shell { grid-template-columns: 1fr; } }
.user-side {
    background: var(--shop-card); border: 1px solid var(--shop-line);
    border-radius: 10px; padding: 20px; align-self: start;
    position: sticky; top: 72px;
}
.user-side .profile { text-align: center; margin-bottom: 16px; }
.user-side .avatar {
    width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
    margin-bottom: 8px;
}
.user-side .avatar-fb {
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, var(--shop-primary), #4080ff);
    color: #fff; font-size: 20px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 8px;
}
.user-side .name { font-weight: 600; font-size: 15px; }
.user-side .social { font-size: 12px; color: var(--shop-text3); }
.user-side .stats {
    display: flex; justify-content: center; gap: 24px;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--shop-line);
}
.user-side .stats div { text-align: center; }
.user-side .stats b { display: block; font-size: 16px; }
.user-side .stats span { font-size: 11px; color: var(--shop-text3); }
.user-side .menu { display: flex; flex-direction: column; gap: 2px; }
.user-side .menu-item {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px; border-radius: 8px;
    color: var(--shop-text2); font-size: 13px;
    cursor: pointer; transition: background .15s;
    text-decoration: none;
}
.user-side .menu-item:hover { background: #f2f3f5; text-decoration: none; }
.user-side .menu-item.active { background: #e8f3ff; color: var(--shop-primary); font-weight: 500; }
.user-side .menu-item.danger { color: var(--shop-danger); }
.user-side .menu-item .badge {
    margin-left: auto; background: #f2f3f5; padding: 1px 8px;
    border-radius: 10px; font-size: 11px; color: var(--shop-text3);
}
.user-side .divider { height: 1px; background: var(--shop-line); margin: 6px 0; }

.user-main {
    background: var(--shop-card); border: 1px solid var(--shop-line);
    border-radius: 10px; padding: 24px;
}
.user-main h2 { margin: 0 0 16px; font-size: 17px; font-weight: 600; }

.quick-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.quick-card {
    display: flex; align-items: center; gap: 12px;
    padding: 16px; border: 1px solid var(--shop-line); border-radius: 10px;
    cursor: pointer; transition: background .15s, border-color .15s;
    text-decoration: none; color: inherit;
}
.quick-card:hover { background: #fafbfc; border-color: #c9cdd4; text-decoration: none; }
.quick-card .ico {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; background: #e8f3ff;
}
.quick-card .ti { font-size: 14px; font-weight: 500; }
.quick-card .sub { font-size: 12px; color: var(--shop-text3); }

/* ---------- 列表项 ---------- */
.list-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border: 1px solid var(--shop-line); border-radius: 8px;
    cursor: pointer; transition: background .15s;
    text-decoration: none; color: inherit;
}
.list-item:hover { background: #fafbfc; text-decoration: none; }
.list-item .main { flex: 1; min-width: 0; }
.list-item .title { font-size: 14px; font-weight: 500; }
.list-item .meta { font-size: 12px; color: var(--shop-text3); margin-top: 2px; }
.list-item .ext { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.list-item .amt { font-weight: 600; font-size: 15px; }

/* ---------- 支付弹窗 ---------- */
.pay-modal-qr {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 16px 0;
}
.pay-modal-qr canvas { border-radius: 8px; }

/* ---------- 工具 ---------- */
.text-danger { color: var(--shop-danger) !important; }
.text-success { color: var(--shop-success) !important; }
.text-mute { color: var(--shop-text3) !important; }
.mono { font-family: ui-monospace, Menlo, Consolas, 'Courier New', monospace; }
.mt-0 { margin-top: 0 !important; }
.mt-12 { margin-top: 12px !important; }
.mt-16 { margin-top: 16px !important; }
.mb-12 { margin-bottom: 12px !important; }
.mb-16 { margin-bottom: 16px !important; }

/* ---------- 响应式：平板 ---------- */
@media (max-width: 768px) {
    .order-section { max-width: 100%; }
    .order-result { max-width: 100%; }
    .user-side { position: static; }
    .buybox { position: static; }
    .cache-row { flex-direction: column; align-items: stretch; gap: 6px; }
    .cache-main { flex-wrap: wrap; }
    .cache-ext { justify-content: space-between; }
    .list-item .ext { gap: 6px; }
    /* 用户中心：侧栏在手机端简化为信息条 + 栅格菜单 */
    .user-side { padding: 12px; }
    .user-side .profile { display:flex; align-items:center; gap:12px; text-align:left; margin-bottom:10px; }
    .user-side .avatar, .user-side .avatar-fb { width:44px; height:44px; }
    .user-side .name { font-size:14px; }
    .user-side .stats { margin-top:0; padding-top:0; border-top:none; gap:16px; }
    .user-side .menu { display:grid; grid-template-columns: 1fr 1fr; gap:8px; }
    .user-side .menu-item { justify-content:center; padding:12px; }
    .user-side .divider { display:none; }
}

/* ---------- 响应式：手机 ---------- */
@media (max-width: 480px) {
    .shop-header-inner { padding: 0 12px; height: 48px; }
    .shop-logo { font-size: 14px; }
    .shop-logo span {
        max-width: 120px; overflow: hidden;
        text-overflow: ellipsis; white-space: nowrap;
    }
    .shop-nav { gap: 2px; }
    .shop-nav a, .shop-nav .nav-item { padding: 6px 8px; font-size: 12px; }
    .shop-nav .user-entry { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .shop-main { padding: 12px 10px 32px; }

    .hero-section { padding: 24px 8px 20px; }
    .hero-section h1 { font-size: 20px; }
    .hero-section p { font-size: 13px; }

    .prod-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
    .prod-body { padding: 10px 12px; }
    .prod-body h3 { font-size: 14px; }
    .prod-price .amt { font-size: 17px; }

    .detail-wrap { gap: 12px; }
    .detail-info { padding: 16px; }
    .detail-info h1 { font-size: 18px; }
    .detail-info .meta { gap: 6px; }
    .buybox { padding: 16px; }
    .buybox .price-line { font-size: 24px; margin-bottom: 14px; }

    .order-section { padding: 16px; }
    .order-status-bar { padding: 12px 14px; }
    .order-status-bar .status-icon { font-size: 18px; }
    .order-status-bar .status-label { font-size: 14px; }
    .info-item { padding: 8px 14px; }
    .info-label { width: 60px; font-size: 12px; }
    .info-value { font-size: 13px; }
    .delivery-section { padding: 14px; }
    .delivery-header { gap: 6px; }
    .card-item { padding: 8px 10px; font-size: 12px; }

    .login-card { padding: 28px 20px 22px; }

    .user-shell { gap: 12px; }
    .user-side { padding: 16px; }
    .user-side .menu-item { padding: 12px; }
    .user-main { padding: 16px; }
    .user-main h2 { font-size: 15px; }
    .quick-cards { grid-template-columns: 1fr; gap: 8px; }
    .quick-card { padding: 12px; }

    .list-item { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px; }
    .list-item .ext { justify-content: space-between; }

    .pay-modal-qr canvas { width: 160px !important; height: 160px !important; }
    /* 弹窗（Arco Modal）在手机端的适配 */
    .arco-modal { width: 92vw !important; max-width: 92vw !important; margin: 0 !important; }
    .arco-modal .arco-modal-content { border-radius: 10px; }
    .arco-modal-header { padding: 12px 14px !important; }
    .arco-modal-title { font-size: 16px !important; }
    .arco-modal-body { padding: 14px !important; }
    .arco-modal-footer { padding: 12px 14px !important; display: flex; gap: 8px; }
    .arco-modal-footer .arco-btn { flex: 1 1 auto; }
    /* 防止 iOS 输入时强制放大，提升可点性 */
    .arco-input, .arco-input-wrapper, .arco-textarea, .arco-select-view, .arco-btn { font-size: 16px !important; }
}
