* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft JhengHei", sans-serif;
    color: #333;
    background: linear-gradient(135deg, #f5f8ff 0%, #fff7f1 50%, #f1fff9 100%);
}


.checkout-header {
    background: linear-gradient(120deg, #ffffff 0%, #f7fbff 55%, #fff4f6 100%);
    border-bottom: 1px solid rgba(151, 71, 255, 0.12);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 12px 30px rgba(34, 60, 80, 0.08);
}

.checkout-container {
    max-width: 1200px;
    margin: 0 auto;
    /* 左右留白與內容區（.home-wrap、main.checkout-container）統一為 16px，
       讓 checkout-header 內容與頁面內容左右邊緣對齊 */
    padding: 0 16px;
}

.header-brand {
    font-weight: 700;
    font-size: 20px;
    color: #2a2a2a;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-brand .brand-dot {
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, #ff6b6b, #6c5ce7);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.12);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 18px;
    color: #5b5b5b;
    font-size: 14px;
}

.header-actions a {
    color: inherit;
    text-decoration: none;
}

.search-bar {
    position: relative;
    flex: 1;
    max-width: 360px;
}

.search-bar input {
    width: 100%;
    padding: 8px 36px 8px 12px;
    border: 1px solid rgba(124, 92, 255, 0.18);
    border-radius: 20px;
    background: #fff;
    font-size: 14px;
    box-shadow: 0 6px 16px rgba(124, 92, 255, 0.08);
}

.search-bar i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
}

.checkout-steps {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 0;
    font-size: 14px;
    color: #6f6f6f;
}

.checkout-steps .step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.checkout-steps .step.active {
    color: #2c2c2c;
}

.step-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(108, 92, 231, 0.4);
    font-size: 12px;
    background: #fff;
}

.checkout-steps .step.active .step-circle {
    background: linear-gradient(135deg, #6c5ce7, #00c6ff);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 14px rgba(0, 198, 255, 0.3);
}

.checkout-section {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid rgba(108, 92, 231, 0.12);
    box-shadow: 0 14px 30px rgba(34, 60, 80, 0.08);
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #2c2c2c;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* .section-title::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    box-shadow: 0 0 0 4px rgba(254, 202, 87, 0.2);
} */

.section-subtitle {
    font-size: 14px;
    color: #666;
}

.footer-note {
    font-size: 12px;
    color: #6f6f6f;
    padding: 30px 0 40px;
    text-align: center;
}

.cart-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #e9ecef;
}

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

