/**
 * 订单查询 & 购物车 - 完整 redesign
 */

/* 导航 active 底部颜色条 - 与页面主题色一致 */
.header-v2__nav-link.active {
    color: var(--header-accent);
    font-weight: 600;
    background: var(--header-accent-soft);
}

/* ========== 公共：页面容器 66.67% 宽度 ========== */
#main-container .search-page,
#main-container .cart-page {
    width: 66.66666667%;
    max-width: 66.66666667%;
    margin: 0 auto;
    padding: 2rem 0rem 4rem;
}
@media (max-width: 991.98px) {
    #main-container .search-page,
    #main-container .cart-page {
        width: 100%;
        max-width: 100%;
        padding: 1rem 0.75rem 2rem;
    }
}

/* ===================== 订单查询页 ===================== */

.search-hero {
    background: #000000;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.35);
}

.search-hero__inner {
    max-width: 100%;
}

.search-hero__title {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}

.search-hero__hint {
    margin: 0 0 1.5rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
}

.search-hero__input-wrap {
    display: flex;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.search-hero__input-wrap .form-control {
    border: none;
    padding: 1rem 1.25rem;
    font-size: 1rem;
}

.search-hero__input-wrap .form-control:focus {
    box-shadow: none;
    outline: none;
}

.search-hero__input-wrap .search-order-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: #f59e0b;
    border: none;
    color: #fff;
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.2s;
}

.search-hero__input-wrap .search-order-btn:hover {
    opacity: 0.95;
}

.search-order-btn__text {
    display: inline;
}

/* 结果区 */
.search-results {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

.search-alert {
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

/* 订单摘要卡片 */
.order-summary-card {
    background: #f8fafc;
    border-radius: 12px;
    margin-bottom: 1.75rem;
    overflow: hidden;
}

.order-summary-card__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #00387c91;
    color: #fff;
}

.order-summary-card__label {
    font-size: 0.8125rem;
    opacity: 0.9;
}

.order-summary-card__value {
    font-weight: 600;
    font-family: ui-monospace, monospace;
    font-size: 0.9375rem;
}

.order-summary-card__value--no {
    letter-spacing: 0.05em;
}

.order-summary-card__body {
    padding: 1.25rem 1.25rem;
}

.order-info-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
}

.order-info-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: #fff;
    border-radius: 8px;
    font-size: 0.875rem;
    border: 1px solid #e5e7eb;
}

.order-info-tag__label {
    color: #64748b;
}

.order-info-tag__value {
    font-weight: 500;
    color: #334155;
}

.order-pay-type img {
    width: 18px;
    height: 18px;
    border-radius: 4px;
}

/* 订单商品列表 */
.order-items-section__title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
}

.order-items-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.order-item-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.order-item-card:hover {
    border-color: #c7d2fe;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
}

.order-item-card__main {
    flex: 1 1 200px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.order-item-card__thumb {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e5e7eb;
}

.order-item-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.order-item-card__info {
    flex: 1;
    min-width: 0;
}

.order-item-card__name {
    font-weight: 600;
    color: #334155;
    font-size: 0.9375rem;
}

.order-item-card__name--link {
    text-decoration: none;
    color: inherit;
}
.order-item-card__name--link:hover {
    color: #4f46e5;
}

.order-item-card__sku {
    font-size: 0.8125rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.order-item-card__meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.order-item-card__amount {
    font-weight: 600;
    color: #4f46e5;
}

.order-item-card__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.order-item-card__btn {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.order-item-card__btn--primary {
    background: #4f46e5;
    color: #fff;
}

.order-item-card__btn--primary:hover {
    background: #4338ca;
}

.order-item-card__btn--secondary {
    background: #f1f5f9;
    color: #475569;
}

.order-item-card__btn--secondary:hover {
    background: #e2e8f0;
}

.order-item-card__btn--outline {
    background: #fff;
    color: #4f46e5;
    border: 1px solid #4f46e5;
}

.order-item-card__btn--outline:hover {
    background: #eef2ff;
}

.order-item-card__meta-mobile .order-item-card__amount {
    font-weight: 600;
    margin-right: 0.5rem;
}

.order-item-card__empty {
    color: #94a3b8;
}

/* 空状态 */
.search-empty {
    text-align: center;
    padding: 3rem 2rem;
}

.search-empty__icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: 50%;
    color: #94a3b8;
}

.search-empty__title {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: #334155;
}

.search-empty__hint {
    margin: 0;
    font-size: 0.875rem;
    color: #64748b;
}

/* ===================== 购物车页 ===================== */

.cart-section {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

.cart-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.cart-header__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #334155;
}

.cart-header__select-all {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #64748b;
    user-select: none;
}

.cart-header__select-all input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4f46e5;
}

.cart-item-card__check {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.25rem 0;
}

.cart-item-card__check input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4f46e5;
    margin: 0;
}

