/* ====================================
   尼樂斯特預購網 - 暗黑風格主題
   黑色 + 紅色配色
   ==================================== */

/* CSS 變數定義 */
:root {
    --primary-black: #0a0a0a;
    --secondary-black: #1a1a1a;
    --card-black: #242424;
    --border-dark: #333333;
    --primary-red: #dc143c;
    --secondary-red: #ff4757;
    --hover-red: #ff6b7a;
    --accent-red: #8b0000;
    --text-white: #ffffff;
    --text-gray: #b0b0b0;
    --text-light-gray: #888888;
    --success-green: #28a745;
    --warning-orange: #ff8c00;
    --gradient-red: linear-gradient(135deg, #dc143c 0%, #8b0000 100%);
    --gradient-dark: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    --box-shadow: 0 4px 15px rgba(220, 20, 60, 0.3);
    --box-shadow-hover: 0 8px 25px rgba(220, 20, 60, 0.5);
    --transition: all 0.3s ease;
}

/* 全域樣式重設 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans TC', 'Microsoft JhengHei', Arial, sans-serif;
    background: var(--gradient-dark);
    background-attachment: fixed;
    color: var(--text-white);
    line-height: 1.6;
    min-height: 100vh;
}

/* 選取文字樣式 */
::selection {
    background: var(--primary-red);
    color: var(--text-white);
}

/* 滾動條樣式 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--primary-black);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-red);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-red);
}

/* ====================================
   Header 導航列
   ==================================== */
header {
    background: var(--primary-black);
    border-bottom: 2px solid var(--primary-red);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.8);
}

header .logo {
    padding: 8px 0;
    text-align: center;
    background: var(--primary-black);
    border-bottom: 1px solid var(--border-dark);
}

header .logo h1 {
    font-size: 1.4rem;
    font-weight: bold;
    background: var(--gradient-red);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    letter-spacing: 1px;
    margin: 0;
}

header .logo h1::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: var(--primary-red);
    margin: 5px auto 0;
}

nav {
    background: var(--secondary-black);
    padding: 0;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
}

nav ul li {
    position: relative;
}

nav ul li a {
    display: block;
    color: var(--text-gray);
    text-decoration: none;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
}

nav ul li a:hover,
nav ul li a.active {
    color: var(--text-white);
    background: rgba(220, 20, 60, 0.2);
    border-bottom: 2px solid var(--primary-red);
}

nav ul li a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-red);
    transition: var(--transition);
    transform: translateX(-50%);
}

nav ul li a:hover::before {
    width: 100%;
}

/* 會員下拉選單 */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-menu .register-btn {
    background: var(--primary-red);
    color: white !important;
    border-radius: 5px;
    padding: 8px 16px !important;
}

.user-menu .register-btn:hover {
    background: var(--secondary-red);
}

.user-dropdown {
    position: relative;
}

.user-dropdown .user-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    background: transparent;
    border: none;
    color: var(--text-gray);
    font-size: inherit;
    font-family: inherit;
    padding: 0;
    transition: color 0.3s ease;
}

.user-dropdown .user-trigger:hover {
    color: var(--primary-red);
}

.user-dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--secondary-black);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    min-width: 180px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.user-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 手機版點擊觸發的 class */
.user-dropdown .dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown .dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-gray);
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: none !important;
}

.user-dropdown .dropdown-menu a:hover {
    background: rgba(220, 20, 60, 0.2);
    color: var(--text-white);
}

.user-dropdown .dropdown-menu a i {
    width: 18px;
    text-align: center;
}

.user-dropdown .dropdown-menu .admin-link {
    color: var(--warning-orange);
}

.user-dropdown .dropdown-menu .logout-link {
    color: var(--secondary-red);
}

.user-dropdown .dropdown-divider {
    height: 1px;
    background: var(--border-dark);
    margin: 5px 0;
}

/* ====================================
   主要容器
   ==================================== */
