/* ============================================== */
/* 1. Global Reset, Variables, and Typography */
/* ============================================== */

:root {
    --color-primary-red: #C8102E;
    /* Canadian Red */
    --color-maple-gold: #AA8A00;
    /* Accent Gold */
    --color-background-light: #F8F8F8;
    /* Soft Grey */
    --color-white: #FFFFFF;
    --font-family-primary: 'Montserrat', sans-serif;
}

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

body {
    font-family: var(--font-family-primary);
    color: #333;
    line-height: 1.6;
    background-color: var(--color-white);
}

h1,
h2,
h3 {
    margin-bottom: 0.5em;
    color: #222;
}

section {
    padding: 60px 5%;
}

a {
    text-decoration: none;
    color: var(--color-primary-red);
    transition: color 0.3s;
}

a:hover {
    text-decoration: underline;
}

/* ============================================== */
/* 2. Header & Navigation Styles */
/* ============================================== */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5%;
    background-color: var(--color-white);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: box-shadow 0.3s, background-color 0.3s;
}

/* Sticky Header 陰影效果 */
header.sticky {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 讓 nav 撐開 logo 與購物車之間的空間 */
header>nav {
    flex: 1;
    margin-left: 40px;
    /* 可依喜好調整 */
}

.logo {
    font-size: 1.5em;
    font-weight: 800;
    color: var(--color-primary-red);
}

/* Desktop nav */
nav ul {
    list-style: none;
    display: flex;
    align-items: center;
}

nav ul li {
    margin-left: 25px;
}

/* 第一個 li 不要左邊距 */
nav ul li:first-child {
    margin-left: 0;
}

nav ul li a {
    color: #555;
    font-weight: 600;
    padding-bottom: 3px;
    text-decoration: none;
}

nav ul li a:hover {
    color: var(--color-primary-red);
    border-bottom: 2px solid var(--color-primary-red);
    text-decoration: none;
}

/* Login / Sign Up 的 li 基本間距 */
.nav-auth {
    margin-left: 15px;
}

/* ✅ 把 Login 那個 li 推到最右邊（Sign Up 會跟在旁邊） */
.nav-auth-login {
    margin-left: auto;
}

.user-actions {
    display: flex;
    align-items: center;
}

.user-actions a {
    margin-left: 20px;
    font-weight: 600;
}

.cart-icon {
    font-size: 1.2em;
}

.header-signup-btn {
    padding: 8px 15px;
    border-radius: 5px;
    margin-left: 10px;
}

/* 漢堡菜單按鈕 - 桌面隱藏 */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 2em;
    color: var(--color-primary-red);
    cursor: pointer;
    z-index: 1001;
}

/* ============================================== */
/* 3. CTA Button Styling */
/* ============================================== */

.cta-button {
    display: inline-block;
    padding: 12px 30px;
    margin-top: 20px;
    border-radius: 5px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: background-color 0.3s, transform 0.2s;
}

.primary-cta {
    background-color: var(--color-primary-red);
    color: var(--color-white);
    border: 2px solid var(--color-primary-red);
}

.primary-cta:hover {
    background-color: #A00C24;
    transform: translateY(-2px);
    text-decoration: none;
}

.secondary-cta {
    background-color: transparent;
    color: var(--color-primary-red);
    border: 2px solid var(--color-primary-red);
}

.secondary-cta:hover {
    background-color: var(--color-primary-red);
    color: var(--color-white);
    text-decoration: none;
}

/* ============================================== */
/* 4. Hero Section Styles */
/* ============================================== */

.hero-section {
    display: flex;
    align-items: center;
    min-height: 80vh;
    padding: 100px 5% 0 5%;
    gap: 40px;
}

.hero-content {
    flex: 1;
    max-width: 50%;
    padding-right: 40px;
}

.hero-content h1 {
    font-size: 3em;
    line-height: 1.1;
    color: var(--color-primary-red);
}

.hero-image {
    flex: 1;
    max-width: 50%;
    height: 350px;
    background-color: #eee;
    border-radius: 10px;
}

/* ============================================== */
/* 5. Featured Snacks Cards */
/* ============================================== */

#featured-snacks {
    text-align: center;
    background-color: var(--color-background-light);
}

