/* Global Styles */
:root {
    --primary-color: #EC6100;
    --secondary-color: #333;
    --accent-color: #e74c3c;
    --light-gray: #f4f4f4;
    --white: #ffffff;
    --text-color: #333;
    --bg-color: #f9f9f9;
    --shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Header */
header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-top {
    background: var(--secondary-color);
    color: var(--white);
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.header-top a {
    color: var(--white);
}

.header-top a:hover {
    color: var(--light-gray);
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo img {
    height: 50px;
}

.logo-text h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    line-height: 1.2;
}

.logo-text span {
    font-size: 0.9rem;
    color: var(--secondary-color);
}

/* Navigation */
.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    font-weight: 500;
    color: var(--secondary-color);
    padding: 0.5rem 0;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.menu-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--secondary-color);
}

/* Hero Section */
.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('pic/Cata-option-06c.jpg') no-repeat center center/cover;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
    margin-bottom: 2rem;
    position: relative;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    padding: 0 1rem;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 5px;
    font-weight: bold;
}

.btn:hover {
    background: #C85000;
}

/* Features Section */
.features {
    padding: 3rem 2rem;
    background: var(--white);
}

.features-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-card {
    text-align: center;
    padding: 2rem;
    border-radius: 10px;
    background: var(--bg-color);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

/* Product Showcase (Homepage) */
.products {
    padding: 3rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--secondary-color);
    position: relative;
    padding-bottom: 1rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: var(--primary-color);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.product-card {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.product-image {
    height: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.product-info p {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

/* News Section */
.news {
    padding: 3rem 2rem;
    background: var(--light-gray);
}

.news-container {
    max-width: 800px;
    margin: 0 auto;
}

.news-item {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.news-date {
    font-size: 0.85rem;
    color: #888;
    display: block;
    margin-bottom: 0.5rem;
}

.news-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.news-item a {
    color: var(--primary-color);
    font-weight: 500;
    margin-left: 0.5rem;
}

.news-item a:hover {
    text-decoration: underline;
}

/* Footer */
footer {
    background: var(--secondary-color);
    color: var(--white);
    padding: 3rem 2rem 1rem;
    margin-top: 3rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.footer-bottom {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #555;
    font-size: 0.9rem;
}

/* Catalogue Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    gap: 2rem;
}

.sidebar {
    flex: 0 0 250px;
    background: var(--white);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    height: fit-content;
}

.sidebar-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 0.5rem;
}

.sidebar-nav a {
    display: block;
    padding: 0.5rem;
    color: var(--secondary-color);
    border-radius: 5px;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background-color: var(--light-gray);
    color: var(--primary-color);
}

.sidebar-nav ul ul {
    padding-left: 1rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.main-content {
    flex: 1;
    background: var(--white);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.page-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
    border-bottom: 1px solid var(--light-gray);
    padding-bottom: 1rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
    min-width: 600px;
}

.table-responsive table td img {
    max-width: 120px;
    width: auto;
    height: auto;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--light-gray);
}

th {
    background-color: var(--bg-color);
    font-weight: bold;
    color: var(--secondary-color);
}

tr:hover {
    background-color: #f5f5f5;
}

/* Badges & Labels */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
}

.badge-new {
    background-color: #e74c3c;
}

.badge-success {
    background-color: #2ecc71;
}

.badge-secondary {
    background-color: #6c757d;
}

/* Product List in Catalogue */
.catalogue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.catalogue-item {
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: var(--transition);
}

.catalogue-item:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.catalogue-item img {
    max-height: 150px;
    margin: 0 auto 1rem;
}

.catalogue-item h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

/* Mobile Generated Cells & Container - Hidden on Desktop */
.mobile-generated,
.mobile-card-container {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--white);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow);
        z-index: 999;
    }

    .nav-menu.active {
        display: flex;
    }

    .header-main {
        padding: 1rem;
    }

    .hero h2 {
        font-size: 2rem;
    }

    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    /* Hide the original table completely */
    .table-responsive table {
        display: none !important;
    }

    /* Style the new mobile card container */
    .mobile-card-container {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
        padding: 1rem 0;
    }

    .mobile-card {
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        overflow: hidden;
        display: flex;
        flex-direction: column;
        transition: transform 0.2s;
        border: 1px solid #eee;
    }

    .mobile-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    }

    /* Header: Product Name */
    .mobile-card-header {
        background: #f8f9fa;
        padding: 1rem;
        border-bottom: 1px solid #eee;
        text-align: center;
        font-weight: bold;
        font-size: 1.1rem;
        color: #333;
    }

    .mobile-card-header a {
        color: #333;
        text-decoration: none;
    }

    /* Body: Image */
    .mobile-card-body {
        padding: 0.5rem;
        /* Reduced padding */
        text-align: center;
        background: #fff;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .mobile-card-body img {
        width: 100%;
        height: 180px;
        /* Fixed height */
        object-fit: contain;
        /* Ensure image fits */
        max-width: 100% !important;
        /* Override inline styles */
    }

    /* Footer: Variants Grid */
    .mobile-card-variants {
        padding: 0.5rem;
        background: #fff;
        border-top: 1px solid #eee;
        display: block;
        /* Ensure visibility */
    }

    .variant-grid {
        width: 100%;
        font-size: 0.85rem;
    }

    .variant-header {
        background: #f8f9fa;
        padding: 0.4rem;
        text-align: center;
        font-weight: 600;
        color: #555;
    }

    .variant-cell {
        background: #fff;
        padding: 0.4rem;
        text-align: center;
        color: #666;
    }
}