.container {
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

main {
    min-height: calc(100vh - 200px);
    padding: 40px 5%;
}

/* ====================================
   標題樣式
   ==================================== */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-white);
    margin-bottom: 20px;
}

main h1 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 15px;
}

main h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: var(--gradient-red);
    border-radius: 2px;
}

h2 {
    font-size: 1.8rem;
    color: var(--secondary-red);
    border-left: 4px solid var(--primary-red);
    padding-left: 15px;
    margin: 30px 0 20px;
}

/* ====================================
   Section 區塊
   ==================================== */
section {
    margin: 50px 0;
    padding: 30px;
    background: var(--secondary-black);
    border-radius: 15px;
    border: 1px solid var(--border-dark);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

/* ====================================
   商品卡片
   ==================================== */
.product-list,
#preorder-products,
#popular-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    padding: 20px 0;
}

.product-card {
    background: var(--card-black);
    border: 1px solid var(--border-dark);
    border-radius: 15px;
    overflow: hidden;
    transition: var(--transition);
    position: relative;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-red);
    opacity: 0;
    transition: var(--transition);
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--box-shadow-hover);
    border-color: var(--primary-red);
}

.product-card:hover::before {
    opacity: 1;
}

.product-card .product-image,
.product-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-dark);
    transition: var(--transition);
}

.product-card:hover img {
    transform: scale(1.05);
}

.product-card .product-info {
    padding: 20px;
}

.product-card .product-name,
.product-card h3 {
    font-size: 1.2rem;
    color: var(--text-white);
    margin-bottom: 10px;
    font-weight: 600;
}

.product-card .product-description,
.product-card p {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 15px;
    line-height: 1.5;
}

.product-card .product-price {
    font-size: 1.4rem;
    color: var(--secondary-red);
    font-weight: bold;
    margin-bottom: 15px;
}

/* 預購標籤 */
.preorder-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--gradient-red);
    color: var(--text-white);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    z-index: 10;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 20, 60, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(220, 20, 60, 0);
    }
}

/* 發售日期標籤 */
.release-date {
    display: inline-block;
    background: rgba(220, 20, 60, 0.2);
    color: var(--secondary-red);
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 0.85rem;
    margin-bottom: 10px;
    border: 1px solid var(--primary-red);
}

/* ====================================
   按鈕樣式
   ==================================== */
.btn,
button,
input[type="submit"] {
    display: inline-block;
    background: var(--gradient-red);
    color: var(--text-white);
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
    box-shadow: 0 4px 15px rgba(220, 20, 60, 0.4);
}

.btn:hover,
button:hover,
input[type="submit"]:hover {
    background: linear-gradient(135deg, #ff4757 0%, #dc143c 100%);
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-hover);
}

.btn:active,
button:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--card-black);
    border: 2px solid var(--primary-red);
}

.btn-secondary:hover {
    background: var(--primary-red);
}

.preorder-button {
    width: 100%;
    margin-top: 10px;
    font-size: 1.1rem;
    padding: 15px;
}

/* ====================================
   商品詳情頁
   ==================================== */
.product-detail {
    max-width: 900px;
    margin: 0 auto;
    background: var(--secondary-black);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border-dark);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.product-detail img {
    width: auto;
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    display: block;
    margin: 20px auto;
    border-radius: 10px;
}

.product-detail h1 {
    padding: 30px 30px 0;
    text-align: left;
}

.product-detail h1::after {
    left: 30px;
    transform: none;
}

.product-detail p {
    padding: 0 30px;
    color: var(--text-gray);
    margin-bottom: 15px;
}

.product-detail p strong {
    color: var(--secondary-red);
}

.product-detail form {
    padding: 20px 30px 30px;
}

.product-detail h2 {
    margin: 20px 30px;
}

/* ====================================
   購物車頁面
   ==================================== */
#cart-items {
    background: var(--secondary-black);
    border-radius: 15px;
    padding: 30px;
    border: 1px solid var(--border-dark);
}

#cart-items ul {
    list-style: none;
}

