/* 按鈕通用樣式 - 針對手機觸控優化 */
.btn {
    display: block;
    width: 100%;           /* 寬度撐滿，好點擊 */
    max-width: 270px;
    margin: 1rem auto;
    padding: 15px;         /* 增加高度，適合手指點擊 */
    background-color: #e67e22;
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
}

.btn-sm {
    padding: 8px 15px;
    background-color: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 5px;
}

/* 讓表單元件在手機上看起來更現代 */
input, select {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;       /* 防止 iPhone 自動放大畫面 */
}

/* 電腦版預設 */
header img {
    width: 300px;
    height: auto;
}

/* 當螢幕寬度小於 480px (手機版) */
@media (max-width: 480px) {
    header img {
        width: 250px; 
    }
}
/* 容器基本設定 */
.product-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 卡片主體：設定為垂直排列 */
.product-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    flex-direction: column; /* 讓內容由上而下排列 */
    justify-content: flex-start;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

/* 商品資訊列：讓標題和價格分左右 */
.product-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.product-info h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
}

.product-info p {
    margin: 5px 0 0 0;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.price-tag {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2c3e50;
}

/* 計數器（Stepper）樣式優化 */
.stepper {
    display: flex;
    align-items: center;
    justify-content: center; /* 置中 */
    gap: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px;
    
    /* 核心：預設隱藏與動畫 */
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease-out;
    margin-top: 0;
}

/* 被選中時的狀態 */
.product-card.active {
    border-color: #2c3e50;
    background-color: #fdfdfd;
}

.product-card.active .stepper {
    opacity: 1;
    visibility: visible;
    max-height: 60px; /* 展開高度 */
    margin-top: 15px;
}

/* 按鈕與輸入框優化 */
.stepper button {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.count-input {
    width: 50px;
    text-align: center;
    border: 1px solid #eee;
    background: white;
    font-weight: bold;
    border-radius: 4px;
    padding: 5px;
}

/* 推薦標籤 */
.badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #2c3e50;
    color: white;
    font-size: 0.7rem;
    padding: 4px 12px;
    border-bottom-left-radius: 12px;
}