/* EDSpaces 2025 電子型錄專用樣式 */

/* 變數定義 */
:root {
    --edspace-primary: #1e40af;
    --edspace-secondary: #3b82f6;
    --edspace-accent: #f59e0b;
    --edspace-success: #10b981;
    --edspace-warning: #f59e0b;
    --edspace-danger: #ef4444;
    
    --edspace-bg-primary: #ffffff;
    --edspace-bg-secondary: #f8fafc;
    --edspace-bg-tertiary: #f1f5f9;
    --edspace-bg-dark: #0f172a;
    --edspace-bg-card: #1e293b;
    
    --edspace-text-primary: #0f172a;
    --edspace-text-secondary: #475569;
    --edspace-text-light: #64748b;
    --edspace-text-white: #ffffff;
    --edspace-text-muted: #94a3b8;
    
    --edspace-border: #e2e8f0;
    --edspace-border-light: #f1f5f9;
    --edspace-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --edspace-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --edspace-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --edspace-radius: 12px;
    --edspace-radius-lg: 16px;
    
    --edspace-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 兩欄佈局的設定下移到檔尾（權重更高），避免被其它樣式覆蓋 */

/* 基礎重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--edspace-font);
    line-height: 1.6;
    color: var(--edspace-text-primary);
    background-color: var(--edspace-bg-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.edspace-header {
    background: linear-gradient(135deg, var(--edspace-primary) 0%, var(--edspace-secondary) 100%);
    color: var(--edspace-text-white);
    padding: 24px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--edspace-shadow-lg);
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    height: 60px;
    width: auto;
    filter: brightness(0) invert(1);
}

.brand-info h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--edspace-text-white);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.exhibition-title {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.language-selector select {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: var(--edspace-text-white);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.language-selector select:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.language-selector select:focus {
    outline: none;
    border-color: var(--edspace-accent);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.language-selector select option {
    background: var(--edspace-primary);
    color: var(--edspace-text-white);
    padding: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--edspace-accent) 0%, #f97316 100%);
    color: var(--edspace-text-white);
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px -3px rgba(245, 158, 11, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px -1px rgba(245, 158, 11, 0.3);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--edspace-bg-primary) 0%, var(--edspace-bg-tertiary) 100%);
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="%23e2e8f0" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.hero-text h2 {
    font-size: 48px;
    font-weight: 700;
    color: var(--edspace-text-primary);
    margin-bottom: 20px;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.hero-subtitle {
    font-size: 20px;
    color: var(--edspace-text-secondary);
    margin-bottom: 40px;
    line-height: 1.6;
    font-weight: 400;
}

.exhibition-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--edspace-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--edspace-text-primary);
}

.hero-image {
    text-align: center;
}

.hero-img {
    max-width: 100%;
    height: auto;
    border-radius: var(--edspace-radius-lg);
    box-shadow: var(--edspace-shadow-lg);
}

/* Section Headers */
.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header h2 {
    font-size: 36px;
    font-weight: 700;
    color: var(--edspace-text-primary);
    margin-bottom: 16px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.section-subtitle {
    font-size: 18px;
    color: var(--edspace-text-secondary);
    max-width: 600px;
    margin: 0 auto;
    font-weight: 400;
    line-height: 1.6;
}

/* Company Section */
.company-section {
    padding: 80px 0;
    background: var(--edspace-bg-primary);
}

.company-content {
    max-width: 800px;
    margin: 0 auto;
}

.company-text p {
    font-size: 18px;
    line-height: 1.8;
    color: var(--edspace-text-secondary);
    margin-bottom: 40px;
    text-align: center;
}

.company-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-top: 60px;
}

.feature-item {
    text-align: center;
    padding: 30px 20px;
    background: var(--edspace-bg-secondary);
    border-radius: var(--edspace-radius);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--edspace-shadow-lg);
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.feature-item h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--edspace-primary);
    margin-bottom: 12px;
}

.feature-item p {
    font-size: 14px;
    color: var(--edspace-text-secondary);
    line-height: 1.6;
}

/* Products Section */
.products-section {
    padding: 80px 0;
    background: var(--edspace-bg-secondary);
}

.products-controls {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: none;
    margin-right: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--edspace-border);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--edspace-primary);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--edspace-text-secondary);
}

.view-toggle {
    display: flex;
    gap: 8px;
}

