/* Main CSS Stylesheet */

:root {
    --primary: #0d6efd;
    --secondary: #6c757d;
    --success: #198754;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #0dcaf0;
    --light: #f8f9fa;
    --dark: #212529;
    --body-bg: #ffffff;
    --body-color: #212529;
    --link-color: #0d6efd;
    --link-hover-color: #0a58ca;
}

[data-bs-theme="dark"] {
    --body-bg: #212529;
    --body-color: #f8f9fa;
    --link-color: #86b7fe;
    --link-hover-color: #a6c8ff;
}

/* Base Styles */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--body-bg);
    color: var(--body-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

a:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

/* Layout */
.container {
    padding-left: 15px;
    padding-right: 15px;
}

.main-content {
    flex: 1;
}

/* Header */
.header {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.navbar-brand img {
    height: 40px;
}

.search-form {
    position: relative;
}

/* Product Cards */
.product-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.discount-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
    font-size: 0.875rem;
    font-weight: bold;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* Images */
.img-thumbnail {
    transition: border-color 0.2s ease;
}

.img-thumbnail:hover {
    border-color: var(--primary);
    cursor: pointer;
}

/* Buttons */
.btn-floating {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
}

/* Utilities */
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.cursor-pointer {
    cursor: pointer;
}

/* Responsive */
@media (max-width: 767.98px) {
    .navbar-brand img {
        height: 30px;
    }
    
    .product-card {
        margin-bottom: 1.5rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

/* Lazy loading */
.lazyload,
.lazyloading {
    opacity: 1;
}

.lazyloaded {
    opacity: 1;
    transition: opacity 0.3s;
}


/* 缩略图响应式调整 */
@media (max-width: 768px) {
    .product-thumbnails .row {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 15px;
        margin-left: -5px;
        margin-right: -5px;
    }
    
    .product-thumbnails .col-3 {
        flex: 0 0 auto;
        width: 28%;
        padding-left: 5px;
        padding-right: 5px;
    }
}

/* 激活状态高亮 */
.img-thumbnail.active {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.25);
}

/* 多媒体展示区域 */
.media-gallery {
    margin-bottom: 30px;
}

.main-media {
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    overflow: hidden;
}

.media-item {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    display: none;
}

.media-item.active {
    display: block;
}

video.media-item {
    background: #000;
}

/* 缩略图导航 */
.media-thumbnails {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 5px 0;
}

.thumbnail-item {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.thumbnail-item:hover {
    border-color: #ddd;
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
    transition: all 0.3s;
}

.thumbnail-item .video-thumb {
    width: 100%;
    height: 100%;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.thumbnail-item .fa-play {
    font-size: 20px;
}

.thumbnail-item img.active,
.thumbnail-item:hover img {
    opacity: 1;
    border-color: #3498db;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .media-item {
        max-height: 300px;
    }
    
    .media-thumbnails {
        -webkit-overflow-scrolling: touch;
    }
}

/* 限制最大宽度防止拉伸 */
.thumbnail-item img {
    max-width: 100%;
}

/* 居中显示非方形图片 */
.thumbnail-item img {
    object-position: center;
}