#cart-items li {
    background: var(--card-black);
    border: 1px solid var(--border-dark);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    transition: var(--transition);
}

#cart-items li:hover {
    border-color: var(--primary-red);
    box-shadow: var(--box-shadow);
}

#cart-items li h2 {
    font-size: 1.2rem;
    color: var(--text-white);
    border: none;
    padding: 0;
    margin: 0;
}

#cart-items li p {
    color: var(--text-gray);
    margin: 5px 0;
}

#cart-items h3 {
    font-size: 1.5rem;
    color: var(--secondary-red);
    text-align: right;
    margin: 20px 0;
    padding-top: 20px;
    border-top: 2px solid var(--border-dark);
}

/* ====================================
   結帳頁面
   ==================================== */
.checkout-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--secondary-black);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid var(--border-dark);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    color: var(--text-gray);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 15px;
    background: var(--card-black) !important;
    border: 2px solid var(--border-dark);
    border-radius: 10px;
    color: var(--text-white) !important;
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 15px rgba(220, 20, 60, 0.3);
}

.form-group input::placeholder {
    color: var(--text-light-gray);
}

.form-group select {
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 15px center !important;
    background-size: 16px !important;
    padding-right: 45px;
}

.form-group select option {
    background: var(--card-black) !important;
    color: var(--text-white) !important;
    padding: 10px;
}

.form-group select option:hover,
.form-group select option:checked {
    background: var(--primary-red) !important;
    color: white !important;
}

/* ====================================
   訂單頁面
   ==================================== */
#orders ul {
    list-style: none;
}

#orders li {
    background: var(--card-black);
    border: 1px solid var(--border-dark);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    transition: var(--transition);
}

#orders li:hover {
    border-color: var(--primary-red);
    box-shadow: var(--box-shadow);
}

#orders li h2 {
    font-size: 1.1rem;
    color: var(--secondary-red);
    border: none;
    padding: 0;
    margin-bottom: 15px;
}

#orders li p {
    color: var(--text-gray);
    margin: 8px 0;
}

/* 訂單狀態標籤 */
.order-status {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.order-status.pending {
    background: rgba(255, 140, 0, 0.2);
    color: var(--warning-orange);
    border: 1px solid var(--warning-orange);
}

.order-status.completed {
    background: rgba(40, 167, 69, 0.2);
    color: var(--success-green);
    border: 1px solid var(--success-green);
}

.order-status.processing {
    background: rgba(220, 20, 60, 0.2);
    color: var(--secondary-red);
    border: 1px solid var(--primary-red);
}

/* ====================================
   分類標籤
   ==================================== */
.category-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
    justify-content: center;
}

.category-tag {
    background: var(--card-black);
    color: var(--text-gray);
    padding: 10px 20px;
    border-radius: 25px;
    border: 2px solid var(--border-dark);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

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

/* ====================================
   Footer 頁尾
   ==================================== */
footer {
    background: linear-gradient(180deg, var(--secondary-black) 0%, var(--primary-black) 100%);
    border-top: 3px solid var(--primary-red);
    padding: 40px 5%;
    margin-top: 50px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-content p {
    color: var(--text-gray);
    margin-bottom: 20px;
}

.footer-links {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 30px;
}

.footer-links li a {
    color: var(--text-gray);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
}

.footer-links li a:hover {
    color: var(--secondary-red);
}

/* ====================================
   Hero Banner 橫幅
   ==================================== */
.hero-banner {
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.3) 0%, rgba(10, 10, 10, 0.9) 100%),
                url('/images/hero-bg.jpg') center/cover no-repeat;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 20px;
    margin-bottom: 40px;
    padding: 60px 20px;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.8);
}

.hero-content h1::after {
    display: none;
}

.hero-content p {
    font-size: 1.3rem;
    color: var(--text-gray);
    margin-bottom: 30px;
}

