/* 价格标签动画 */
@keyframes bounceRotate {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    50% { transform: scale(1) rotate(0deg); }
    75% { transform: scale(1.1) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes pulseGlow {
    0% { text-shadow: 0 0 5px rgba(255, 65, 108, 0.3); opacity: 0.8; }
    50% { text-shadow: 0 0 15px rgba(255, 65, 108, 0.8), 0 0 30px rgba(255, 65, 108, 0.4); opacity: 1; }
    100% { text-shadow: 0 0 5px rgba(255, 65, 108, 0.3); opacity: 0.8; }
}

@keyframes shine {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes cornerShine {
    0% {
        background-position: -100% -100%;
    }
    100% {
        background-position: 200% 200%;
    }
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    25% { transform: scale(1.1); }
    50% { transform: scale(1); }
    75% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

a {
    text-decoration: none;
    color: inherit;
}

a:hover, a:visited, a:active, a:link {
    text-decoration: none;
    color: inherit;
}

/* 直播回放模块样式 */
.live-replay {
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.live-replay-content {
    margin-top: 10px;
    margin-bottom: -15px;
    position: relative;
}

.live-replay-content a {
    display: block;
    position: relative;
}

.live-replay-content a::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.live-replay-content a::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-40%, -50%);
    width: 0;
    height: 0;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-left: 25px solid white;
    z-index: 2;
    transition: all 0.3s ease;
}

.live-replay-content a:hover::after {
    background: rgba(255, 65, 108, 0.7);
    transform: translate(-50%, -50%) scale(1.1);
}

.live-replay-content a:hover::before {
    transform: translate(-40%, -50%) scale(1.1);
}

.discount-tag {
    display: inline-block;
    background: linear-gradient(45deg, #ff416c, #ff4b2b);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 8px;
    animation: heartbeat 1s ease-in-out infinite;
    box-shadow: 0 2px 4px rgba(255, 65, 108, 0.3);
}

.save-tag {
    display: inline-block;
    background: linear-gradient(45deg, #ffd700, #ffa500);
    color: #333;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 8px;
    animation: heartbeat 1s ease-in-out infinite 0.3s;
    box-shadow: 0 2px 4px rgba(255, 215, 0, 0.3);
}

.product-subtitle {
    font-weight: 500;
    letter-spacing: 0.5px;
    color: #ff416c;
    position: relative;
    overflow: hidden;
}

.notice-container {
    margin: 0;
    background: #fff;
}

.notice-bar {
    border: 2px solid #FF416C;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    margin-bottom: 15px;
}

.notice-header {
    background: linear-gradient(180deg, rgba(255, 65, 108, 0.15) 15%, rgba(255, 75, 43, 0.03) 80%);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-radius: 6px;
    height: 40px;
    padding: 0 15px;
}

.notice-title {
    color: #333;
    font-size: 18px;
    font-weight: bold;
    margin: 0;
    margin-right: 10px;
}

.notice-subtitle {
    color: #ff0000;
    font-size: 14px;
    margin: 0;
    background: rgba(255, 255, 255, 0.9);
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(255, 0, 0, 0.1);
}

.notice-bar-content {
    height: 120px;
    overflow: hidden;
    position: relative;
    background: #fff;
    padding: 0px 15px 10px 15px;
}

.notice-bar-wrapper {
    position: relative;
    transition: transform 0.5s ease;
}

.notice-item {
    display: flex;
    align-items: center;
    padding: 0 auto;
    border-bottom: 1px solid rgba(255, 65, 108, 0.1);
    background: #fff;
}

.notice-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 10px;
    border: 2px solid rgba(255, 65, 108, 0.3);
}

.notice-info {
    flex: 1;
    margin-right: 15px;
}

.notice-text {
    font-size: 14px;
    display: flex;
    flex-direction: column;
    color: #333;
    line-height: 1.2;
}

.notice-text .user-name {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 13px;
}

.notice-text .purchase-info {
    color: #666;
    font-size: 13px;
}

.notice-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 60px;
    position: relative;
}

.action-text {
    font-size: 12px;
    color: #ff0000;
    background: #fff7e6;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 0;
    height: 15px;
    line-height: 15px;
    position: absolute;
    top: 8px;
    z-index: 1;
}

.action-button {
    background: #ff0000;
    color: #fff;
    border: none;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(255, 0, 0, 0.2);
    height: 40px;
    margin-top: 15px;
}

.action-button:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 商品详情页样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.5;
    background-color: #f5f5f5;
    color: #333;
    max-width: 640px;
    margin: 0 auto;
}

/* 顶部导航栏样式 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: #fff;
    display: flex;
    align-items: center;
    padding: 0 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    z-index: 1000;
}

.header-left,
.header-right {
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-left a {
    color: #333;
    text-decoration: none;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

/* 导航标签样式 */
.nav-tabs {
    display: flex;
    gap: 30px;
}

.nav-tab {
    color: #666;
    font-size: 16px;
    text-decoration: none;
    padding: 5px 10px;
    position: relative;
}

.nav-tab.active {
    color: #333;
    font-weight: 600;
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background-color: #ef4444;
    border-radius: 1px;
}

/* 主体内容样式 */
.main {
    margin-top: 50px;
    padding: 5px;
    background: #f5f6f7;
    min-height: calc(100vh - 50px - 60px);
    max-width: 640px;
    width: 100%;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

/* 产品轮播图样式 */
.product-swiper {
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    margin-bottom: 15px;
}

.swiper-container {
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    position: relative;
    overflow: hidden;
}

.swiper-slide {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.swiper-pagination {
    position: absolute;
    bottom: 10px;
    width: 100% !important;
    text-align: center;
    z-index: 10;
}

.swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    display: inline-block;
    border-radius: 50%;
    background: #fff;
    opacity: 0.5;
    margin: 0 4px;
}

.swiper-pagination-bullet-active {
    opacity: 1;
    background: #6366f1;
}

.swiper-button-next,
.swiper-button-prev {
    color: #fff;
    background: rgba(0, 0, 0, 0.3);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.swiper-button-next:after,
.swiper-button-prev:after {
    font-size: 16px;
    font-weight: bold;
}

/* 产品信息样式 */
.product-info {
    background: #fff;
    padding: 10px 15px 10px;
    margin-bottom: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.price-info {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 5px;
}

.current-price {
    color: #ef4444;
    font-size: 20px;
    font-weight: 600;
}

.original-price {
    color: #999;
    font-size: 14px;
    text-decoration: line-through;
}

.current-price2 {
    color: #ef4444;
    font-size: 16px;
    font-weight: 600;
}


.sales-count {
    color: #666;
    font-size: 12px;
    margin-left: auto;
}

.product-title {
    font-size: 20px;
    font-weight: bold;
    margin: 10px 0 5px;
    line-height: 1.3;
    position: relative;
    overflow: hidden;
    color: #333;
}

.product-title::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 40px;
    height: 40px;
    background: linear-gradient(to bottom right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.8) 50%, rgba(255,255,255,0) 100%);
    background-size: 200% 200%;
    transform: rotate(45deg);
    animation: cornerShine 3s infinite ease-in-out;
    z-index: 1;
}

.product-subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    font-weight: 500;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.product-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    background: #f3f4f6;

    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* 产品参数样式 */
.product-params {
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.param-item {
    display: flex;
    justify-content: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}

.param-item:last-child {
    border-bottom: none;
}

.param-label {
    color: #666;
    font-size: 14px;
    width: 30%;
}

.param-value {
    color: #333;
    font-size: 14px;
    text-align: left;
    flex: 1;
}

/* 评价模块样式 */
.reviews-section {
    background: #fff;
    padding: 15px;
}

.view-all-reviews {
    text-align: center;

    margin-top: 15px;
}

.view-all-reviews a {
    color: #ef4444;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.view-all-reviews a:hover {
    color: #ef4444;
}

.reviews-section {
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px 15px 0; /* Adjusted padding, removed height */
    border-bottom: 1px solid #eaeaea;
    margin-bottom: 15px;
    background-color: #fff;
}

.section-header h2 {
    font-size: 16px;
    color: #333;
    font-weight: 600;
    margin: 0;
    position: relative;
    padding-left: 12px; /* Reverted vertical padding, relying on align-items */
    flex-grow: 1; /* Ensure h2 takes available space */
}

.section-header .view-all {
    font-size: 14px;
    color: #666;
    text-decoration: none;
    padding: 0 5px; /* Reverted vertical padding, relying on align-items */
    white-space: nowrap;
}

.section-header h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background-color: #ef4444;
    border-radius: 1.5px;
}

.view-all {
    color: #6366f1;
    font-size: 14px;
    text-decoration: none;
    margin-top: 15px;
    display: block;
    text-align: center;
    width: 100%;
}

.review-item {
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.review-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.reviewer-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.reviewer-details {
    flex: 1;
}

.nickname {
    font-size: 14px;
    color: #333;
    display: block;
    font-weight: 500;
}

.phone {
    font-size: 12px;
    color: #999;
}

.rating {
    color: #fbbf24;
}

.review-content {
    font-size: 14px;
    color: #333;
    margin: 10px 0;
    line-height: 1.5;
}

.review-images {
    display: flex;
    gap: 8px;
    margin: 10px 0;
}

.review-images img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.review-location {
    font-size: 12px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 为什么选择我们 */
.why-choose-us {
    background: #fff;
    padding: 20px 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.why-choose-us h2 {
    font-size: 18px;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.choose-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: 15px;
}

.choose-item {
    text-align: center;
}

.choose-item img {
    width: 40px;
    height: 40px;
    margin-bottom: 8px;
}

.choose-item h3 {
    font-size: 14px;
    color: #333;
    margin: 0;
}

/* 商品详情 */
.product-details {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    padding-bottom: 0;
}

/* 商品详情标题样式 */
.product-details .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f3f4f6;
    background-color: #fff;
    margin-bottom: 0;
}

.product-details .section-header h2 {
    font-size: 16px;
    color: #333;
    font-weight: 600;
    margin: 0;
    position: relative;
    padding-left: 10px;
}

.product-details .section-header h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background-color: #ef4444;
    border-radius: 1.5px;
}

.details-content {
    padding: 0;
    background-color: #fff;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

.details-content img {
    width: 100%;
    height: auto;
    display: block;
    margin: 0;
    padding: 0;
    border-radius: 0;
    background: #f5f6f7;
    object-fit: cover;
    vertical-align: middle;
    border: none;
}

.details-content p {
    padding: 10px 15px;
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    text-align: justify;
}

.details-content img[src=""] {
    position: relative;
}

.details-content img[src=""]::after {
    content: "No Image";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    font-size: 14px;
}

/* 相关推荐 */
.related-products {
    background: #fff;
    padding: 20px 15px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.related-products h2 {
    font-size: 16px;
    color: #333;
    font-weight: 600;
    margin: 0;
    position: relative;
    padding-left: 10px;
}

.related-products h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background-color: #ef4444;
    border-radius: 1.5px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: 12px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.product-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.product-image {
    width: 100%;
    padding-bottom: 100%;
    position: relative;
}

.product-image img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-item .product-info {
    padding: 4px 10px 8px;
    margin: 0;
    box-shadow: none;
}

.product-item .product-name {
    font-size: 14px;
    color: #333;
    margin: 8px 0 3px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-item .product-price {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-bottom: 2px;
}

/* 底部操作栏 */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    display: flex;
    align-items: center;
    padding: 0 15px;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #666;
    text-decoration: none;
    padding: 0 15px;
}

.nav-item i {
    font-size: 20px;
    margin-bottom: 2px;
}

.nav-item span {
    font-size: 12px;
}

.action-btn {
    flex: 1;
    height: 40px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    margin-left: 10px;
    cursor: pointer;
}

.wechat-btn {
    background: #f3f4f6;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.buy-btn {
    background: #ef4444;
    color: #fff;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    right: 20px;
    bottom: 80px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: none;
    align-items: center;
    justify-content: center;
    color: #666;
    cursor: pointer;
    z-index: 900;
}

/* 模态框通用样式 */
.modal {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    transition: opacity 0.3s ease-in-out;
    opacity: 0;
    overflow: hidden;
}

.modal.show {
    display: block;
    opacity: 1;
}

.modal-content {
    position: fixed;
    bottom: 0;
    left: 50%; /* Center the modal */
    transform: translateX(-50%) translateY(100%); /* Initial position for slide-in */
    width: 100%;
    max-width: 640px;
    height: 90vh; /* Use height instead of max-height for fixed internal layout */
    background-color: #fff;
    border-radius: 16px 16px 0 0;
    box-sizing: border-box;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden; /* No scrollbar on modal-content itself */
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease-in-out;
    /* Padding at the bottom to make space for the fixed submit-btn-container */
    /* Estimate height: 15px (top pad btn cont) + 15px*2 (btn pad) + 17px (btn font) + 1px (border) + 15px (bottom pad btn cont) = ~78px. Use 85px for safety. */
    padding-bottom: 85px; /* Adjusted for increased button padding and font */
}

.modal.show .modal-content {
    transform: translateX(-50%) translateY(0); /* Slide into view */
}

/* 固定顶部标题栏 */
.modal-header {
    background: white;
    z-index: 10;
    padding: 15px 15px 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    position: relative;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.close-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background-color: #eaeaea;
}

/* 优化product-preview排版 */
.product-preview {
    display: flex;
    gap: 15px;
    margin: 15px;
    padding: 0 0 0 0;
    border-radius: 10px;
    align-items: stretch; /* Critical for making preview-info match image height */
    flex-shrink: 0;
}

.preview-image {
    width: 160px;  /* INCREASED SIZE */
    height: 160px; /* INCREASED SIZE */
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.preview-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Distributes content vertically to fill height */
    gap: 8px;
    padding: 0 5px;
}

.preview-title {
    margin: 0 0 5px 0;
    font-size: 17px; /* Slightly larger */
    font-weight: 600;
    line-height: 1.3;
}

.preview-price {
    margin: 0 0 0 0;
    font-size: 16px; /* Slightly larger */
    color: #ff416c;
    font-weight: bold;
}

.preview-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto; /* Ensures it's pushed towards the bottom if space-between isn't enough */
}

.quantity-section {
    display: flex;
    align-items: center;

    gap: 10px;
}

.quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.quantity-btn {
    padding: 7px 13px; /* Slightly adjusted */
    background: #f5f5f5;
    border: none;
    color: #333;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

.quantity-btn:hover {
    background: #e8e8e8;
}

.quantity-input {
    width: 45px; /* Slightly wider */
    text-align: center;
    border: none;
    border-left: 1px solid #eee;
    border-right: 1px solid #eee;
    padding: 7px 0; /* Slightly adjusted */
    font-size: 15px; /* Slightly larger */
}
/* Hide browser default spinners for number input */
.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.quantity-input[type=number] {
  -moz-appearance: textfield; /* Firefox */
}


.total-section {
    display: flex;
    align-items: center;
    padding: 5px 12px; /* Adjusted padding */
    background: #f0f0f0;
    border-radius: 8px;
    margin-top: 8px; /* Adjusted margin */
}

.total-amount {
    color: #ff416c;
    font-weight: bold;
    font-size: 22px; /* Slightly larger */
}

/* 购买表单样式 */
.buy-form {
    display: flex;
    flex-direction: column;
    gap: 12px; /* This gap is between form-groups */
    padding: 0 15px 15px 15px;
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px; /* Gap between label-error-container and input/textarea */
    /* margin-bottom: 0px; /* Remove this if you use gap on .buy-form */
}

.label-error-container {
    display: flex;
    justify-content: space-between; /* Pushes label to left, error to right */
    align-items: baseline; /* Aligns based on text baseline, good for single line errors */
    min-height: 1.2em; /* Reserve space even if error is not visible to prevent jump */
}

.form-group label {
    font-size: 14px;
    color: #333;
    font-weight: 500;
    /* No specific flex properties needed here now */
}

.form-group input,
.form-group textarea {
    padding: 11px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    width: 100%;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: #ff416c;
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 65, 108, 0.25);
}

.form-group textarea {
    min-height: 75px;
    resize: vertical;
}

.error-message {
    color: #ff416c;
    font-size: 13px;
    /* margin-top: 3px; /* No longer needed as it's side-by-side */
    /* min-height: 1.2em; /* Moved to .label-error-container for overall height consistency */
    text-align: right; /* Aligns text to the right within its own bounds */
    /* Optional: add a little left margin if you don't want it pushed to the extreme right by space-between */
    /* margin-left: 8px; */
}

/* Keep the rest of your CSS as is */
/* ... (modal, product-preview, submit-btn-container, etc.) ... */

/* Ensure the general modal structure and other elements remain as you provided them */
/* MODAL, HEADER, PRODUCT PREVIEW, SUBMIT BUTTONS, SUCCESS MODAL etc. STYLES from your original post */

/* 模态框通用样式 */
.modal {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    transition: opacity 0.3s ease-in-out;
    opacity: 0;
    overflow: hidden;
}

.modal.show {
    display: block;
    opacity: 1;
}

.modal-content {
    position: fixed;
    bottom: 0;
    left: 50%; /* Center the modal */
    transform: translateX(-50%) translateY(100%); /* Initial position for slide-in */
    width: 100%;
    max-width: 640px;
    height: 90vh; /* Use height instead of max-height for fixed internal layout */
    background-color: #fff;
    border-radius: 16px 16px 0 0;
    box-sizing: border-box;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden; /* No scrollbar on modal-content itself */
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease-in-out;
    padding-bottom: 85px;
}

.modal.show .modal-content {
    transform: translateX(-50%) translateY(0); /* Slide into view */
}

/* 固定顶部标题栏 */
.modal-header {
    background: white;
    z-index: 10;
    padding: 15px 15px 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    position: relative;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.close-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background-color: #eaeaea;
}

/* 优化product-preview排版 */
.product-preview {
    display: flex;
    gap: 15px;
    margin: 15px;
    padding: 0 0 0 0;
    border-radius: 10px;
    align-items: stretch;
    flex-shrink: 0;
}

.preview-image {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.preview-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    padding: 0 5px;
}

.preview-title {
    margin: 0 0 5px 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
}

.preview-price {
    margin: 0 0 0 0;
    font-size: 16px;
    color: #ff416c;
    font-weight: bold;
}

.preview-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.quantity-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.quantity-btn {
    padding: 7px 13px;
    background: #f5f5f5;
    border: none;
    color: #333;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

.quantity-btn:hover {
    background: #e8e8e8;
}

.quantity-input {
    width: 45px;
    text-align: center;
    border: none;
    border-left: 1px solid #eee;
    border-right: 1px solid #eee;
    padding: 7px 0;
    font-size: 15px;
}
.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.quantity-input[type=number] {
  -moz-appearance: textfield;
}


.total-section {
    display: flex;
    align-items: center;
    padding: 5px 12px;
    background: #f0f0f0;
    border-radius: 8px;
    margin-top: 8px;
}

.total-amount {
    color: #ff416c;
    font-weight: bold;
    font-size: 22px;
}

/* 固定底部提交按钮 */
.submit-btn-container {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 640px;
    padding: 15px;
    background: #fff;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.12);
    z-index: 10000;
    box-sizing: border-box;
    border-top: 1px solid #eee;
}

.submit-btn {
    background: linear-gradient(45deg, #ff416c, #ff4b2b);
    color: white;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 17px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
    display: block;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(255, 65, 108, 0.35);
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 成功提示模态框样式 */
.success-modal .modal-content {
    height: auto;
    max-height: 80vh;
    padding-bottom: 20px;
    opacity: 0;
    margin: 0 auto; /* Standard centering if element has width */
    top: 50%;
    bottom: auto;
    transform: translateX(-50%) translateY(-50%) scale(0.95);
    border-radius: 16px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease-out;

    /* --- Modifications (retained) --- */
    max-width: 400px; /* Limit the maximum width */
    width: 90%; /* Ensure it doesn't get too small */
    /* --- End Modifications --- */
}

.success-modal.show .modal-content {
    opacity: 1;
    transform: translateX(-50%) translateY(-50%) scale(1);
}

.success-modal .modal-header {
    justify-content: center;
    border-bottom: none;
    box-shadow: none;
    padding-bottom: 0;
    padding-top: 20px;
}

.success-modal .modal-header h3 {
    color: #4CAF50;
    font-size: 20px;
}

/* --- Modification: Add text-align: center to the parent div of icon and paragraph --- */
/* Target the div immediately after modal-header within modal-content */
.success-modal .modal-content > div:nth-child(2) {
    text-align: center; /* This centers inline/inline-block children and can help with block elements */
    /* You might remove any default padding/margin from this div if it exists elsewhere */
}
/* --- End Modification --- */


.success-modal .fa-check-circle {
    /* --- Modifications (retained/adjusted) --- */
    font-size: 80px; /* Increased size again - adjust as needed */
    margin: 20px auto 15px; /* Adjusted top margin, kept auto for horizontal */
    /* --- End Modifications --- */

    color: #4CAF50;
    display: block; /* Required for auto margin centering */
}

.success-modal p {
    font-size: 16px;
    line-height: 1.6;
    text-align: center; /* Kept here, but text-align on parent also handles this */
    margin-bottom: 20px;
    color: #333;
    padding: 0 20px; /* Ensure padding doesn't push content off-center */
}

/* Style the "确定" button */
.success-modal .submit-btn {
    display: block; /* Make it a block element */
    width: 60%; /* Set a relative width */
    max-width: 200px; /* Set a maximum width */
    margin: 20px auto; /* Center it horizontally and add space above */
    padding: 10px 20px; /* Adjust padding if needed */
    font-size: 16px; /* Adjust font size if needed */
    /* Add any other necessary button styling from your global .submit-btn */
}

/* Remove or keep the original .close-btn style if it's for a different button */
/*
.success-modal .close-btn {
    top: 10px;
    right: 10px;
    transform: none;
    background-color: transparent;
}
.success-modal .close-btn:hover {
    background-color: #f0f0f0;
}
*/