* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width:none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
    /* font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; */
}

body {
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
    /* padding: 20px; */
}

.container {
    /* max-width: 1200px; */
    margin: 0 auto;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.product-page {
    display: flex;
    flex-wrap: wrap;
    padding: 30px;
}

/* 左侧图片区域 */
.product-images {
    flex: 1;
    min-width: 500px;
    /* padding-right: 40px; */
}

.main-image-container {
    position: relative;
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
    /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); */
    /* background-color: #f9f9f9; */
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.9);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    color: #555;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    z-index: 10;
}

.nav-arrow:hover {
    background-color: white;
    color: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.nav-arrow.left {
    left: 10px;
}

.nav-arrow.right {
    right: 10px;
}

.thumbnail-container {
    position: relative;
    display: flex;
    align-items: center;
}

.thumbnails {
    display: flex;
    overflow: hidden;
    scroll-behavior: smooth;
    padding: 5px 0;
}

.thumbnail-scroll-btn {
    background-color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    z-index: 2;
    flex-shrink: 0;
}

.thumbnail-scroll-btn:hover {
    background-color: #f0f0f0;
    color: #333;
}

.thumbnail-scroll-btn.left {
    margin-right: 10px;
}

.thumbnail-scroll-btn.right {
    margin-left: 10px;
}

.thumbnail {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    margin-right: 12px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.thumbnail.active {
    border-color: #4a6cf7;
    box-shadow: 0 4px 8px rgba(74, 108, 247, 0.3);
}

.thumbnail:hover:not(.active) {
    border-color: #aaa;
}

/* 右侧产品信息 */
.product-info {
    flex: 1;
    min-width: 400px;
    padding-left: 20px;
}

.product-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #222;
}

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

.product-price {
    font-size: 32px;
    font-weight: 700;
    color: #e53935;
    margin-bottom: 30px;
}

.option-group {
    margin-bottom: 5px;
}

.option-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #444;
    font-size: 16px;
}

select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    background-color: white;
    color: #333;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 20px;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: #4a6cf7;
    box-shadow: 0 0 0 2px rgba(74, 108, 247, 0.2);
}

.quantity-options-title {
    font-weight: 600;
    margin-bottom: 15px;
    color: #444;
    font-size: 16px;
}

.quantity-option {
    display: flex;
    justify-content: flex-start;
    gap: 18px;
    padding: 0px 10px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quantity-option:hover {
    border-color: #aaa;
}

.quantity-option.selected {
    border-color: #4a6cf7;
    background-color: rgba(74, 108, 247, 0.1);
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.1);
}

.quantity-info {
    flex: 1;
}

/* Left-align the three parts inside a quantity option */
.quantity-left, .quantity-wholesale, .quantity-middle, .quantity-right {
    text-align: left;
}
.quantity-left { flex: 0 0 auto; min-width: 100px;}
.quantity-wholesale { flex: 0 0 auto; min-width: 90px; color: black; font-size: 16px; font-weight: 600;}
.quantity-middle { flex: 1 1 auto; }
.quantity-right { flex: 0 0 auto; align-self: center; }

.quantity-name {
    font-weight: 600;
    color: #222;
    margin-bottom: 5px;
}

.quantity-details {
    display: flex;
    gap: 20px;
    color: #666;
    font-size: 14px;
}

.quantity-price {
    font-size: 22px;
    font-weight: 700;
    color: #e53935;
    align-self: center;
}

/* Right-side small text in the quantity options */
.quantity-right {
    font-size: 12px;
    color: crimson;
    align-self: center;
}

.discount-badge {
    background-color: #ff9800;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    margin-left: 10px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.product-action-buttons {
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
}