.view-btn {
    padding: 8px 16px;
    border: 2px solid var(--edspace-border);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.view-btn.active,
.view-btn:hover {
    background: var(--edspace-primary);
    color: white;
    border-color: var(--edspace-primary);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.products-grid.list-view {
    grid-template-columns: 1fr;
}

.product-card {
    background: white;
    border-radius: var(--edspace-radius);
    overflow: hidden;
    box-shadow: var(--edspace-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--edspace-shadow-lg);
}

.product-image {
    position: relative;
    height: 250px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.view-btn-overlay {
    background: var(--edspace-accent);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.3s ease;
}

.view-btn-overlay:hover {
    background: #d35400;
}

.product-content {
    padding: 24px;
}

.product-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.feature-tag {
    background: var(--edspace-primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.product-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--edspace-text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.product-code {
    font-size: 14px;
    color: var(--edspace-text-secondary);
    margin-bottom: 12px;
}

.product-description {
    font-size: 14px;
    color: var(--edspace-text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* List View */
.products-grid.list-view .product-card {
    display: flex;
    height: 200px;
}

.products-grid.list-view .product-image {
    width: 200px;
    height: 100%;
    flex-shrink: 0;
}

.products-grid.list-view .product-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Loading and No Products */
.loading-indicator,
.no-products {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--edspace-border);
    border-top: 4px solid var(--edspace-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.no-products-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.no-products h3 {
    font-size: 24px;
    color: var(--edspace-text-secondary);
    margin-bottom: 12px;
}

.no-products p {
    color: var(--edspace-text-light);
}

/* Contact Section */
.contact-section {
    padding: 80px 0;
    background: linear-gradient(135deg, var(--edspace-primary) 0%, var(--edspace-secondary) 100%);
    color: var(--edspace-text-white);
    position: relative;
    overflow: hidden;
}

.contact-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="contactGrid" width="20" height="20" patternUnits="userSpaceOnUse"><path d="M 20 0 L 0 0 0 20" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23contactGrid)"/></svg>');
    opacity: 0.3;
}

.contact-section .section-header h2,
.contact-section .section-header .section-subtitle {
    color: var(--edspace-text-white);
    position: relative;
    z-index: 1;
}

.contact-section .section-header h2 {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.contact-section .section-header .section-subtitle {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.contact-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.contact-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    max-width: 1000px;
    margin: 0 auto;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 32px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--edspace-radius-lg);
    backdrop-filter: blur(15px);
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    min-height: 140px;
}

.contact-item:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.contact-icon {
    font-size: 32px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.contact-details h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--edspace-text-white);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.contact-details p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.contact-details a {
    color: var(--edspace-text-white);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.contact-details a:hover {
    color: var(--edspace-accent);
    text-decoration: underline;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Footer */
.edspace-footer {
    background: var(--edspace-bg-dark);
    color: var(--edspace-text-white);
    padding: 40px 0 20px;
    position: relative;
    overflow: hidden;
}

.edspace-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="footerGrid" width="20" height="20" patternUnits="userSpaceOnUse"><path d="M 20 0 L 0 0 0 20" fill="none" stroke="rgba(255,255,255,0.03)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23footerGrid)"/></svg>');
    opacity: 0.5;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 20px;
}

.footer-logo {
    height: 40px;
    width: auto;
    filter: brightness(0) invert(1);
}

.footer-brand p {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.footer-links {
    display: flex;
    gap: 30px;
}

.footer-links a {
    color: var(--edspace-text-white);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.footer-links a:hover {
    color: var(--edspace-accent);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Product Modal */
.product-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    /* iOS Safari 安全區域支援 */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.product-modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(10px) saturate(1.15);
    -webkit-backdrop-filter: blur(10px) saturate(1.15);
    transition: background 0.25s ease, backdrop-filter 0.25s ease;
}

/* 提高優先權，避免被全站 style.css 的 .modal-overlay 覆蓋 */
#productModal .modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(255, 255, 255, 0.45) !important;
    backdrop-filter: blur(10px) saturate(1.15) !important;
    -webkit-backdrop-filter: blur(10px) saturate(1.15) !important;
    z-index: 0 !important;
    /* 禁止背景滾動 */
    overflow: hidden !important;
    touch-action: none !important;
    -webkit-overflow-scrolling: none !important;
}

#productModal .modal-content {
    position: relative;
    z-index: 1;
    /* 確保內容區域可以獲得焦點 */
    outline: none;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: var(--edspace-radius-lg);
    max-width: 1000px;
    max-height: 90vh;
    max-height: calc(90vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    width: 100%;
    overflow: hidden;
    box-shadow: var(--edspace-shadow-lg);
    /* 確保內容區域可以滾動 */
    display: flex;
    flex-direction: column;
    /* 確保高度計算正確 */
    height: auto;
    min-height: 0;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    z-index: 10000;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    /* 確保按鈕可以正確點擊 */
    pointer-events: auto;
    touch-action: manipulation;
    /* 移除文字，只顯示 X */
    text-indent: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    /* iOS Safari 安全區域支援 - 使用更大的安全邊距 */
    top: calc(20px + env(safe-area-inset-top, 0px));
    right: calc(20px + env(safe-area-inset-right, 0px));
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

.modal-body {
    padding: 40px;
    /* 使用 flex: 1 和 min-height: 0 確保在 flex 容器中正確縮小 */
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    /* 確保內容區域可以滾動 */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* 確保可以獲得焦點 */
    outline: none;
    /* 確保觸摸事件正確處理 */
    touch-action: pan-y;
    /* 自動聚焦時的滾動行為 */
    scroll-behavior: smooth;
    /* 確保內容不會被裁切 */
    box-sizing: border-box;
}

.modal-product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.modal-product-title-section {
    flex: 1;
    min-width: 0;
}

.modal-product-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--edspace-text-primary);
    margin: 0 0 8px 0;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.3;
}

.modal-product-code {
    font-size: 14px;
    color: var(--edspace-text-secondary);
    margin-top: 4px;
}

@media (max-width: 768px) {
    .product-modal {
        padding: 0;
        /* iOS Safari 安全區域支援 */
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .modal-content {
        /* 使用動態視窗高度，避免 iOS Safari 網址列問題 */
        max-height: 100dvh;
        max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        border-radius: 0;
        width: 100%;
        height: 100dvh;
        height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        /* 確保高度正確 */
        display: flex;
        flex-direction: column;
        /* 不添加 padding-top，讓內容從頂部開始 */
        padding-top: 0;
    }
    
    .modal-body {
        /* 移除固定 max-height，使用 flex: 1 自動計算 */
        flex: 1;
        min-height: 0;
        padding-left: 20px;
        padding-right: 20px;
        /* 添加頂部 padding 避免與狀態列和關閉按鈕重疊 */
        /* 狀態列高度約 44px，加上安全區域和足夠的間距 */
        /* 確保商品名稱在狀態列下方：44px(狀態列) + 30px(間距) = 74px，再加上安全區域 */
        /* 使用更大的值確保不會重疊 */
        padding-top: calc(74px + env(safe-area-inset-top, 0px));
        padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
        /* 手機上確保滾動流暢 */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        /* 確保內容不會被裁切 */
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .modal-product-header {
        flex-direction: column;
        align-items: stretch;
        /* 確保商品名稱區域有足夠的頂部空間，避免與狀態列重疊 */
        margin-top: 0;
        padding-top: 0;
    }
    
    .modal-product-title-section {
        width: 100%;
        margin-bottom: 12px;
    }
    
    .modal-product-name {
        font-size: 20px;
    }
    
    .inquiry-heart-button {
        width: 100%;
        justify-content: center;
        padding: 8px 16px;
        font-size: 14px;
        flex-shrink: 0;
    }
    
    .inquiry-heart-button .heart-icon {
        font-size: 18px;
    }
    
    .inquiry-heart-button .heart-text {
        font-size: 12px;
    }
    
    .modal-close {
        /* iOS Safari 安全區域支援 - 確保按鈕在狀態列下方 */
        /* iPhone X 及之後的狀態列高度約 44px，加上安全區域和間距 */
        /* 使用足夠大的值確保按鈕在狀態列下方：44px(狀態列) + 10px(間距) = 54px，再加上安全區域 */
        top: calc(54px + env(safe-area-inset-top, 0px));
        right: calc(10px + env(safe-area-inset-right, 0px));
        width: 44px;
        height: 44px;
        font-size: 24px;
        font-weight: bold;
        line-height: 1;
        /* 提高 z-index 確保在最上層 */
        z-index: 10000;
        /* 增大可點擊區域 */
        min-width: 44px;
        min-height: 44px;
        /* 確保背景足夠明顯 */
        background: rgba(0, 0, 0, 0.5);
    }
    
    /* 確保模態框內容區域可以正確滾動 */
    #productModal .modal-overlay {
        touch-action: none !important;
    }
    
    #productModal .modal-content {
        touch-action: pan-y !important;
    }
    
    #productModal .modal-body {
        touch-action: pan-y !important;
    }
    
    /* 浮動詢樣按鈕 */
    .floating-inquiry-button {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
    
    .floating-inquiry-button .inquiry-icon {
        font-size: 24px;
    }
    
    /* 模態框產品標題區域調整 */
    .modal-product-header {
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .hero-text h2 {
        font-size: 28px;
    }
    
    .section-header h2 {
        font-size: 28px;
    }
    
    .company-features {
        grid-template-columns: 1fr;
    }
    
    .feature-item {
        padding: 20px 15px;
    }
}

/* Responsive Design */
@media (max-width: 1023px) {
    .hero-content {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }
    
    .hero-text h2 {
        font-size: 36px;
    }
    
    .hero-subtitle {
        font-size: 18px;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .products-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        max-width: none;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .products-grid.list-view .product-card {
        flex-direction: column;
        height: auto;
    }
    
    .products-grid.list-view .product-image {
        width: 100%;
        height: 200px;
    }
    
    .contact-info {
        grid-template-columns: 1fr;
    }
}

/* 寬螢幕兩欄（1100px 以上）－最後一張橫跨全寬（放在檔尾以避免覆蓋） */
@media (min-width: 1100px) {
    .contact-info {
        grid-template-columns: repeat(2, minmax(360px, 1fr));
        max-width: 1200px;
        gap: 28px;
    }
    .contact-item { padding: 28px; }
    .contact-item:last-child { grid-column: 1 / -1; }
}

/* 強制覆蓋：Contact 區塊的寬螢幕兩欄（提高選擇器權重，避免其他檔案覆蓋） */
@media (min-width: 1024px) {
    .contact-section .contact-info {
        display: grid;
        grid-template-columns: repeat(2, minmax(360px, 1fr));
        max-width: 1200px;
        gap: 28px;
        margin: 0 auto;
    }
    .contact-section .contact-item {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        padding: 28px;
        height: auto;
        gap: 18px;
    }
    .contact-section .contact-item:last-child { grid-column: 1 / -1; }
    .contact-section .contact-item .contact-icon {
        font-size: 2.3rem;
        width: 48px;
        text-align: center;
        margin: 6px 0 0 0;
    }
    .contact-section .contact-item .contact-details {
        align-items: flex-start;
        text-align: left;
        width: 100%;
    }
}

/* 詢樣功能樣式 */
/* 愛心按鈕（我有興趣） */
.inquiry-heart-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    font-weight: 500;
    color: #64748b;
    flex-shrink: 0;
    white-space: nowrap;
}

.inquiry-heart-button:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: scale(1.05);
}

.inquiry-heart-button.active {
    background: #fef2f2;
    border-color: #ef4444;
    color: #ef4444;
}

.inquiry-heart-button.active .heart-icon {
    filter: none;
}

.inquiry-heart-button .heart-icon {
    font-size: 20px;
    line-height: 1;
    filter: grayscale(100%);
    transition: filter 0.3s ease;
}

.inquiry-heart-button.active .heart-icon {
    filter: none;
}

.inquiry-heart-button .heart-text {
    font-size: 14px;
}

/* 浮動詢樣按鈕 */
.floating-inquiry-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(30, 64, 175, 0.3);
    z-index: 1000;
    transition: all 0.3s ease;
    flex-direction: column;
    gap: 4px;
}

.floating-inquiry-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(30, 64, 175, 0.4);
}

.floating-inquiry-button:active {
    transform: translateY(-2px);
}

.floating-inquiry-button .inquiry-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    min-width: 24px;
}

.floating-inquiry-button .inquiry-icon {
    font-size: 28px;
    line-height: 1;
    color: #ffffff;
}

.floating-inquiry-button:not(:has(.inquiry-badge:not(:empty))) .inquiry-badge {
    display: none;
}

/* 響應式設計 - 浮動詢樣按鈕 */
/* 第二個 @media (max-width: 768px) 已合併到第一個，避免重複定義 */