/* 购物车商品卡片 */
.cart-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
@media (max-width: 767.98px) {
    .cart-items {
        gap: 12px;
    }
}

.cart-item-card {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.25rem;
    padding: 1.25rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.cart-item-card:hover {
    border-color: #c7d2fe;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.06);
}

.cart-item-card__del {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    border: none;
    background: transparent;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
    z-index: 2;
    padding: 0;
}

.cart-item-card__del:hover {
    color: #ef4444;
    background: #fee2e2;
}

.cart-item-card__thumb {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e5e7eb;
}

.cart-item-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-card__info {
    flex: 1;
    min-width: 120px;
}

.cart-item-card__name {
    font-weight: 600;
    color: #334155;
    font-size: 0.9375rem;
    word-break: break-word;
}

.cart-item-card__name--link {
    text-decoration: none;
    color: inherit;
}
.cart-item-card__name--link:hover {
    color: #4f46e5;
}

.cart-item-card__sku {
    font-size: 0.8125rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.cart-item-card__widgets {
    margin-top: 0.5rem;
    padding: 0.5rem 0;
    position: relative;
}

.cart-widget {
    display: block;
    font-size: 0.8125rem;
    color: #64748b;
}

.cart-widget--empty {
    color: #94a3b8;
}

.cart-widget-edit {
    position: absolute;
    top: -4px;
    right: 0;
    padding: 2px 8px;
    background: #4f46e5;
    color: #fff;
    font-size: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    visibility: hidden;
    transition: background 0.2s;
}

.cart-item-card__widgets:hover .cart-widget-edit {
    visibility: visible;
}

.cart-item-card__widgets:hover .cart-widget-edit:hover {
    background: #4338ca;
}

.cart-item-card__price {
    text-align: center;
}

.cart-item-card__price-label {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
}

.cart-item-card__price [class^="cart-price-"],
.cart-item-card__price [class*=" cart-price-"] {
    font-weight: 600;
    color: #4f46e5;
}

.cart-item-card__right {
    display: contents;
}

.cart-item-card__qty {
    flex-shrink: 0;
}

.quantity-change {
    display: flex;
    align-items: stretch;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.quantity-change button {
    width: 36px;
    background: #f8fafc;
    border: none;
    cursor: pointer;
    color: #64748b;
    font-size: 1.125rem;
    line-height: 1;
    transition: background 0.2s, color 0.2s;
}

.quantity-change button:hover {
    background: #e2e8f0;
    color: #334155;
}

.quantity-change input {
    width: 44px;
    text-align: center;
    border: none;
    border-left: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    font-weight: 600;
    font-size: 0.9375rem;
}

.quantity-change input:focus {
    outline: none;
}

.cart-item-card__total {
    text-align: right;
    min-width: 90px;
}

.cart-item-card__total-label {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
}

.cart-item-card__total [class^="cart-amount-"],
.cart-item-card__total [class*=" cart-amount-"] {
    font-weight: 700;
    font-size: 1.0625rem;
    color: #4f46e5;
}

/* 购物车汇总栏 */
.cart-summary {
    margin-top: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.cart-summary__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.cart-summary__btns {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-cart-clear {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: #fff;
    color: #64748b;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cart-clear:hover {
    color: #dc2626;
    border-color: #fecaca;
    background: #fef2f2;
}

.cart-summary__total {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.cart-summary__label {
    font-size: 0.9375rem;
    color: #64748b;
}

.cart-total-amount {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: #4f46e5 !important;
}

.btn-cart-bill {
    display: inline-flex;
    align-items: center;
    padding: 0.875rem 1.75rem;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
    transition: all 0.2s;
}

.btn-cart-bill:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}

/* 购物车空状态 */
.cart-empty {
    text-align: center;
    padding: 3rem 2rem;
}

.cart-empty__icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: 50%;
    color: #94a3b8;
}

.cart-empty__title {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #334155;
}

.cart-empty__hint {
    margin: 0 0 1.5rem;
    font-size: 0.9375rem;
    color: #64748b;
}

.cart-empty__btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #000000;
    color: #fff;
    border-radius: 10px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.cart-empty__btn:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

/* ========== H5 移动端自适应 ========== */
@media (max-width: 991.98px) {
    #main-container .search-page,
    #main-container .cart-page {
        width: 100%;
        max-width: 100%;
        padding: 1rem 0.75rem 2rem;
        box-sizing: border-box;
    }
    .search-results,
    .cart-section {
        padding: 1rem 1rem;
        border-radius: 12px;
    }
}

/* 购物车页防止横向溢出 */
.cart-page {
    overflow-x: hidden;
    box-sizing: border-box;
}

/* 小屏手机 (≤576px) 购物车额外适配 */
@media (max-width: 576px) {
    #main-container .cart-page {
        padding: 0.75rem 12px 2rem;
        padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0));
    }
    .cart-section {
        padding: 12px;
        border-radius: 12px;
    }
    .cart-header {
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }
    .cart-header__title {
        font-size: 1.0625rem;
    }
}

