/* Shopping Cart Page Styles */
#cart {
    background: #f5f5f5;
    min-height: calc(100vh - 114px);
    padding: 40px 0;
}

.cart-container {
    width: 1200px;
    margin: 0 auto;
}

.cart-title {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
}

.cart-title-badge {
    font-size: 0.55em;
    font-weight: 500;
    color: #888;
    letter-spacing: 0.02em;
}

/* Cart Content Layout */
.cart-content {
    display: flex;
    gap: 20px;
}

/* Left: Product List */
.cart-products {
    flex: 1;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    min-height: 400px;
}

.empty-cart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.empty-cart p {
    font-size: 16px;
    color: #999;
    margin-bottom: 20px;
}

.empty-cart--illustrated .empty-cart-icon {
    color: #c4b896;
    margin-bottom: 14px;
}

.empty-cart-title {
    font-size: 17px;
    font-weight: 600;
    color: #333;
    margin: 0 0 10px 0;
    line-height: 1.45;
}

.empty-cart-hint {
    font-size: 13px;
    color: #888;
    line-height: 1.65;
    margin: 0 auto 22px auto;
    max-width: 320px;
}

.continue-shopping-btn {
    padding: 12px 30px;
    background: #C9A86C;
    color: #fff;
    border-radius: 4px;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.3s;
}

.continue-shopping-btn:hover {
    background: #b89958;
    color: #fff;
}

/* 空カート：イラスト付き */
.empty-cart--illustrated .empty-cart-icon {
    margin-bottom: 14px;
    opacity: 0.92;
    color: #c4b8a8;
}

.empty-cart-title {
    font-size: 16px;
    font-weight: 500;
    color: #4a4a4a;
    margin-bottom: 8px !important;
}