.carousel-container {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding: 20px 0;
    margin-bottom: 30px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.carousel-container::-webkit-scrollbar {
    display: none;
}

.snack-card {
    flex: 0 0 280px;
    background-color: var(--color-white);
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    padding: 20px;
    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.snack-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-primary-red);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.snack-card::before {
    content: "[Snack Image Placeholder]";
    display: block;
    height: 120px;
    background-color: #ccc;
    line-height: 120px;
    color: #fff;
    font-size: 1.2em;
    margin-bottom: 15px;
    text-align: center;
    border-radius: 5px;
}

/* ============================================== */
/* 6. Membership Promo Banner */
/* ============================================== */

#membership-cta {
    background-color: var(--color-maple-gold);
    color: #333;
    text-align: center;
    padding: 40px 5%;
}

#membership-cta h2 {
    color: #222;
    margin-bottom: 10px;
}

#membership-cta .cta-button {
    background-color: var(--color-white);
    color: var(--color-primary-red);
    border: 2px solid var(--color-white);
}

/* ============================================== */
/* 7. Footer */
/* ============================================== */

footer {
    background-color: #333;
    color: #ddd;
    padding: 40px 5%;
    text-align: center;
}

.footer-links a {
    color: #ccc;
    margin: 0 15px;
    font-size: 0.9em;
}

/* ============================================== */
/* 8. Modal Pop-up Styles (會員登入彈窗) */
/* ============================================== */

.modal-overlay {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--color-white);
    margin: auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transform: translateY(-50px);
    transition: transform 0.3s ease-in-out;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
    margin: -15px -15px 0 0;
}

.form-group {
    text-align: left;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.full-width-btn {
    width: 100%;
    padding: 15px 0;
    margin-top: 10px;
}

/* ============================================== */
/* 9. Product Page Layout (snacks.html 專用樣式) */
/* ============================================== */

/* 防止主內容被固定 Header 遮住（用在 snacks.html 那邊） */
main.content-padding {
    padding-top: 90px;
}

.page-title-box {
    text-align: center;
    margin-bottom: 40px;
}

.page-title-box h1 {
    font-size: 2.8em;
    color: var(--color-primary-red);
}

/* Product Grid & Card Styles */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    padding: 20px 0;
}

.product-card {
    background-color: var(--color-white);
    border: 3px solid #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s, border-color 0.3s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    border-color: var(--color-primary-red);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.product-image-container {
    width: 100%;
    aspect-ratio: 1 / 1.1;
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--color-background-light);
}

.image-placeholder {
    width: 80%;
    height: 90%;
    background-color: #ddd;
    border: 1px solid #ccc;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 0.9em;
    padding: 10px;
    text-align: center;
}

.product-details {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}

.product-description {
    font-size: 0.9em;
    color: #777;
    margin-bottom: 15px;
    flex-grow: 1;
}

.add-to-box-btn {
    padding: 10px 20px;
    border-radius: 8px;
    text-align: center;
    width: 100%;
    margin-top: auto;
}

/* ============================================== */
/* 10. Scroll Reveal Animations */
/* ============================================== */

.scroll-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================== */
/* 11. RWD - Mobile Styles */
/* ============================================== */

@media (max-width: 768px) {
    header {
        padding: 10px 5%;
        justify-content: space-between;
    }

    header>nav {
        margin-left: 10px;
        flex: 0 1 auto;
    }

    .menu-toggle {
        display: block;
    }

    /* 漢堡 nav */
    #main-nav {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        background-color: var(--color-white);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        padding: 10px 0;
        z-index: 999;
    }

    #main-nav.active {
        display: block;
    }

    #main-nav ul {
        flex-direction: column;
        align-items: flex-start;
    }

    #main-nav ul li {
        margin: 0;
        width: 100%;
    }

    #main-nav ul li a {
        display: block;
        padding: 12px 20px;
        border-bottom: 1px solid #f0f0f0;
        color: #333;
    }

    /* 手機版不要把 Login 推到右邊 */
    #main-nav .nav-auth-login {
        margin-left: 0;
    }

    /* Hero Section RWD */
    .hero-section {
        flex-direction: column;
        text-align: center;
        padding-top: 80px;
        min-height: auto;
    }

    .hero-content,
    .hero-image {
        max-width: 100%;
        padding: 0;
    }

    /* Product Page RWD */
    .product-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
}

@media (max-width: 480px) {

    /* Product Page RWD - 單欄 */
    .product-grid {
        grid-template-columns: 1fr;
    }
}