.btn.product-action-button {
    width: 100%;
    min-height: 64px;
    padding: 10px 20px !important;
    border-radius: 8px;
    border: 1px solid #e1e1e1;
    background: #fff;
    color: #111;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    text-align: left !important;
    text-decoration: none;
    box-shadow: none;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn.product-action-button:hover {
    transform: translateY(-2px);
    border-color: #cfcfcf;
    box-shadow: 0 6px 15px rgba(74, 108, 247, 0.3);
}

.btn.product-action-button:focus-visible {
    outline: 2px solid rgba(74, 108, 247, 0.45);
    outline-offset: 2px;
}

.btn.product-action-button:active {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(74, 108, 247, 0.14);
}

.btn.product-action-button-primary {
    border-color: rgb(254, 198, 41) !important;
    background-color: rgb(254, 198, 41) !important;
}

.product-action-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.product-action-title {
    color: #000;
    font-size: 17px;
    font-weight: 700;
}

.product-action-subtitle {
    margin-top: 3px;
    color: #333;
    font-size: 13px;
    font-weight: 500;
}

.product-action-icon {
    flex: 0 0 auto;
    color: #111;
    font-size: 18px;
}

.btn.product-add-cart-btn {
    font-family: inherit;
}

.btn.product-add-cart-btn:hover {
    background-color: #fffdf7;
}

.btn.product-add-cart-btn:disabled {
    cursor: progress;
    opacity: 0.72;
    transform: none;
    box-shadow: none;
}

/* Related Products Section */
.related-products {
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

.related-products-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.related-products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.related-product-item {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    background-color: #fff;
    max-height: 150px;
}

.related-product-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: #d1d5db;
}

.related-product-image {
    width: 100%;
    height: 100px;
    overflow: hidden;
    background-color: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.related-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.related-product-item:hover .related-product-image img {
    transform: scale(1.05);
}

.related-product-title {
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    text-align: center;
    line-height: 1.3;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive related products for smaller screens */
@media (max-width: 768px) {
    .related-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .related-products-grid {
        grid-template-columns: 1fr;
    }
}

.btn {
    flex: 1;
    padding: 16px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: #4a6cf7;
    color: white;
}

.btn-primary:hover {
    background-color: #3a5ce5;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(74, 108, 247, 0.3);
}

.btn-secondary {
    background-color: #f5f5f5;
    color: #333;
}

.btn-secondary:hover {
    background-color: #e8e8e8;
}

/* Custom div-based select styles */
.custom-select {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* gap: 12px; */
    background: #fff;
    cursor: pointer;
}
.custom-select:focus {
    outline: none;
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74,108,247,0.08);
}
.custom-select .select-title {
    font-weight: 600;
    color: #444;
    flex: 0 0 auto;
}
.custom-select .select-value {
    flex: 1 1 auto;
    text-align: right;
    color: #222;
    margin-left: 12px;
    font-size: 14px;;
}
.custom-select-list {
    position: absolute;
    /* margin-bottom: 10px; */
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    z-index: 40;
    max-height: 220px;
    overflow: auto;
    font-size: 12px;
}

.material-select-list{
    position: relative;
    top: 0;
}

.custom-select-item {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f1f1;
    cursor: pointer;
}
.custom-select-item:hover { background: #f5f7ff; }
.custom-select-item:last-child { border-bottom: none; }

.custom-select-item.custom-size-inputs {
    padding: 12px;
    background-color: #f9fafb;
    border-top: 1px solid #e5e7eb;
    cursor: default;
}

.custom-select-item.custom-size-inputs:hover {
    background-color: #f9fafb;
}

/* Material dropdown item style */
.material-list {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px;
    max-height: 320px;
    overflow: auto;
}

/* Render material dropdown in normal flow so it pushes following content down
   (override absolute positioning used by generic .custom-select-list) */
.custom-select-list.material-list {
    position: static;
    left: auto;
    right: auto;
    top: auto;
    box-shadow: none;
    border-radius: 10px;
    border: 1px solid #eef2ff;
    background: transparent;
    padding: 8px 12px;
}

/* Material select: stack header and list vertically so the list pushes content down */
.custom-select.material-select {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}
.custom-select.material-select .select-title {
    margin-bottom: 0;
}
.custom-select.material-select .select-value {
    text-align: left;
    margin-left: 0;
    color: #444;
    font-size: 13px;
}
.custom-select-list.material-list {
    margin-top: 4px;
    background: #fff;
}
.custom-select-item.material-item {
    width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #fff;
    position: relative;
    cursor: pointer;
    float: left;
}
.custom-select-item.material-item:hover { background-color: #fbfdff; border-color: #e6eefc; }
.material-thumb {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fff;
}
.material-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.material-thumb.placeholder {
    background: linear-gradient(180deg, #f7f8fa 0%, #f1f3f5 100%);
}
.material-title {
    font-weight: 600;
    font-size: 13px;
    color: #111;
    text-align: center;
    line-height: 1.1;
}
.material-sub {
    font-size: 12px;
    color: #6b6b6b;
    text-align: center;
}
.custom-select-item.material-item.selected-material {
    border-color: #2563eb;
    box-shadow: 0 6px 18px rgba(37,99,235,0.12);
}
.custom-select-item.material-item .check-icon {
    position: absolute;
    right: 4px;
    top: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: darkgray;
    font-size: 18px;
}

/* Option row to place two option-groups on one line */
.option-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.option-row .option-group {
    flex: 1 1 0;
}

@media (max-width: 1150px) {
    .product-page {
        flex-direction: column;
    }
    
    .product-images, .product-info {
        min-width: 100%;
        padding: 0;
    }
    
    .product-images {
        margin-bottom: 40px;
        width: 100%;
    }
}

@media (max-width: 576px) {
    .product-page {
        padding: 20px;
    }
    /* On small screens prefer auto height so tall images are not clipped; constrain by width instead */
    .main-image-container {
        height: auto;
        max-height: 80vh;
    }
    
    .thumbnail {
        width: 80px;
        height: 80px;
    }

    /* Ensure main image scales to container width and is fully visible */
    .main-image {
        width: 100%;
        height: auto;
        max-height: none;
        object-fit: contain;
        display: block;
    }
    
    /* Keep quantity options in a single left-aligned row on mobile;
       prevent wrapping and shrink text/spacing when needed using clamp() */
    .quantity-option {
        flex-direction: row;
        gap: clamp(6px, 2vw, 12px);
        align-items: center;
        justify-content: flex-start;
        padding: 8px 10px;
        min-width: 0; /* allow flex children to shrink */
    }
    .quantity-left { flex: 0 0 auto; min-width: 64px; font-size: clamp(12px, 2.2vw, 14px); }
    .quantity-wholesale { flex: 0 0 auto; min-width: 74px; font-size: clamp(11px, 2vw, 13px); color: #666; }
    .quantity-middle { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: clamp(12px, 2.2vw, 14px); }
    .quantity-right { flex: 0 0 auto; align-self: center; font-size: clamp(12px, 2.2vw, 14px); }

    .option-row {
        flex-direction: column;
        gap: 2px;
    }
    
    .quantity-price {
        align-self: flex-start;
    }

    /* Ensure product-images does not overflow parent on small screens */
    .product-images {
        min-width: 0 !important;
        width: 100% !important;
        padding-right: 0 !important;
        box-sizing: border-box;
        margin-bottom: 0 !important;
    }

    /* Mobile: reduce custom select title font size */
    .custom-select .select-title { font-size: 14px !important; }
}

/* Mobile override for product title size and color */
@media (max-width: 576px) {
    .product-title {
        font-size: 18px !important;
        font-weight: 700;
        margin-bottom: 10px;
        color: #222;
    }
}
