﻿/* Global Styles */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #2c3e50;
    --accent-color: #e74c3c;
    --text-color: #333;
    --light-text: #666;
    --bg-color: #f9f9f9;
    --white: #ffffff;
    --border-color: #eee;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --hover-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    font-weight: 500;
    font-size: 16px;
    color: var(--text-color);
}

.nav-links a:hover {
    color: var(--accent-color);
}

.nav-icons {
    display: flex;
    gap: 20px;
    align-items: center;
}

.cart-icon {
    position: relative;
    font-size: 20px;
    cursor: pointer;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--accent-color);
    color: var(--white);
    font-size: 12px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
}

/* Hero Section */
.hero {
    background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)), url('https://images.unsplash.com/photo-1441986300917-64674bd600d8?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80');
    background-size: cover;
    background-position: center;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--white);
    margin-bottom: 40px;
}

.hero h1 {
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero p {
    font-size: 18px;
    margin-bottom: 30px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Product Grid */
.section-title {
    text-align: center;
    font-size: 32px;
    margin-bottom: 40px;
    color: var(--primary-color);
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background-color: var(--accent-color);
    margin: 10px auto 0;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.product-card {
    background-color: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
}

.product-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background-color: #f0f0f0;
}

.product-info {
    padding: 20px;
}

.product-category {
    font-size: 12px;
    color: var(--light-text);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.product-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 15px;
}

.add-to-cart-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.add-to-cart-btn:hover {
    background-color: #34495e;
}

/* Cart Page */
.cart-container {
    background-color: var(--white);
    padding: 40px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-top: 40px;
    margin-bottom: 60px;
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.cart-table th {
    text-align: left;
    padding: 15px;
    border-bottom: 2px solid var(--border-color);
    color: var(--light-text);
    font-weight: 600;
}

.cart-table td {
    padding: 20px 15px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.cart-product {
    display: flex;
    align-items: center;
    gap: 20px;
}

.cart-product img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
}

.quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    width: fit-content;
}

.qty-btn {
    background: none;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    color: var(--text-color);
}

.qty-input {
    width: 40px;
    text-align: center;
    border: none;
    font-weight: 600;
}

.remove-btn {
    color: #e74c3c;
    cursor: pointer;
    font-size: 20px;
}

.cart-summary {
    display: flex;
    justify-content: flex-end;
}

.summary-box {
    width: 300px;
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 16px;
}

.summary-row.total {
    font-weight: 700;
    font-size: 20px;
    border-top: 1px solid #ddd;
    padding-top: 15px;
    color: var(--primary-color);
}

.checkout-btn {
    width: 100%;
    padding: 15px;
    background-color: var(--accent-color);
    color: var(--white);
    border: none;
    border-radius: 5px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 20px;
}

.checkout-btn:hover {
    background-color: #c0392b;
}

/* Product Detail Page */
.product-detail-container {
    background-color: var(--bg-color);
    padding: 30px 0 60px;
}

/* Breadcrumb Navigation */
.product-breadcrumb {
    font-size: 14px;
    color: var(--light-text);
    margin-bottom: 25px;
    padding: 12px 0;
}

.product-breadcrumb a {
    color: var(--primary-color);
    transition: var(--transition);
}

.product-breadcrumb a:hover {
    color: var(--accent-color);
}

.product-breadcrumb span {
    color: var(--text-color);
}

/* Main Product Grid */
.product-detail-grid {
    display: grid;
    grid-template-columns: 500px 1fr;
    gap: 50px;
    background-color: var(--white);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}

/* Product Gallery - Left Side */
.product-gallery {
    position: sticky;
    top: 100px;
    align-self: flex-start;
}

.main-image-container {
    width: 100%;
    aspect-ratio: 1;
    background-color: #fafafa;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e8e8e8;
    margin-bottom: 15px;
}

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

.main-product-image:hover {
    transform: scale(1.05);
}

.thumbnail-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.thumbnail-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid #e8e8e8;
    transition: var(--transition);
    opacity: 0.7;
}

.thumbnail-image:hover {
    opacity: 1;
    border-color: var(--primary-color);
}

.thumbnail-image.active {
    opacity: 1;
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

/* Product Info Section - Right Side */
.product-info-section {
    padding: 10px 0;
}

.product-detail-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.4;
    margin: 0 0 25px 0;
    letter-spacing: -0.5px;
}

/* Product Pricing */
.product-pricing {
    display: flex;
    align-items: baseline;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f5f5f5;
}

.price-sale {
    font-size: 34px;
    font-weight: 700;
    color: var(--accent-color);
    letter-spacing: -1px;
}

.price-original {
    font-size: 20px;
    color: #999;
    text-decoration: line-through;
}

.price-main {
    font-size: 34px;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -1px;
}

/* Product Brief Description */
.product-brief {
    margin-bottom: 25px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.product-brief p {
    color: var(--text-color);
    line-height: 1.8;
    font-size: 15px;
    margin: 0;
}

/* Product Meta Info */
.product-meta {
    margin-bottom: 25px;
}

.stock-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
}

.stock-status i {
    font-size: 16px;
}

.stock-status.in-stock {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.stock-status.out-of-stock {
    background-color: #ffebee;
    color: #c62828;
}

/* Quantity Selector */
.quantity-selector {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.quantity-selector label {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-color);
    min-width: 50px;
}

.quantity-selector .quantity-control {
    display: flex;
    align-items: center;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--white);
}

.quantity-selector .qty-btn {
    padding: 12px 18px;
    font-size: 18px;
    font-weight: 700;
    background-color: var(--white);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    color: var(--primary-color);
    min-width: 45px;
}

.quantity-selector .qty-btn:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

.quantity-selector .qty-input {
    width: 70px;
    padding: 12px 10px;
    text-align: center;
    border: none;
    border-left: 2px solid #e0e0e0;
    border-right: 2px solid #e0e0e0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

/* Product Action Buttons */
.product-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
}

.product-actions button {
    flex: 1;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

.product-actions button i {
    font-size: 18px;
}

.add-to-cart-btn {
    background-color: var(--primary-color);
    color: var(--white);
    box-shadow: 0 4px 6px rgba(44, 62, 80, 0.2);
}

.add-to-cart-btn:hover {
    background-color: #1a252f;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(44, 62, 80, 0.3);
}

.buy-now-btn {
    background-color: var(--accent-color);
    color: var(--white);
    box-shadow: 0 4px 6px rgba(231, 76, 60, 0.2);
}

.buy-now-btn:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(231, 76, 60, 0.3);
}

.add-to-cart-btn.out-of-stock,
.add-to-cart-btn:disabled {
    background-color: #bbb;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.add-to-cart-btn.out-of-stock:hover,
.add-to-cart-btn:disabled:hover {
    transform: none;
    background-color: #bbb;
}

/* Product Tags / Trust Signals */
.product-tags {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.tag-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--light-text);
}

.tag-item i {
    font-size: 16px;
    color: var(--primary-color);
}

/* Product Description Section */
.product-description-section {
    background-color: var(--white);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.product-description-section .section-title {
    text-align: left;
    font-size: 24px;
    margin-bottom: 30px;
}

.product-description-section .section-title::after {
    margin: 10px 0 0;
}

.product-description-content {
    line-height: 1.8;
    color: var(--text-color);
    font-size: 15px;
}

.product-description-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 25px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.product-description-content h2,
.product-description-content h3 {
    color: var(--primary-color);
    margin-top: 30px;
    margin-bottom: 15px;
}

.product-description-content p {
    margin-bottom: 15px;
}

.product-description-content ul,
.product-description-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

/* Responsive Design for Product Detail */
@media (max-width: 1024px) {
    .product-detail-grid {
        grid-template-columns: 400px 1fr;
        gap: 35px;
        padding: 30px;
    }
}

@media (max-width: 768px) {
    .product-detail-container {
        padding: 20px 0 40px;
    }

    .product-breadcrumb {
        font-size: 13px;
        margin-bottom: 15px;
    }

    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 25px 20px;
    }

    .product-gallery {
        position: static;
    }

    .main-image-container {
        margin-bottom: 12px;
    }

    .thumbnail-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .product-detail-title {
        font-size: 22px;
        margin-bottom: 18px;
    }

    .price-sale,
    .price-main {
        font-size: 28px;
    }

    .price-original {
        font-size: 18px;
    }

    .product-brief {
        padding: 15px;
        margin-bottom: 20px;
    }

    .product-actions {
        flex-direction: column;
        gap: 10px;
    }

    .product-actions button {
        width: 100%;
        padding: 14px 20px;
    }

    .product-tags {
        padding: 15px;
    }

    .product-description-section {
        padding: 25px 20px;
    }
}

@media (max-width: 480px) {
    .product-detail-title {
        font-size: 20px;
    }

    .price-sale,
    .price-main {
        font-size: 24px;
    }

    .thumbnail-container {
        grid-template-columns: repeat(3, 1fr);
    }

    .quantity-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 60px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h3 {
    font-size: 18px;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.footer-col h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 30px;
    height: 2px;
    background-color: var(--accent-color);
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col ul li a {
    color: #bdc3c7;
}

.footer-col ul li a:hover {
    color: var(--white);
    padding-left: 5px;
}

.copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #bdc3c7;
    font-size: 14px;
}

/* Carousel Styles */
.carousel-container {
    position: relative;
    width: 100%;
    height: 500px;
    overflow: hidden;
    margin-bottom: 40px;
}

.carousel-slides {
    width: 100%;
    height: 100%;
    position: relative;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.carousel-slide.active {
    opacity: 1;
    z-index: 1;
}

.carousel-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.carousel-content {
    position: relative;
    z-index: 2;
    color: var(--white);
    max-width: 800px;
    padding: 20px;
    animation: fadeInUp 1s ease-out;
}

.carousel-content h1 {
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
}

.carousel-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.prev-btn {
    left: 20px;
}

.next-btn {
    right: 20px;
}

.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.indicator {
    width: 12px;
    height: 12px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.indicator.active {
    background-color: var(--white);
    transform: scale(1.2);
}

/* Category Navigation */
.category-nav-container {
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    position: sticky;
    top: 80px;
    z-index: 900;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.category-nav {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 5px;
    padding-bottom: 10px; /* Increased padding for scrollbar space */
}

/* Custom Scrollbar for Category Nav */
.category-nav::-webkit-scrollbar {
    height: 6px;
}

.category-nav::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.category-nav::-webkit-scrollbar-thumb {
    background: #ccc; /* Use a neutral color or var(--primary-color) opacity */
    border-radius: 10px;
}

.category-nav::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.category-link {
    font-size: 16px;
    color: var(--light-text);
    padding: 8px 16px;
    border-radius: 20px;
    transition: var(--transition);
    border: 1px solid transparent;
}

.category-link:hover,
.category-link.active {
    color: var(--white);
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Responsive - Mobile (768px and below) */
@media (max-width: 768px) {
    .navbar {
        height: auto;
        padding: 15px 0;
        flex-direction: column;
        gap: 15px;
    }

    .nav-links {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-links a {
        font-size: 14px;
    }

    .hero {
        height: 300px;
    }

    .hero h1 {
        font-size: 28px;
    }

    .hero p {
        font-size: 16px;
    }

    .carousel-container {
        height: 350px;
    }

    .carousel-content h1 {
        font-size: 32px;
    }

    .carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .category-nav {
        gap: 10px;
    }

    .category-link {
        font-size: 14px;
        padding: 6px 12px;
    }

    /* Product Grid - Force 2 columns */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .product-image {
        height: 180px;
    }

    .product-info {
        padding: 12px;
    }

    .product-category {
        font-size: 10px;
    }

    .product-title {
        font-size: 14px;
    }

    .product-price {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .add-to-cart-btn {
        padding: 10px 8px;
        font-size: 13px;
    }

    .cart-container {
        padding: 20px;
    }

    .cart-product {
        flex-direction: column;
        align-items: flex-start;
    }

    .summary-box {
        width: 100%;
    }
}

/* Extra small devices - Portrait mode (480px and below) */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-image {
        height: 150px;
    }

    .product-info {
        padding: 10px;
    }

    .product-category {
        font-size: 9px;
    }

    .product-title {
        font-size: 13px;
        margin-bottom: 5px;
    }

    .product-price {
        font-size: 15px;
        margin-bottom: 8px;
    }

    .add-to-cart-btn {
        padding: 8px 6px;
        font-size: 12px;
        gap: 5px;
    }

    .section-title {
        font-size: 24px;
    }

    .nav-links a {
        font-size: 13px;
    }
}