.empty-cart-hint {
    font-size: 13px;
    color: #999;
    line-height: 1.6;
    margin: 0 0 20px 0;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

/* Login Prompt */
.login-prompt {
    padding: 60px 20px;
}

.login-prompt-icon {
    margin-bottom: 20px;
}

.login-btn {
    display: inline-block;
    padding: 14px 40px;
    background: linear-gradient(135deg, #333 0%, #222 100%);
    color: #fff;
    border-radius: 24px;
    font-size: 15px;
    text-decoration: none;
    margin-bottom: 15px;
    transition: opacity 0.3s;
}

.login-btn:hover {
    opacity: 0.9;
    color: #fff;
}

.register-link {
    display: block;
    font-size: 13px;
    color: #666;
    text-decoration: none;
}

.register-link:hover {
    color: #C9A86C;
}

/* Cart Item */
.cart-item {
    display: flex;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid #eee;
}

.cart-item:last-child {
    border-bottom: none;
}

.item-image {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    margin-right: 25px;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
    background: #f5f5f5;
}

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

.item-name {
    font-size: 16px;
    font-weight: normal;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.item-name a {
    color: #333;
    text-decoration: none;
}

.item-name a:hover {
    color: #C9A86C;
}

.item-code {
    font-size: 13px;
    color: #999;
    margin: 0 0 8px 0;
}

.item-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 8px 0 12px 0;
    font-size: 13px;
}

.spec-label {
    color: #666;
    font-weight: 500;
}

.spec-value {
    color: #333;
    margin-left: 4px;
}

.item-size {
    font-size: 14px;
    color: #333;
    margin: 0 0 15px 0;
}

.item-options {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quantity-control label {
    font-size: 14px;
    color: #666;
}

.quantity-control select {
    padding: 8px 30px 8px 15px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none;
    cursor: pointer;
    min-width: 80px;
}

.quantity-control select:focus {
    outline: none;
    border-color: #C9A86C;
}

.quantity-display {
    display: inline-block;
    padding: 8px 15px;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.remove-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
}

.remove-btn:hover {
    background: #eee;
    border-color: #ccc;
}

.remove-icon {
    font-size: 14px;
    color: #999;
}

.item-total {
    display: flex;
    align-items: center;
    margin-left: auto;
    text-align: right;
}

.item-total p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.total-price {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

/* Right: Summary Panel */
.cart-summary {
    width: 320px;
    flex-shrink: 0;
}

.summary-content {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    position: sticky;
    top: 100px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.summary-row:last-of-type {
    border-bottom: none;
}

.summary-label {
    font-size: 14px;
    color: #666;
}

.summary-value {
    font-size: 14px;
    color: #333;
    text-align: right;
}

.discount-value {
    color: #C9A86C;
}

.summary-value.points {
    color: #C9A86C;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-top: 10px;
    border-top: 2px solid #eee;
}

.total-label {
    font-size: 16px;
    color: #333;
    font-weight: bold;
}

.total-value {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.points-earned {
    text-align: right;
    font-size: 13px;
    color: #999;
    margin-bottom: 25px;
}

.checkout-btn {
    width: 100%;
    padding: 18px;
    background: #C9A86C;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.4;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.3s, transform 0.15s ease, box-shadow 0.15s ease, color 0.2s;
    margin-bottom: 15px;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.checkout-btn:hover {
    background: #b89958;
    color: #fff;
}

.checkout-btn.disabled,
.checkout-btn.checkout-btn--disabled {
    background: #9e9e9e;
    color: #fff;
    -webkit-text-fill-color: #fff;
    cursor: not-allowed;
    box-shadow: none;
}

.checkout-btn.disabled:hover,
.checkout-btn.checkout-btn--disabled:hover {
    background: #9e9e9e;
    color: #fff;
}

.continue-link {
    display: block;
    text-align: center;
    font-size: 14px;
    color: #C9A86C;
    text-decoration: underline;
}

.continue-link:hover {
    color: #b89958;
}

/* Responsive */
@media (max-width: 1240px) {
    .cart-container {
        width: 95%;
        padding: 0 20px;
    }
}

/* 平板与窄屏：全宽 + 纵向堆叠（未切到 m 模板时的 PC 页） */
@media (max-width: 1023px) {
    .cart-container {
        width: 100%;
        max-width: 100%;
        padding-left: max(12px, env(safe-area-inset-left, 0px));
        padding-right: max(12px, env(safe-area-inset-right, 0px));
        box-sizing: border-box;
    }

    .cart-content {
        flex-direction: column;
    }

    .cart-summary {
        width: 100%;
    }

    .summary-content {
        position: static;
    }
}

@media (max-width: 900px) {
    .cart-content {
        flex-direction: column;
    }

    .cart-summary {
        width: 100%;
    }

    .summary-content {
        position: static;
    }
}

/* 平板 / 手机：与顶栏 mobile 断点一致 */
@media (max-width: 1023px) {
    #cart {
        background: linear-gradient(180deg, #eceae6 0%, #f5f4f2 32%, #f0eeeb 100%);
    }

    .cart-content {
        gap: 14px;
    }

    .cart-products,
    .summary-content {
        box-shadow: 0 2px 14px rgba(0, 0, 0, 0.06);
    }
}

/* 手机端适配 */
@media (max-width: 768px) {
    #cart {
        padding: 12px 0 calc(24px + env(safe-area-inset-bottom, 0px));
        min-height: calc(100vh - 76px);
        box-sizing: border-box;
    }

    .cart-container {
        width: 100%;
        max-width: 100%;
        padding-left: max(8px, env(safe-area-inset-left, 0px));
        padding-right: max(8px, env(safe-area-inset-right, 0px));
        box-sizing: border-box;
    }

    .cart-title {
        font-size: 1.125rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        margin-bottom: 14px;
        padding-left: 12px;
        position: relative;
        color: #2c2c2c;
        font-family: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Noto Serif JP", -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, sans-serif;
    }

    .cart-title-badge {
        font-size: 12px;
        font-weight: 400;
        color: #8a8a8a;
        letter-spacing: 0.06em;
    }

    .cart-title::before {
        content: '';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 3px;
        height: 1.1em;
        border-radius: 2px;
        background: linear-gradient(180deg, #D4C5A9 0%, #C9A86C 100%);
    }

    /* 商品列表 */
    .cart-products {
        border-radius: 12px;
        min-height: auto;
        border: 1px solid rgba(0, 0, 0, 0.06);
    }

    .empty-cart {
        padding: 36px 20px 44px;
        min-height: 0;
    }

    .empty-cart p {
        font-size: 14px;
        color: #6b6b6b;
        line-height: 1.65;
        margin-bottom: 18px;
    }

    .empty-cart--illustrated .empty-cart-title {
        font-size: 16px;
    }

    .empty-cart--illustrated .empty-cart-hint {
        font-size: 12px;
        max-width: 100%;
    }

    .continue-shopping-btn {
        display: inline-block;
        padding: 12px 28px;
        font-size: 14px;
        font-weight: 500;
        border-radius: 999px;
        box-shadow: 0 2px 8px rgba(201, 168, 108, 0.35);
    }

    /* 登录提示 */
    .login-prompt {
        padding: 36px 20px;
    }

    .login-prompt-icon svg {
        width: 44px;
        height: 44px;
        stroke: #b8b8b8;
    }

    .login-btn {
        padding: 13px 36px;
        font-size: 14px;
        border-radius: 999px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    }

    .register-link {
        font-size: 12px;
        color: #888;
    }

    /* 购物车商品项 */
    .cart-item {
        flex-wrap: wrap;
        padding: 16px 14px;
        gap: 12px;
        border-bottom-color: #f0f0f0;
    }

    .item-image {
        width: 88px;
        height: 88px;
        margin-right: 12px;
        border-radius: 8px;
        overflow: hidden;
        background: #fafafa;
    }

    .item-image img {
        border-radius: 8px;
    }

    .item-details {
        flex: 1;
        min-width: calc(100% - 108px);
    }

    .item-name {
        font-size: 14px;
        margin-bottom: 6px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 1.45;
        font-weight: 500;
    }

    .item-code {
        font-size: 11px;
        margin-bottom: 6px;
        color: #9a9a9a;
    }

    .item-specs {
        font-size: 12px;
        gap: 8px;
    }

    .item-options {
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 12px;
    }

    .quantity-control {
        gap: 6px;
    }

    .quantity-control label {
        font-size: 12px;
        color: #666;
    }

    .quantity-control select {
        padding: 6px 25px 6px 10px;
        font-size: 13px;
        min-width: 65px;
        border-radius: 6px;
    }

    .quantity-display {
        padding: 6px 12px;
        background: #f7f7f7;
        border-radius: 6px;
        font-size: 13px;
    }

    .remove-btn {
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 8px;
        background: #fff;
        border-color: #e5e5e5;
    }

    .item-total {
        width: 100%;
        margin-left: 0;
        margin-top: 8px;
        padding-top: 12px;
        border-top: 1px dashed #e8e8e8;
        justify-content: flex-end;
    }

    .item-total p {
        font-size: 13px;
    }

    .total-price {
        font-size: 17px;
        color: #C9A86C;
    }

    /* 结算面板 */
    .cart-summary {
        width: 100%;
        margin-top: 4px;
    }

    .summary-content {
        padding: 18px 16px 20px;
        border-radius: 12px;
        border: 1px solid rgba(0, 0, 0, 0.06);
    }

    .summary-row {
        padding: 11px 0;
    }

    .summary-label {
        font-size: 13px;
        color: #666;
    }

    .summary-value {
        font-size: 13px;
        font-weight: 500;
    }

    .summary-total {
        padding: 16px 0 12px;
        margin-top: 4px;
        border-top-color: #e8e4df;
    }

    .total-label {
        font-size: 15px;
        font-weight: 600;
    }

    .total-value {
        font-size: 1.5rem;
        font-weight: 700;
        color: #2a2a2a;
        letter-spacing: 0.02em;
    }

    .points-earned {
        font-size: 12px;
        color: #888;
        margin-bottom: 16px;
        text-align: left;
    }

    .checkout-btn {
        width: 100%;
        padding: 15px 16px;
        font-size: 15px;
        font-weight: 600;
        border-radius: 12px;
        margin-bottom: 14px;
        box-shadow: 0 4px 14px rgba(201, 168, 108, 0.4);
        letter-spacing: 0.06em;
        color: #fff;
    }

    .checkout-btn:active:not(.checkout-btn--disabled):not(.disabled) {
        transform: scale(0.98);
        box-shadow: 0 2px 8px rgba(201, 168, 108, 0.35);
    }

    .checkout-btn.disabled,
    .checkout-btn.checkout-btn--disabled {
        box-shadow: none;
        opacity: 1;
        color: #fff;
        -webkit-text-fill-color: #fff;
        background: #9e9e9e;
    }

    .continue-link {
        font-size: 13px;
        padding: 4px 0;
    }
}

/* 超小屏幕 */
@media (max-width: 375px) {
    .cart-container {
        padding-left: max(10px, env(safe-area-inset-left, 0px));
        padding-right: max(10px, env(safe-area-inset-right, 0px));
    }

    .cart-title {
        font-size: 1.05rem;
    }

    .cart-item {
        padding: 14px 10px;
    }

    .item-image {
        width: 76px;
        height: 76px;
    }

    .item-details {
        min-width: calc(100% - 92px);
    }

    .item-name {
        font-size: 13px;
    }

    .total-price {
        font-size: 16px;
    }

    .total-value {
        font-size: 1.35rem;
    }
}
