Files
ai_dianshang/web/assets/css/product-detail.css
2025-11-28 15:18:10 +08:00

851 lines
14 KiB
CSS

/* Product Detail Page Styles */
/* Breadcrumb */
.breadcrumb {
padding: 20px 0;
font-size: 14px;
color: var(--text-light);
}
.breadcrumb a {
color: var(--text-light);
transition: color 0.3s ease;
}
.breadcrumb a:hover {
color: var(--primary-color);
}
.breadcrumb span {
margin: 0 8px;
}
/* Product Detail Wrapper */
.product-detail-wrapper {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 60px;
padding: 40px 0;
}
/* Product Gallery */
.product-gallery {
position: sticky;
top: 140px;
height: fit-content;
}
.main-image {
position: relative;
width: 100%;
aspect-ratio: 1;
background-color: var(--bg-gray);
border-radius: 12px;
overflow: hidden;
margin-bottom: 20px;
}
.main-image img {
width: 100%;
height: 100%;
object-fit: cover;
cursor: zoom-in;
transition: opacity 0.3s ease;
}
/* Image Loading */
.image-loading {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: var(--bg-gray);
z-index: 10;
}
.loading-spinner {
width: 50px;
height: 50px;
border: 4px solid rgba(0, 0, 0, 0.1);
border-top-color: var(--primary-color);
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.loading-text {
margin-top: 15px;
font-size: 14px;
color: var(--text-light);
}
.image-badges {
position: absolute;
top: 20px;
left: 20px;
display: flex;
flex-direction: column;
gap: 8px;
}
.thumbnail-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
gap: 10px;
}
.thumbnail {
aspect-ratio: 1;
border-radius: 8px;
overflow: hidden;
cursor: pointer;
border: 2px solid transparent;
transition: all 0.3s ease;
}
.thumbnail:hover,
.thumbnail.active {
border-color: var(--primary-color);
}
.thumbnail img {
width: 100%;
height: 100%;
object-fit: cover;
}
/* Product Info Section */
.product-info-section {
padding: 20px 0;
}
.product-name {
font-size: 32px;
font-weight: 700;
margin-bottom: 20px;
line-height: 1.3;
color: var(--text-color);
}
.product-rating-wrapper {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 20px;
}
.stars {
color: #ffd43b;
font-size: 18px;
}
.review-count {
color: var(--text-light);
font-size: 14px;
}
/* Price Section */
.product-price-wrapper {
padding: 20px 0;
border-top: 1px solid var(--border-color);
border-bottom: 1px solid var(--border-color);
margin-bottom: 30px;
}
.price-row {
display: flex;
align-items: baseline;
gap: 15px;
margin-bottom: 10px;
}
.price-current {
font-size: 36px;
font-weight: 700;
color: var(--primary-color);
}
.price-original {
font-size: 24px;
color: var(--text-light);
text-decoration: line-through;
}
.price-save {
font-size: 14px;
font-weight: 700;
color: var(--success-color);
background-color: rgba(81, 207, 102, 0.1);
padding: 6px 12px;
border-radius: 20px;
display: inline-block;
}
/* Stock Info */
.stock-info {
display: flex;
align-items: center;
gap: 15px;
margin-bottom: 20px;
}
.stock-status {
font-size: 14px;
font-weight: 600;
padding: 6px 12px;
border-radius: 20px;
}
.stock-status.in-stock {
color: var(--success-color);
background-color: rgba(81, 207, 102, 0.1);
}
.stock-status.out-of-stock {
color: #ff6b6b;
background-color: rgba(255, 107, 107, 0.1);
}
.sold-count {
font-size: 14px;
color: var(--text-light);
}
/* Spec Selector */
.spec-selector {
margin-bottom: 25px;
}
.spec-group {
margin-bottom: 20px;
}
.spec-label {
display: block;
font-size: 16px;
font-weight: 600;
color: var(--text-color);
margin-bottom: 10px;
}
.spec-options {
display: flex;
flex-wrap: wrap;
gap: 10px;
transition: all 0.3s ease;
}
.spec-options.spec-required {
padding: 10px;
background-color: rgba(255, 107, 107, 0.1);
border: 2px dashed #ff6b6b;
border-radius: 8px;
animation: shake 0.5s ease;
}
@keyframes shake {
0%, 100% { transform: translateX(0); }
25% { transform: translateX(-5px); }
75% { transform: translateX(5px); }
}
.spec-option {
min-width: 60px;
padding: 10px 20px;
font-size: 14px;
font-weight: 500;
color: var(--text-color);
background-color: var(--bg-gray);
border: 2px solid var(--border-color);
border-radius: 8px;
cursor: pointer;
transition: all 0.3s ease;
}
.spec-option:hover {
border-color: var(--primary-color);
color: var(--primary-color);
}
.spec-option.selected {
background-color: var(--primary-color);
border-color: var(--primary-color);
color: #fff;
}
.spec-option:disabled {
opacity: 0.4;
cursor: not-allowed;
}
.spec-option:disabled:hover {
border-color: var(--border-color);
color: var(--text-color);
}
/* Quantity Section */
.quantity-section {
display: flex;
align-items: center;
gap: 20px;
margin-bottom: 25px;
}
.quantity-section label {
font-size: 16px;
font-weight: 600;
color: var(--text-color);
}
.quantity-selector {
display: flex;
align-items: center;
border: 2px solid var(--border-color);
border-radius: 8px;
overflow: hidden;
}
.qty-btn {
width: 40px;
height: 40px;
background-color: var(--bg-gray);
border: none;
font-size: 20px;
font-weight: 600;
color: var(--text-color);
cursor: pointer;
transition: all 0.3s ease;
}
.qty-btn:hover {
background-color: var(--primary-color);
color: #fff;
}
.qty-input {
width: 60px;
height: 40px;
border: none;
text-align: center;
font-size: 16px;
font-weight: 600;
appearance: textfield;
-moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Cart Actions */
.cart-actions {
display: grid;
grid-template-columns: 2fr 1fr;
gap: 15px;
margin-bottom: 30px;
}
.cart-actions .btn {
padding: 16px 32px;
font-size: 16px;
font-weight: 600;
border-radius: 8px;
}
.btn-add-cart {
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
}
.btn-buy-now {
background-color: #fff;
border: 2px solid var(--primary-color);
color: var(--primary-color);
}
.btn-buy-now:hover {
background-color: var(--primary-color);
color: #fff;
}
/* Product Features */
.product-features {
background-color: var(--bg-gray);
border-radius: 12px;
padding: 25px;
margin-bottom: 30px;
}
.feature-item {
display: flex;
align-items: center;
gap: 12px;
padding: 10px 0;
font-size: 14px;
color: var(--text-color);
}
.feature-item svg {
color: var(--primary-color);
flex-shrink: 0;
}
/* Product Description */
.product-description {
margin-bottom: 30px;
}
.product-description h3 {
font-size: 18px;
font-weight: 600;
margin-bottom: 15px;
color: var(--text-color);
}
.product-description p {
font-size: 15px;
line-height: 1.8;
color: var(--text-light);
}
/* Share Section */
.product-share {
display: flex;
align-items: center;
gap: 15px;
padding-top: 20px;
border-top: 1px solid var(--border-color);
}
.product-share span {
font-size: 14px;
font-weight: 600;
color: var(--text-color);
}
.share-btn {
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background-color: var(--bg-gray);
color: var(--text-color);
transition: all 0.3s ease;
}
.share-btn:hover {
background-color: var(--primary-color);
color: #fff;
transform: translateY(-3px);
}
/* Product Tabs */
.product-tabs {
margin: 60px 0;
}
.tab-headers {
display: flex;
gap: 5px;
border-bottom: 2px solid var(--border-color);
margin-bottom: 30px;
}
.tab-header {
padding: 15px 30px;
font-size: 16px;
font-weight: 600;
color: var(--text-light);
background-color: transparent;
border: none;
cursor: pointer;
position: relative;
transition: all 0.3s ease;
}
.tab-header:hover {
color: var(--text-color);
}
.tab-header.active {
color: var(--primary-color);
}
.tab-header.active::after {
content: '';
position: absolute;
bottom: -2px;
left: 0;
right: 0;
height: 2px;
background-color: var(--primary-color);
}
.tab-content {
display: none;
padding: 30px;
background-color: var(--bg-gray);
border-radius: 12px;
}
.tab-content.active {
display: block;
}
.details-content h3 {
font-size: 20px;
font-weight: 600;
margin-bottom: 20px;
color: var(--text-color);
}
#productDetailImages {
margin-bottom: 30px;
}
#productDetailImages img {
width: 100%;
max-width: 100%;
height: auto;
display: block;
margin-bottom: 20px;
border-radius: 8px;
}
.details-content ul {
list-style: none;
}
.details-content li {
padding: 12px 0;
border-bottom: 1px solid var(--border-color);
font-size: 15px;
}
.details-content li:last-child {
border-bottom: none;
}
.details-content strong {
color: var(--text-color);
margin-right: 10px;
}
/* Reviews Content */
.reviews-content {
display: flex;
flex-direction: column;
gap: 20px;
}
/* Comment Tabs */
.comment-tabs {
display: flex;
gap: 10px;
margin-bottom: 20px;
flex-wrap: wrap;
}
.comment-tab {
padding: 8px 20px;
background-color: #fff;
border: 1px solid var(--border-color);
border-radius: 20px;
font-size: 14px;
color: var(--text-color);
cursor: pointer;
transition: all 0.3s ease;
}
.comment-tab:hover {
border-color: var(--primary-color);
color: var(--primary-color);
}
.comment-tab.active {
background-color: var(--primary-color);
border-color: var(--primary-color);
color: #fff;
}
.empty-reviews {
text-align: center;
padding: 60px 20px;
color: var(--text-light);
font-size: 16px;
}
.review-item {
background-color: #fff;
padding: 25px;
border-radius: 8px;
}
.review-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 15px;
}
.review-author-info {
display: flex;
align-items: center;
gap: 12px;
}
.review-avatar {
width: 40px;
height: 40px;
border-radius: 50%;
object-fit: cover;
}
.review-author-name {
font-weight: 600;
color: var(--text-color);
font-size: 15px;
}
.review-spec {
font-size: 12px;
color: var(--text-light);
margin-top: 4px;
}
.review-meta {
text-align: right;
}
.review-rating {
color: #ffd43b;
font-size: 16px;
margin-bottom: 5px;
}
.review-date {
font-size: 13px;
color: var(--text-light);
}
.review-content {
margin-bottom: 15px;
}
.review-text {
font-size: 14px;
line-height: 1.6;
color: var(--text-color);
margin-bottom: 15px;
}
.comment-images {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.comment-image {
width: 100px;
height: 100px;
object-fit: cover;
border-radius: 8px;
cursor: pointer;
transition: transform 0.3s ease;
}
.comment-image:hover {
transform: scale(1.05);
}
.merchant-reply {
background-color: var(--bg-gray);
padding: 15px;
border-radius: 8px;
border-left: 3px solid var(--primary-color);
}
.reply-label {
font-weight: 600;
color: var(--primary-color);
font-size: 13px;
margin-bottom: 8px;
}
.reply-content {
font-size: 14px;
line-height: 1.6;
color: var(--text-color);
}
/* Comment Pagination */
#commentPagination {
margin-top: 30px;
}
#commentPagination .pagination {
display: flex;
justify-content: center;
gap: 10px;
align-items: center;
}
#commentPagination .page-btn {
padding: 8px 16px;
background-color: #fff;
border: 1px solid var(--border-color);
border-radius: 6px;
color: var(--text-color);
cursor: pointer;
transition: all 0.3s ease;
font-size: 14px;
}
#commentPagination .page-btn:hover {
border-color: var(--primary-color);
color: var(--primary-color);
}
#commentPagination .page-btn.active {
background-color: var(--primary-color);
border-color: var(--primary-color);
color: #fff;
}
/* Image Preview Modal */
.image-preview-modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.9);
display: flex;
align-items: center;
justify-content: center;
z-index: 10000;
cursor: pointer;
}
.image-preview-modal img {
max-width: 90%;
max-height: 90%;
object-fit: contain;
}
/* Shipping Content */
.shipping-content h3 {
font-size: 18px;
font-weight: 600;
margin-bottom: 15px;
margin-top: 20px;
color: var(--text-color);
}
.shipping-content h3:first-child {
margin-top: 0;
}
.shipping-content p {
font-size: 15px;
line-height: 1.8;
color: var(--text-light);
}
/* Related Products */
.related-products {
padding: 60px 0;
background-color: var(--bg-gray);
}
.related-products .section-title {
font-size: 28px;
font-weight: 700;
margin-bottom: 40px;
text-align: center;
}
.related-products .product-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 30px;
}
/* Responsive Design */
@media (max-width: 1024px) {
.product-detail-wrapper {
grid-template-columns: 1fr;
gap: 40px;
}
.product-gallery {
position: static;
}
.related-products .product-grid {
grid-template-columns: repeat(3, 1fr);
}
}
@media (max-width: 768px) {
.product-name {
font-size: 24px;
}
.price-current {
font-size: 28px;
}
.price-original {
font-size: 18px;
}
.cart-actions {
grid-template-columns: 1fr;
}
.tab-headers {
flex-wrap: wrap;
}
.tab-header {
padding: 12px 20px;
font-size: 14px;
}
.related-products .product-grid {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 480px) {
.quantity-section {
flex-direction: column;
align-items: flex-start;
}
.thumbnail-list {
grid-template-columns: repeat(4, 1fr);
}
.related-products .product-grid {
grid-template-columns: 1fr;
}
}