/* ===== css/common.css - 共用樣式文件 ===== */

/* 手機版頂部導航區域樣式 */
.mobile-header-actions {
    display: none; /* 默認隱藏 */
}

@media (max-width: 768px) {
    .mobile-header-actions {
        display: flex;
        align-items: center;
        position: absolute;
        top: 0;
        right: 65px; /* 給漢堡按鈕留出空間 */
        height: 60px;
        z-index: 1001;
    }
    
    .mobile-header-actions .cart-icon-container {
        margin-right: 0;
    }
    
    .mobile-header-actions .cart-icon {
        font-size: 22px;
        color: #333;
        position: relative;
    }
    
    .mobile-header-actions .cart-count {
        position: absolute;
        top: -8px;
        right: -8px;
        background-color: #2e7d32; /* 綠色 */
        color: white;
        border-radius: 50%;
        width: 18px;
        height: 18px;
        font-size: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 從手機版選單中隱藏購物車 */
    .mobile-actions .cart-icon-container {
        display: none !important;
    }
}

/* 修復下拉菜單樣式 */
.user-profile {
    position: relative;
}

.user-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    min-width: 10em;
    box-shadow: 0 0.5em 1em rgba(0, 0, 0, 0.2);
    z-index: 1002;
    border-radius: 0.25em;
    overflow: hidden;
}

/* 按鈕基本樣式 */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    border: none;
    line-height: 1;
    white-space: nowrap;
    box-sizing: border-box;
}

.btn-primary {
    background-color: #2e7d32;
    border: 1px solid #2e7d32;
    color: white;
}

.btn-primary:hover {
    background-color: #1b5e20;
    border-color: #1b5e20;
    color: white;
}

.btn-secondary {
    background-color: #2e7d32;
    border: 1px solid #2e7d32;
    color: white;
}

.btn-secondary:hover {
    background-color: #1b5e20;
    border-color: #1b5e20;
    color: white;
}

.btn-outline {
    border: 1px solid #2e7d32;
    background-color: transparent;
    color: #2e7d32;
}

.btn-outline:hover {
    background-color: #2e7d32;
    color: white;
}

/* 載入指示器樣式 */
.loading-indicator {
    width: 100%;
    text-align: center;
    padding: 30px;
    color: #666;
    font-style: italic;
}

.no-products {
    width: 100%;
    text-align: center;
    padding: 30px;
    color: #666;
    font-style: italic;
}

/* 購物車更新動畫 */
.cart-count.update {
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

/* 加入購物車按鈕動畫 */
.add-to-cart-btn.added {
    background-color: #2e7d32;
    color: white;
}

/* 庫存顯示樣式 */
.stock-info {
    font-size: 0.8rem;
    color: #777;
    margin-top: 5px;
}

.low-stock {
    color: #ff6b6b;
    font-weight: 500;
}

.add-to-cart-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Hero區域基本樣式 - 所有頁面通用 */
.hero, .about-hero, .contact-hero, .product-hero {
    background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url('../images/garden-hero-bg.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: white;
    padding: 60px 0;
    min-height: 280px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    text-align: center;
    margin-bottom: 60px;
    width: 100%;
    box-sizing: border-box;
}

/* 添加額外的覆蓋層來確保文字清晰度 */
.hero::before, 
.about-hero::before, 
.contact-hero::before, 
.product-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.hero .container, 
.about-hero .container, 
.contact-hero .container, 
.product-hero .container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

.hero .hero-content,
.about-hero .about-hero-content,
.contact-hero .contact-hero-content,
.product-hero .product-hero-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    width: 100%;
}

.hero h1, .hero h2,
.about-hero h1, .about-hero h2,
.contact-hero h1, .contact-hero h2,
.product-hero h1, .product-hero h2 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
}