/* ====================================
   載入動畫
   ==================================== */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-dark);
    border-top: 4px solid var(--primary-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ====================================
   提示訊息
   ==================================== */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background: rgba(40, 167, 69, 0.2);
    color: var(--success-green);
    border: 1px solid var(--success-green);
}

.alert-error {
    background: rgba(220, 20, 60, 0.2);
    color: var(--secondary-red);
    border: 1px solid var(--primary-red);
}

.alert-warning {
    background: rgba(255, 140, 0, 0.2);
    color: var(--warning-orange);
    border: 1px solid var(--warning-orange);
}

/* ====================================
   空狀態
   ==================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-gray);
}

.empty-state i {
    font-size: 4rem;
    color: var(--border-dark);
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

/* ====================================
   RWD 響應式設計
   ==================================== */
@media (max-width: 1024px) {
    .product-list,
    #preorder-products,
    #popular-products {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

/* 手機版會員選單遮罩 */
.mobile-menu-overlay {
    display: none;
}

/* 手機版底部選單 */
.mobile-dropdown-menu {
    display: none;
}

@media (max-width: 768px) {
    /* 手機版選單遮罩 */
    .mobile-menu-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .mobile-menu-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    /* 手機版底部選單 */
    .mobile-dropdown-menu {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--secondary-black);
        border-top: 2px solid var(--primary-red);
        border-radius: 20px 20px 0 0;
        z-index: 9999;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        padding: 10px 0;
        max-height: 70vh;
        overflow-y: auto;
    }

    .mobile-dropdown-menu.show {
        transform: translateY(0);
    }

    .mobile-dropdown-menu a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 16px 24px;
        color: var(--text-gray);
        text-decoration: none;
        font-size: 1rem;
        border-bottom: 1px solid var(--border-dark);
        transition: all 0.2s ease;
    }

    .mobile-dropdown-menu a:last-child {
        border-bottom: none;
    }

    .mobile-dropdown-menu a:hover,
    .mobile-dropdown-menu a:active {
        background: rgba(220, 20, 60, 0.2);
        color: var(--text-white);
    }

    .mobile-dropdown-menu a i {
        width: 20px;
        text-align: center;
        color: var(--primary-red);
    }

    .mobile-dropdown-menu .admin-link {
        color: var(--warning-orange);
    }

    .mobile-dropdown-menu .admin-link i {
        color: var(--warning-orange);
    }

    .mobile-dropdown-menu .logout-link {
        color: var(--secondary-red);
    }

    .mobile-dropdown-menu .logout-link i {
        color: var(--secondary-red);
    }

    .mobile-dropdown-menu .dropdown-divider {
        height: 1px;
        background: var(--border-dark);
        margin: 8px 0;
    }
}