.cart-thumb {
    width: 90px;
    height: 90px;
    border-radius: 12px;
    object-fit: cover;
    background: linear-gradient(135deg, #f1f3ff, #fff1f6);
    box-shadow: 0 8px 16px rgba(255, 107, 107, 0.15);
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #1f2a44;
}

.cart-item-meta {
    font-size: 13px;
    color: #6f7a92;
    margin-bottom: 10px;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.qty-control {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(108, 92, 231, 0.25);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 6px 16px rgba(108, 92, 231, 0.1);
}

.qty-control button {
    width: 32px;
    height: 32px;
    border: none;
    background: linear-gradient(135deg, #f6f7ff, #fff4f8);
    cursor: pointer;
    color: #6c5ce7;
    font-weight: 700;
}

.qty-control input {
    width: 42px;
    border: none;
    text-align: center;
    font-size: 14px;
}

.cart-item-price {
    min-width: 120px;
    text-align: right;
    font-weight: 700;
    color: #2c2c2c;
}

.remove-item {
    font-size: 13px;
    color: #ff6b6b;
    cursor: pointer;
}

.summary-card {
    position: sticky;
    top: 90px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 10px;
    color: #4c556d;
}

.summary-row.total {
    font-size: 18px;
    font-weight: 700;
    margin-top: 16px;
    color: #2a2a2a;
}

.coupon-input {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.coupon-input input {
    flex: 1;
    border: 1px solid rgba(76, 82, 255, 0.2);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
    background: #fff;
}

.checkout-btn {
    width: 100%;
    padding: 12px 0;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #6c5ce7, #00c6ff);
    color: #fff;
    font-weight: 600;
    margin-top: 16px;
    box-shadow: 0 12px 22px rgba(0, 198, 255, 0.3);
}

.notice-box {
    background: linear-gradient(135deg, #fff7e6, #fff0f6);
    border-radius: 12px;
    padding: 16px;
    font-size: 13px;
    color: #7a4a4a;
    line-height: 1.6;
    border: 1px dashed rgba(255, 107, 107, 0.4);
}

.form-label {
    font-weight: 600;
    font-size: 14px;
    color: #2f3a52;
}

.form-control,
.form-select {
    font-size: 14px;
    border-radius: 10px;
    border: 1px solid rgba(108, 92, 231, 0.18);
    box-shadow: 0 6px 16px rgba(108, 92, 231, 0.08);
}

.pill-button {
    border: 1px solid rgba(108, 92, 231, 0.18);
    background: #fff;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    cursor: pointer;
    color: #4c556d;
    box-shadow: 0 8px 16px rgba(108, 92, 231, 0.08);
}

.pill-button.active {
    border-color: transparent;
    color: #fff;
    font-weight: 600;
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    box-shadow: 0 10px 20px rgba(255, 107, 107, 0.35);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 30px;
    padding: 0;
    margin-bottom: 40px;
}

.product-loading,
.product-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #999;
}

.product-card {
    position: relative;
    display: flex;
    flex-flow: column;
    cursor: pointer;
}

.product-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
    background: #f8f9fa;
    margin-bottom: 0;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-badge.tags {
    position: absolute;
    width: 100%;
    top: 0;
    right: 0;
    left: 0;
    z-index: 2;
    padding: 0;
}

.product-badge.tags > span {
    display: inline-block;
    padding: 8px 15px;
    margin: 0 3px 5px 0;
    line-height: 100%;
    background: #fff;
    border: 1px solid #333;
    font-size: 14px;
}

.product-badge.tags .new {
    color: #fff;
    background: #333;
    border-color: #333;
}

.product-badge.tags .sale {
    color: #fff;
    background: #007bff;
    border-color: #007bff;
}

.product-info {
    position: relative;
    width: 100%;
    margin-top: 12px;
    display: flex;
    flex-flow: column;
    gap: 5px;
}

.product-name {
    width: fit-content;
    font-size: 16px;
    font-weight: 400;
    color: #2c2c2c;
    line-height: 1.4;
    margin-bottom: 0;
}

.product-subtitle {
    font-size: 14px;
    color: #999;
    margin-bottom: 0;
}

.product-price-section {
    margin-top: 0;
    padding-top: 0;
}

.price-row {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-bottom: 0;
    white-space: nowrap;
}

.original-price {
    font-size: 14px;
    color: #999;
    text-decoration: line-through;
    margin-right: 5px;
}

.sale-price {
    font-size: 16px;
    font-weight: 400;
    color: #007bff;
}

.member-price {
    font-size: 14px;
    font-weight: 400;
    color: #007bff;
}

.product-specs {
    font-size: 12px;
    color: #666;
    margin-top: 0;
}

.product-detail-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    overflow-y: auto;
    backdrop-filter: blur(2px);
}

.product-detail-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content-wrapper {
    background: #fff;
    border-radius: 12px;
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    background: rgba(0,0,0,0.7);
}

.product-detail-content {
    padding: 40px;
    background: #fff;
}

.detail-image-section {
    margin-bottom: 30px;
}

.detail-main-image {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 8px;
    margin-bottom: 15px;
    background: #f8f9fa;
}

.detail-thumbnails {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.detail-thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s;
    background: #f8f9fa;
}

.detail-thumbnail:hover,
.detail-thumbnail.active {
    border-color: #007bff;
}

.detail-info-section {
    margin-bottom: 30px;
}

.detail-title {
    font-size: 32px;
    font-weight: 600;
    color: #2c2c2c;
    margin-bottom: 20px;
    line-height: 1.4;
}

.detail-price-section {
    padding: 25px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 30px;
}

.price-display {
    display: flex;
    align-items: baseline;
    gap: 15px;
    flex-wrap: wrap;
}

.price-display .sale-price {
    font-size: 32px;
    font-weight: 700;
    color: #dc3545;
}

.price-display .original-price {
    font-size: 20px;
    color: #999;
    text-decoration: line-through;
}

.member-price-note {
    font-size: 14px;
    color: #666;
    margin-top: 8px;
}

.spec-selection {
    margin-bottom: 25px;
    /* padding-bottom: 20px; */
    /* border-bottom: 1px solid #e9ecef; */
}

.spec-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c2c2c;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.spec-title span {
    font-weight: 400;
    color: #666;
    margin-left: 5px;
}

.spec-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.spec-option {
    padding: 12px 24px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 15px;
    color: #333;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spec-option:hover {
    border-color: #007bff;
    background: #f0f7ff;
}

.spec-option.selected {
    border-color: #007bff;
    background: #007bff;
    color: #fff;
}

.quantity-selector {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 15px;
}

.quantity-input-group {
    display: flex;
    align-items: center;
    border: 2px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.quantity-btn {
    width: 48px;
    height: 48px;
    border: none;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: all 0.3s;
}

.quantity-btn:hover:not(:disabled) {
    background: #e9ecef;
}

.quantity-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quantity-input {
    width: 70px;
    height: 48px;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #2c2c2c;
}

.stock-info {
    font-size: 15px;
    color: #666;
    margin-left: 0;
}

.stock-info strong {
    color: #2c2c2c;
    font-weight: 600;
}

.product-note {
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #007bff;
}

.product-note-title {
    font-size: 14px;
    font-weight: 600;
    color: #2c2c2c;
    margin-bottom: 8px;
}

.product-note-content {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

.action-buttons-detail {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.btn-detail {
    flex: 1;
    padding: 18px 30px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-detail i {
    font-size: 20px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 1140px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-gap: 20px 30px;
    }
}

@media (max-width: 820px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-gap: 10px 15px;
        padding: 0;
    }

    .product-badge.tags > span {
        padding: 5px 10px;
        font-size: 12px;
    }

    .product-name {
        font-size: 14px;
    }

    .sale-price {
        font-size: 14px;
    }
}

@media (max-width: 992px) {
    .summary-card {
        position: static;
    }
}

@media (max-width: 768px) {
    .checkout-header {
        position: sticky;
        top: 0;
        z-index: 1080;
    }

    /* header-actions 改用 Bootstrap d-none d-md-flex 控制，此處不再覆寫 */

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

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-gap: 10px 15px;
        padding: 0;
    }

    .product-detail-content {
        padding: 20px;
    }

    .detail-title {
        font-size: 24px;
    }

    .price-display .sale-price {
        font-size: 28px;
    }

    .price-display .original-price {
        font-size: 18px;
    }

    .spec-option {
        padding: 10px 18px;
        font-size: 14px;
    }

    .quantity-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .action-buttons-detail {
        flex-direction: column;
    }

    .btn-detail {
        padding: 16px 24px;
        font-size: 16px;
    }

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

    .cart-item-price {
        text-align: left;
    }
}