.hero p,
.about-hero p,
.contact-hero p,
.product-hero p {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    margin-bottom: 2rem;
    opacity: 0.9;
    line-height: 1.6;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

/* Hero高亮區塊 */
.hero-highlight {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 1em;
    padding: 1.5em;
    margin: 2em auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0.5em 1.5em rgba(0, 0, 0, 0.2);
    max-width: 600px;
}

.hero-highlight p {
    margin-bottom: 0.8em;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    padding: 0;
    background: none;
    border: none;
    backdrop-filter: none;
    border-radius: 0;
}

.hero-highlight p:last-child {
    margin-bottom: 0;
}

.hero-highlight i {
    margin-right: 0.8em;
    color: #4caf50;
    font-size: 1.2em;
    text-shadow: 0 0.1em 0.2em rgba(0, 0, 0, 0.5);
}

/* 產品頁面專用高亮區塊 */
.product-hero-highlight {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 1em;
    padding: 1.5em;
    margin: 2em auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0.5em 1.5em rgba(0, 0, 0, 0.2);
    max-width: 600px;
}

.product-hero-highlight p {
    margin-bottom: 0.8em;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    padding: 0;
    background: none;
    border: none;
    backdrop-filter: none;
    border-radius: 0;
}

.product-hero-highlight p:last-child {
    margin-bottom: 0;
}

.product-hero-highlight i {
    margin-right: 0.8em;
    color: #4caf50;
    font-size: 1.2em;
    text-shadow: 0 0.1em 0.2em rgba(0, 0, 0, 0.5);
}

/* 平板尺寸的優化 */
@media (max-width: 1024px) {
    .hero, .about-hero, .contact-hero, .product-hero {
        padding: 50px 0;
        min-height: 260px;
    }
    
    .hero .container, 
    .about-hero .container, 
    .contact-hero .container, 
    .product-hero .container {
        padding: 0 20px;
    }
    
    .hero .hero-content,
    .about-hero .about-hero-content,
    .contact-hero .contact-hero-content,
    .product-hero .product-hero-content {
        max-width: 80%;
    }
    
    .hero-highlight, .product-hero-highlight {
        padding: 1.2em;
        margin: 1.5em auto;
        max-width: 90%;
    }
}

/* 手機版優化 */
@media (max-width: 768px) {
    .hero, .about-hero, .contact-hero, .product-hero {
        padding: 40px 0;
        min-height: 220px;
        background-attachment: scroll; /* 手機版移除視差效果，提升性能 */
        background-position: center top; /* 確保重要內容可見 */
    }
    
    .hero .container, 
    .about-hero .container, 
    .contact-hero .container, 
    .product-hero .container {
        padding: 0 15px;
    }
    
    .hero .hero-content,
    .about-hero .about-hero-content,
    .contact-hero .contact-hero-content,
    .product-hero .product-hero-content {
        max-width: 95%;
    }
    
    .hero h1, .hero h2,
    .about-hero h1, .about-hero h2,
    .contact-hero h1, .contact-hero h2,
    .product-hero h1, .product-hero h2 {
        margin-bottom: 0.8rem;
    }
    
    .hero p,
    .about-hero p,
    .contact-hero p,
    .product-hero p {
        line-height: 1.5;
        margin-bottom: 1.5rem;
    }
    
    .hero-highlight, .product-hero-highlight {
        padding: 1em;
        margin: 1.2em auto;
        max-width: 95%;
    }
    
    .hero-highlight p, .product-hero-highlight p {
        font-size: 1em;
        flex-direction: row;
        align-items: center;
        text-align: left;
        margin-bottom: 0.6em;
    }
    
    .hero-highlight i, .product-hero-highlight i {
        margin-right: 0.5em;
        margin-bottom: 0;
    }
}

/* 小螢幕手機優化 */
@media (max-width: 480px) {
    .hero, .about-hero, .contact-hero, .product-hero {
        padding: 30px 0;
        min-height: 200px;
        margin-bottom: 40px;
    }
    
    .hero .container, 
    .about-hero .container, 
    .contact-hero .container, 
    .product-hero .container {
        padding: 0 10px;
    }
    
    .hero .hero-content,
    .about-hero .about-hero-content,
    .contact-hero .contact-hero-content,
    .product-hero .product-hero-content {
        max-width: 100%;
    }
    
    .hero h1, .hero h2,
    .about-hero h1, .about-hero h2,
    .contact-hero h1, .contact-hero h2,
    .product-hero h1, .product-hero h2 {
        margin-bottom: 0.6rem;
    }
    
    .hero p,
    .about-hero p,
    .contact-hero p,
    .product-hero p {
        margin-bottom: 1.2rem;
    }
    
    .hero-highlight, .product-hero-highlight {
        padding: 0.8em;
        margin: 1em auto;
    }
}

/* 確保在超大螢幕上內容不會過度拉伸 */
@media (min-width: 1400px) {
    .hero, .about-hero, .contact-hero, .product-hero {
        min-height: 320px;
    }
    
    .hero .container, 
    .about-hero .container, 
    .contact-hero .container, 
    .product-hero .container {
        max-width: 1400px;
    }
    
    .hero .hero-content,
    .about-hero .about-hero-content,
    .contact-hero .contact-hero-content,
    .product-hero .product-hero-content {
        max-width: 700px;
    }
    
    .hero-highlight, .product-hero-highlight {
        max-width: 700px;
    }
}

/* 背景圖片載入優化 */
@media (prefers-reduced-motion: reduce) {
    .hero, .about-hero, .contact-hero, .product-hero {
        background-attachment: scroll; /* 為有動作偏好設定的用戶移除視差 */
    }
}

/* 高解析度螢幕優化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
    .hero, .about-hero, .contact-hero, .product-hero {
        background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url('../images/garden-hero-bg.jpg');
        /* 如果有高解析度版本的背景圖，可以在這裡替換 */
    }
}

/* 提示消息樣式 */
.toast-message {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s;
}

.toast-message.show {
    opacity: 1;
}

/* FAQ相關樣式 */
.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    margin-bottom: 1em;
    border: 1px solid #e0e0e0;
    border-radius: 0.5em;
    overflow: hidden;
}

.faq-question {
    padding: 1em;
    background-color: #f8f8f8;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-question h3 {
    margin: 0;
    font-size: 1em;
}

.faq-toggle {
    font-size: 1em;
    transition: transform 0.3s;
}

.faq-answer {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-answer p {
    padding: 1em;
    margin: 0;
}

.faq-item.active .faq-toggle i {
    transform: rotate(180deg);
}