/* Shopee 蝦皮購物車樣式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 頂部導航 */
.shopee-header {
    background: linear-gradient(to right, #ee4d2d, #ff7337);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    filter: brightness(0) invert(1);
    height: 35px;
    width: auto;
}

.logo img[src=""],
.logo img:not([src]),
.logo img[src="undefined"] {
    display: none;
}

.logo::after {
    content: 'Shopee';
    color: white;
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 1px;
    display: none;
}

.logo img.onerror {
    display: none;
}

.logo img:only-child:not([src]) + .logo::after {
    display: block;
}

.header-nav {
    display: flex;
    gap: 30px;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
    padding: 8px 12px;
    border-radius: 4px;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.2);
}

.nav-link.active {
    background-color: rgba(255,255,255,0.3);
}

/* 麵包屑 */
.breadcrumb {
    padding: 20px 0;
    font-size: 14px;
    color: #666;
}

.breadcrumb a {
    color: #ee4d2d;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .current {
    color: #999;
}

/* 主要內容區 */
.main-content {
    padding-bottom: 40px;
}

.cart-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    margin-bottom: 20px;
}

/* 卡片樣式 */
.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #222;
    border-bottom: 2px solid #ee4d2d;
    padding-bottom: 10px;
}

/* 訂單明細列表（一行一行展示） */
.order-items-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.order-item-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
    align-items: center;
}

.order-item-index {
    font-size: 24px;
    font-weight: 600;
    color: #ee4d2d;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff5f2;
    border-radius: 50%;
}

.order-item-content {
    display: flex;
    gap: 20px;
    align-items: center;
}

.order-item-image {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f5f5;
}

.order-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.order-item-details {
    flex: 1;
}

.order-item-name {
    font-size: 16px;
    font-weight: 500;
    color: #222;
    margin-bottom: 8px;
}

.order-item-order-number {
    font-size: 14px;
    color: #ee4d2d;
    font-weight: 600;
    margin-bottom: 8px;
}

.order-item-specs {
    font-size: 13px;
    color: #888;
    margin-bottom: 10px;
}

.order-item-price-row {
    display: flex;
    gap: 30px;
    font-size: 14px;
}

.order-item-price-label {
    color: #666;
}

.order-item-price-value {
    color: #ee4d2d;
    font-weight: 600;
}

.order-item-subtotal {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.order-item-subtotal-label {
    font-size: 13px;
    color: #666;
}

.order-item-subtotal-value {
    font-size: 20px;
    font-weight: 600;
    color: #ee4d2d;
}

/* 購物車商品列表 */
.section-header {
    margin-bottom: 15px;
}

.section-header h2 {
    font-size: 20px;
    color: #222;
}

.cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cart-item {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    gap: 20px;
    transition: box-shadow 0.3s;
}

.cart-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.item-checkbox {
    display: flex;
    align-items: center;
}

.item-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #ee4d2d;
}

