/**
 * 購物網站前台樣式
 */

/* 基礎設定 */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans TC", sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* 商品卡片 */
.product-card {
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.product-card .card-img-top {
    height: 200px;
    object-fit: cover;
}

.product-card .product-placeholder {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    color: #adb5bd;
    font-size: 3rem;
}

.product-card .badge-sale {
    position: absolute;
    top: 10px;
    left: 10px;
}

.product-card .price-original {
    text-decoration: line-through;
    color: #6c757d;
    font-size: 0.9rem;
}

.product-card .price-sale {
    color: #dc3545;
    font-weight: bold;
}

/* 輪播圖 */
.hero-carousel .carousel-item {
    height: 400px;
    background-color: #f8f9fa;
}

.hero-carousel .carousel-item img {
    object-fit: cover;
    height: 100%;
    width: 100%;
}

.hero-carousel .carousel-caption {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    padding: 20px;
}

/* 分類卡片 */
.category-card {
    transition: transform 0.2s;
    text-decoration: none;
    color: inherit;
}

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

.category-card img {
    height: 150px;
    object-fit: cover;
}

/* 購物車 */
.cart-item {
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 0;
}

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

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
}

.quantity-input {
    width: 60px;
    text-align: center;
}

/* 商品詳情 */
.product-gallery {
    position: relative;
}

.product-gallery .main-image {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    background-color: #f8f9fa;
}

.product-gallery .thumbnails {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.product-gallery .thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.product-gallery .thumbnail:hover,
.product-gallery .thumbnail.active {
    border-color: var(--primary-color);
}

/* 訂單狀態 */
.order-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.order-timeline {
    position: relative;
    padding-left: 30px;
}

.order-timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #dee2e6;
}

.order-timeline .timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.order-timeline .timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #dee2e6;
}

.order-timeline .timeline-item.active::before {
    background-color: var(--success-color);
}

/* 表單樣式 */
.form-floating > label {
    color: #6c757d;
}

/* 空狀態 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
}

/* 頁碼 */
.pagination .page-link {
    color: #333;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 側邊欄篩選 */
.filter-sidebar .form-check {
    padding: 5px 0;
}

.price-range {
    display: flex;
    gap: 10px;
    align-items: center;
}

.price-range input {
    width: 100px;
}

/* 評分星星 */
.rating {
    color: #ffc107;
}

.rating .bi-star {
    color: #dee2e6;
}

/* 響應式調整 */
@media (max-width: 768px) {
    .hero-carousel .carousel-item {
        height: 250px;
    }

    .product-card .card-img-top {
        height: 150px;
    }

    .cart-item img {
        width: 60px;
        height: 60px;
    }
}

/* 載入動畫 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 通知提示 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
}