@media (max-width: 768px) {
    /* Header 調整 */
    header .logo h1 {
        font-size: 0.95rem;
        padding: 5px 10px;
    }

    header .logo h1::after {
        width: 40px;
        margin-top: 3px;
    }

    /* 導航列 - 橫向滾動 */
    nav {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }

    nav ul {
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding: 0 10px;
        min-width: max-content;
    }

    nav ul li a {
        padding: 10px 12px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* 會員選單 */
    .user-menu {
        flex-direction: row;
        gap: 5px;
    }

    .user-menu .register-btn {
        padding: 6px 10px !important;
        font-size: 0.8rem;
    }

    /* 手機版下拉選單 - 從底部滑出 */
    .user-dropdown {
        position: static;
    }

    .user-dropdown .dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        overflow-y: auto;
        opacity: 0;
        visibility: hidden;
        z-index: 9999;
    }

    /* 手機版禁用 hover 效果 */
    .user-dropdown:hover .dropdown-menu {
        transform: translateY(100%);
        opacity: 0;
        visibility: hidden;
    }

    /* 手機版只用點擊觸發 */
    .user-dropdown .dropdown-menu.show {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
    }

    .user-dropdown .dropdown-menu a {
        padding: 16px 20px;
        font-size: 1rem;
        border-bottom: 1px solid var(--border-dark);
    }

    .user-dropdown .dropdown-menu a:last-child {
        border-bottom: none;
    }

    /* 主內容 */
    main {
        padding: 15px 3%;
    }

    main h1 {
        font-size: 1.5rem;
        margin-bottom: 25px;
    }

    main h1::after {
        width: 60px;
        height: 3px;
    }

    h2 {
        font-size: 1.2rem;
        padding-left: 10px;
        margin: 20px 0 15px;
    }

    /* Section 區塊 */
    section {
        margin: 25px 0;
        padding: 20px 15px;
        border-radius: 12px;
    }

    /* Hero Banner */
    .hero-banner {
        min-height: 280px;
        padding: 40px 15px;
        border-radius: 15px;
        margin-bottom: 25px;
    }

    .hero-content h1 {
        font-size: 1.4rem;
        line-height: 1.4;
    }

    .hero-content p {
        font-size: 0.85rem;
        line-height: 1.6;
    }

    .hero-content .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    /* 分類標籤 */
    .category-tags {
        gap: 8px;
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
    }

    .category-tag {
        padding: 8px 14px;
        font-size: 0.8rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* 商品卡片 */
    .product-list,
    #preorder-products,
    #popular-products {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .product-card {
        border-radius: 12px;
    }

    .product-card .product-image,
    .product-card img {
        height: 160px;
    }

    .product-card .product-info {
        padding: 12px;
    }

    .product-card .product-name,
    .product-card h3 {
        font-size: 0.9rem;
        line-height: 1.3;
        margin-bottom: 5px;
        /* 限制兩行 */
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .product-card .product-description,
    .product-card p {
        font-size: 0.75rem;
        margin-bottom: 8px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .product-card .product-price {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }

    .product-card .release-date {
        font-size: 0.7rem;
        padding: 4px 8px;
    }

    .product-card .preorder-deadline {
        font-size: 0.7rem !important;
    }

    .product-card .product-category {
        font-size: 0.7rem !important;
    }

    /* 預購標籤 */
    .preorder-badge {
        top: 8px;
        right: 8px;
        padding: 4px 10px;
        font-size: 0.65rem;
    }

    /* 按鈕 */
    .btn,
    button,
    input[type="submit"] {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .preorder-button {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    /* 商品詳情頁 */
    .product-detail {
        border-radius: 15px;
        margin: 0 -3%;
        width: calc(100% + 6%);
    }

    .product-detail img {
        max-height: 280px;
        margin: 15px auto;
    }

    .product-detail h1 {
        font-size: 1.3rem;
        padding: 20px 20px 0;
    }

    .product-detail h1::after {
        left: 20px;
    }

    .product-detail p {
        padding: 0 20px;
        font-size: 0.9rem;
    }

    .product-detail h2 {
        margin: 15px 20px;
        font-size: 1.1rem;
    }

    .product-detail form {
        padding: 15px 20px 20px;
    }

    .product-detail .release-date,
    .product-detail .preorder-deadline {
        font-size: 0.85rem !important;
    }

    /* 購物車 */
    .checkout-container {
        padding: 20px 15px;
        border-radius: 15px;
    }

    #cart-items {
        padding: 15px;
    }

    #cart-items li {
        flex-direction: column;
        text-align: center;
        padding: 15px;
        gap: 10px;
    }

    #cart-items li h2 {
        font-size: 1rem;
    }

    /* 表單 */
    .form-group {
        margin-bottom: 20px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px;
        font-size: 0.95rem;
    }

    /* 訂單 */
    #orders li {
        padding: 18px;
    }

    /* 關於我們區塊 */
    section > div[style*="grid-template-columns"] {
        gap: 20px !important;
    }

    section > div[style*="grid-template-columns"] > div {
        padding: 15px;
    }

    section > div[style*="grid-template-columns"] i {
        font-size: 2rem !important;
        margin-bottom: 10px !important;
    }

    section > div[style*="grid-template-columns"] h3 {
        font-size: 1rem;
        margin-bottom: 8px;
    }

    section > div[style*="grid-template-columns"] p {
        font-size: 0.85rem;
    }

    /* Footer */
    footer {
        padding: 30px 4%;
    }

    .footer-links {
        gap: 15px;
    }

    .footer-links li a {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    /* 極小螢幕額外調整 */
    header .logo h1 {
        font-size: 0.8rem;
    }

    nav ul li a {
        padding: 8px 10px;
        font-size: 0.75rem;
    }

    nav ul li a i {
        display: none;  /* 隱藏導航圖示節省空間 */
    }

    #cart-count {
        padding: 1px 5px !important;
        font-size: 0.7rem !important;
    }

    main h1 {
        font-size: 1.3rem;
    }

    h2 {
        font-size: 1.1rem;
    }

    /* Hero */
    .hero-banner {
        min-height: 220px;
        padding: 30px 10px;
    }

    .hero-content h1 {
        font-size: 1.2rem;
    }

    .hero-content h1 i {
        display: block;
        margin-bottom: 8px;
    }

    .hero-content p {
        font-size: 0.75rem;
    }

    /* 商品卡片 - 單欄或雙欄 */
    .product-list,
    #preorder-products,
    #popular-products {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-card .product-image,
    .product-card img {
        height: 130px;
    }

    .product-card .product-info {
        padding: 10px;
    }

    .product-card .product-name,
    .product-card h3 {
        font-size: 0.8rem;
    }

    .product-card .product-price {
        font-size: 0.95rem;
    }

    .preorder-button {
        padding: 8px 10px;
        font-size: 0.75rem;
    }

    /* 商品詳情 */
    .product-detail img {
        max-height: 220px;
    }

    .product-detail h1 {
        font-size: 1.15rem;
        padding: 15px 15px 0;
    }

    .product-detail p {
        padding: 0 15px;
        font-size: 0.85rem;
    }

    /* 相關商品 */
    .product-list[style*="220px"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* 分類標籤 */
    .category-tag {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    /* Footer */
    .footer-links {
        flex-direction: column;
        gap: 12px;
    }

    .footer-content p {
        font-size: 0.85rem;
    }
    
    /* 購物車手機版優化 */
    .cart-item-mobile {
        background: var(--card-black);
        border: 1px solid var(--border-dark);
        border-radius: 12px;
        padding: 15px;
        margin-bottom: 15px;
    }
    
    /* 結帳頁面手機版 */
    .checkout-grid {
        display: flex !important;
        flex-direction: column !important;
    }
    
    .checkout-grid section {
        padding: 15px !important;
    }
    
    .checkout-grid section h2 {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }
    
    /* 訂單摘要手機版 */
    .order-item-mobile {
        display: flex;
        gap: 12px;
        padding: 12px 0;
        border-bottom: 1px solid var(--border-dark);
        align-items: flex-start;
    }
    
    .order-item-mobile:last-child {
        border-bottom: none;
    }
    
    .order-item-mobile img {
        width: 60px;
        height: 60px;
        object-fit: cover;
        border-radius: 6px;
        flex-shrink: 0;
    }
    
    .order-item-mobile .item-info {
        flex: 1;
        min-width: 0;
    }
    
    .order-item-mobile .item-name {
        font-size: 0.9rem;
        color: var(--text-white);
        margin-bottom: 4px;
        line-height: 1.3;
        word-break: break-word;
    }
    
    .order-item-mobile .item-qty {
        font-size: 0.8rem;
        color: var(--text-gray);
    }
    
    .order-item-mobile .item-price {
        color: var(--secondary-red);
        font-weight: 600;
        font-size: 0.95rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* 橫向手機 (landscape) */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-banner {
        min-height: 200px;
        padding: 25px 15px;
    }

    .product-list,
    #preorder-products,
    #popular-products {
        grid-template-columns: repeat(3, 1fr);
    }

    .product-card .product-image,
    .product-card img {
        height: 140px;
    }
}