.item-image {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f5f5;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.item-name {
    font-size: 16px;
    font-weight: 500;
    color: #222;
    margin-bottom: 8px;
    line-height: 1.4;
}

.item-specs {
    font-size: 13px;
    color: #888;
    margin-bottom: 10px;
}

.item-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.item-price {
    font-size: 18px;
    font-weight: 600;
    color: #ee4d2d;
}

.item-original-price {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
    margin-left: 8px;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.quantity-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 18px;
    color: #666;
    transition: all 0.2s;
}

.quantity-btn:hover:not(:disabled) {
    background: #ee4d2d;
    color: white;
}

.quantity-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.quantity-input {
    width: 50px;
    height: 32px;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    text-align: center;
    font-size: 14px;
}

.quantity-input:focus {
    outline: none;
}

.item-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-delete {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-delete:hover {
    border-color: #ee4d2d;
    color: #ee4d2d;
}

.btn-save-later {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-save-later:hover {
    border-color: #ee4d2d;
    color: #ee4d2d;
}

/* 空購物車 */
.empty-cart {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
}

.empty-cart img {
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-cart p {
    font-size: 18px;
    color: #999;
    margin-bottom: 20px;
}

.btn-shop-now {
    display: inline-block;
    padding: 12px 40px;
    background: #ee4d2d;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background 0.3s;
}

.btn-shop-now:hover {
    background: #d73211;
}

/* 訂單摘要 */
.order-summary {
    position: sticky;
    top: 80px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 14px;
    color: #666;
}

.discount-row {
    color: #ee4d2d;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    padding: 15px 0;
    border-top: 2px solid #f0f0f0;
    margin-top: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #222;
}

.total-price {
    color: #ee4d2d;
    font-size: 24px;
}

.btn-checkout {
    width: 100%;
    padding: 15px;
    background: #ee4d2d;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 15px;
}

.btn-checkout:hover:not(:disabled) {
    background: #d73211;
}

.btn-checkout:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 配送和付款方式 */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-item:hover {
    border-color: #ee4d2d;
}

.radio-item input[type="radio"] {
    margin-top: 3px;
    accent-color: #ee4d2d;
}

.radio-item input[type="radio"]:checked + .radio-label {
    color: #ee4d2d;
}

.radio-label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.delivery-time {
    font-size: 12px;
    color: #999;
}

/* 表單樣式 */
.checkout-form {
    margin-top: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 14px;
    color: #666;
    margin-bottom: 6px;
    font-weight: 500;
}

.required {
    color: #ee4d2d;
}

.form-group input,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #ee4d2d;
}

.form-group input:invalid {
    border-color: #ff4444;
}

.char-count {
    text-align: right;
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

.same-as-buyer {
    margin-bottom: 15px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #ee4d2d;
    cursor: pointer;
}

/* 條款同意 */
.terms-agreement {
    margin-top: 20px;
}

.link {
    color: #ee4d2d;
    text-decoration: none;
}

.link:hover {
    text-decoration: underline;
}

/* 訂單提醒區域（7-11 風格） */
.new_store {
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.noBreak {
    page-break-inside: avoid;
}

.accordion {
    border: none;
}

.collapse-icon .card-header:after {
    content: '\25BC';
    float: right;
    font-size: 12px;
    transition: transform 0.3s;
}

.collapse-icon .card-header.collapsed:after {
    transform: rotate(-90deg);
}

.accordion-icon-rotate .card-header.collapsed:after {
    transform: rotate(-90deg);
}

.card.collapse-header {
    border: none;
    border-radius: 8px;
    overflow: hidden;
}

.card-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: background 0.3s;
}

.card-header:hover {
    background: #e9ecef;
}

.card-header.collapsed {
    background: #f8f9fa;
}

.collapse-title {
    font-size: 16px;
    font-weight: 600;
    color: #222;
    display: flex;
    align-items: center;
}

.align-middle {
    vertical-align: middle;
}

.collapse.show {
    display: block;
}

.collapse {
    display: none;
}

.card-content {
    padding: 0;
}

.card-body {
    padding: 20px;
}

.order__manager__info {
    list-style: decimal;
    padding-left: 20px;
    margin: 0;
}

.order__manager__info > li {
    margin-bottom: 20px;
    line-height: 1.8;
    color: #333;
    font-size: 14px;
}

.order__manager__info > li > ol {
    list-style: disc;
    padding-left: 20px;
    margin-top: 10px;
}

.order__manager__info > li > ol > li {
    margin-bottom: 8px;
    line-height: 1.6;
    color: #555;
    font-size: 13px;
}

.order__manager__info a {
    color: #ee4d2d;
    text-decoration: none;
}

.order__manager__info a:hover {
    text-decoration: underline;
}

/* 重要提醒 */
.important-notes {
    margin-top: 20px;
}

.important-notes h4 {
    font-size: 16px;
    color: #ff6b00;
    margin-bottom: 10px;
}

.important-notes ul {
    list-style: none;
    padding: 0;
}

.important-notes li {
    padding: 6px 0;
    font-size: 14px;
    color: #666;
    padding-left: 20px;
    position: relative;
}

.important-notes li:before {
    content: "•";
    color: #ee4d2d;
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* 底部 */
.shopee-footer {
    background: #222;
    color: #999;
    padding: 30px 0;
    margin-top: 40px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: #999;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: white;
}

/* 彈窗樣式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    color: #222;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #222;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-cancel,
.btn-confirm-order,
.btn-ok {
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-cancel {
    background: white;
    border: 1px solid #ddd;
    color: #666;
}

.btn-cancel:hover {
    background: #f5f5f5;
}

.btn-confirm-order {
    background: #ee4d2d;
    border: none;
    color: white;
    font-weight: 600;
}

.btn-confirm-order:hover {
    background: #d73211;
}

.success-modal {
    text-align: center;
    padding: 40px;
}

.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #4caf50;
    color: white;
    font-size: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.success-modal h3 {
    font-size: 24px;
    color: #222;
    margin-bottom: 15px;
}

.success-modal p {
    font-size: 16px;
    color: #666;
    margin-bottom: 10px;
}

#orderNumber {
    color: #ee4d2d;
    font-weight: 600;
}

.btn-ok {
    background: #ee4d2d;
    border: none;
    color: white;
    font-weight: 600;
    margin-top: 20px;
}

.btn-ok:hover {
    background: #d73211;
}

/* 響應式設計 */
@media (max-width: 992px) {
    .cart-layout {
        grid-template-columns: 1fr;
    }

    .order-summary {
        position: static;
    }

    .order-item-card {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .order-item-index {
        position: absolute;
        top: 10px;
        left: 10px;
        width: 30px;
        height: 30px;
        font-size: 18px;
    }

    .order-item-card {
        position: relative;
        padding-top: 50px;
    }

    .order-item-subtotal {
        text-align: left;
        border-top: 1px solid #f0f0f0;
        padding-top: 15px;
    }
}

@media (max-width: 768px) {
    .header-nav {
        gap: 15px;
    }

    .nav-link {
        font-size: 14px;
        padding: 6px 8px;
    }

    .cart-item {
        flex-direction: column;
    }

    .item-image {
        width: 100%;
        height: 200px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .footer-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    .card {
        padding: 15px;
    }

    .item-price {
        font-size: 16px;
    }

    .total-price {
        font-size: 20px;
    }
}