@media (max-width: 767.98px) {
    #main-container .search-page,
    #main-container .cart-page {
        padding: 0.75rem 0.5rem 1.5rem;
    }

    /* 订单查询 - 搜索区 */
    .search-hero {
        padding: 1.5rem 1rem;
        margin-bottom: 1.25rem;
        border-radius: 12px;
    }
    .search-hero__title {
        font-size: 1.125rem;
    }
    .search-hero__hint {
        font-size: 0.8125rem;
        margin-bottom: 1rem;
    }
    .search-hero__input-wrap .form-control {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
    }
    .search-hero__input-wrap .search-order-btn {
        padding: 0.75rem 1rem;
        min-width: 48px;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    /* 订单查询 - 结果区 */
    .search-results {
        padding: 1rem;
    }
    .order-summary-card__header {
        padding: 0.875rem 1rem;
        flex-wrap: wrap;
    }
    .order-summary-card__value--no {
        font-size: 0.8125rem;
        word-break: break-all;
    }
    .order-summary-card__body {
        padding: 1rem;
    }
    .order-info-tags {
        flex-direction: column;
        gap: 0.75rem;
    }
    .order-info-tag {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }

    /* 订单商品卡片 */
    .order-items-section__title {
        font-size: 0.9375rem;
    }
    .order-item-card {
        padding: 1rem;
        flex-direction: column;
        align-items: stretch;
    }
    .order-item-card__main {
        flex-basis: auto;
    }
    .order-item-card__thumb {
        width: 48px;
        height: 48px;
    }
    .order-item-card__meta.d-none.d-lg-flex {
        display: none !important;
    }
    .order-item-card__actions {
        width: 100%;
        justify-content: flex-start;
        padding-top: 0.5rem;
        border-top: 1px solid #e5e7eb;
    }
    .order-item-card__btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    /* 购物车 - 商品卡片 手机端：数量在小计上方，标题更宽 */
    .cart-section {
        padding: 1rem;
    }
    .cart-header__title {
        font-size: 1.125rem;
    }
    .cart-item-card {
        padding: 12px 48px 12px 12px;
        gap: 12px;
        display: grid;
        grid-template-columns: auto 72px 1fr auto;
        grid-template-rows: auto auto;
        align-items: start;
    }
    .cart-item-card__check {
        grid-row: 1 / -1;
        align-self: center;
    }
    .cart-item-card__thumb {
        grid-row: 1 / -1;
        align-self: start;
    }
    .cart-item-card__info {
        grid-column: 3;
        grid-row: 1 / -1;
        min-width: 0;
    }
    .cart-item-card__right {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
        grid-column: 4;
        grid-row: 1 / -1;
    }
    .cart-item-card__del {
        top: 8px;
        right: 8px;
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        font-size: 1rem;
        padding: 0;
        -webkit-tap-highlight-color: transparent;
    }
    .cart-item-card__thumb {
        width: 72px;
        height: 72px;
        min-width: 72px;
        min-height: 72px;
        border-radius: 10px;
    }
    .cart-item-card__name {
        font-size: 0.9rem;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .cart-item-card__sku {
        font-size: 0.75rem;
        margin-top: 2px;
    }
    /* 手机端：修改按钮始终可见 */
    .cart-widget-edit {
        position: static;
        display: inline-block;
        margin-top: 6px;
        visibility: visible;
        padding: 4px 10px;
        min-height: 28px;
    }
    .cart-item-card__price.d-none.d-md-block {
        display: none !important;
    }
    .cart-item-card__qty {
        margin: 0;
        padding: 0;
        border: none;
    }
    .cart-item-card__total {
        text-align: right;
        min-width: 0;
        margin: 0;
        padding: 0;
        border: none;
    }
    .cart-item-card__total-label.d-md-none {
        display: block !important;
        font-size: 0.7rem;
        margin-bottom: 2px;
    }
    .cart-item-card__total [class^="cart-amount-"],
    .cart-item-card__total [class*=" cart-amount-"] {
        font-size: 1rem;
    }
    .quantity-change {
        min-width: 96px;
    }
    .quantity-change button {
        width: 32px;
        min-width: 32px;
        min-height: 36px;
        font-size: 1rem;
        -webkit-tap-highlight-color: transparent;
    }
    .quantity-change input {
        width: 40px;
        font-size: 0.875rem;
    }

    /* 购物车 - 汇总栏：合计在上，清空+结账同一行 */
    .cart-summary {
        padding: 1rem;
        margin-top: 1.25rem;
        border-radius: 12px;
    }
    .cart-summary__inner {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .cart-summary__total {
        justify-content: center;
        padding: 4px 0;
    }
    .cart-summary__btns {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 12px;
    }
    .cart-total-amount {
        font-size: 1.375rem !important;
    }
    .btn-cart-clear,
    .btn-cart-bill {
        min-height: 48px;
        justify-content: center;
        padding: 0.875rem 1rem;
        font-size: 0.9375rem;
        border-radius: 10px;
        -webkit-tap-highlight-color: transparent;
    }
    .btn-cart-bill {
        font-weight: 600;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    /* 空状态 */
    .search-empty,
    .cart-empty {
        padding: 2rem 1rem;
    }
    .search-empty__icon,
    .cart-empty__icon {
        width: 64px;
        height: 64px;
        margin-bottom: 0.75rem;
    }
    .search-empty__icon i,
    .cart-empty__icon i {
        font-size: 2rem !important;
    }
    .cart-empty__btn {
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.875rem 1.5rem;
        -webkit-tap-highlight-color: transparent;
    }
}

/* 超小屏 (≤375px) 购物车适配 */
@media (max-width: 375px) {
    #main-container .cart-page {
        padding: 0.5rem 10px 1.5rem;
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0));
    }
    .cart-section {
        padding: 10px;
    }
    .cart-item-card {
        padding: 10px 44px 10px 10px;
        gap: 10px;
        grid-template-columns: auto 64px 1fr auto;
    }
    .cart-item-card__thumb {
        width: 64px;
        height: 64px;
        min-width: 64px;
        min-height: 64px;
    }
    .cart-item-card__name {
        font-size: 0.8125rem;
    }
    .quantity-change {
        min-width: 88px;
    }
    .quantity-change button {
        width: 28px;
        min-width: 28px;
        min-height: 34px;
    }
    .quantity-change input {
        width: 36px;
        font-size: 0.8125rem;
    }
    .cart-item-card__total [class^="cart-amount-"],
    .cart-item-card__total [class*=" cart-amount-"] {
        font-size: 0.9375rem;
    }
    .cart-summary__inner {
        gap: 10px;
    }
    .cart-total-amount {
        font-size: 1.25rem !important;
    }
    .btn-cart-clear,
    .btn-cart-bill {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }
}
