﻿/* =========================================
   ClinicOS Contact Page Styles
   ========================================= */

:root {
    --contact-primary: #0ea5a4;
    --contact-primary-dark: #0f766e;
    --contact-bg-light: #f8fafc;
    --contact-text: #1e293b;
    --contact-text-muted: #64748b;
    --border-color: #e2e8f0;
}

/* 頁面容器 */
.contact-section {
    padding: 20px 0;
    background-color: var(--contact-bg-light);
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 0;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.08);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.02);
}

/* --- 左側資訊區 --- */
.contact-info {
    position: relative;
    padding: 60px 50px;
    background: linear-gradient(135deg, #f0fdfa 0%, #ffffff 100%);
    border-right: 1px solid rgba(0,0,0,0.03);
}

/* 裝飾圓形 */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    z-index: 0;
    opacity: 0.6;
}

.shape-1 {
    width: 300px;
    height: 300px;
    background: rgba(14, 165, 164, 0.15);
    top: -50px;
    left: -50px;
}

.shape-2 {
    width: 250px;
    height: 250px;
    background: rgba(15, 118, 110, 0.1);
    bottom: -50px;
    right: -50px;
}

.info-content-layer {
    position: relative;
    z-index: 1;
}

.badge-solution {
    display: inline-block;
    padding: 6px 14px;
    background-color: #fff;
    color: var(--contact-primary);
    font-weight: 700;
    font-size: 17px;
    border-radius: 50px;
    margin-left: 10px;
    margin-bottom: 24px;
    letter-spacing: 1px;
    border: 1px solid rgba(14, 165, 164, 0.15);
}

.page-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--contact-text);
    line-height: 1.3;
    margin-bottom: 16px;
}

.highlight-text {
    color: var(--contact-primary);
    position: relative;
    display: inline-block;
}

    .highlight-text::after {
        content: '';
        position: absolute;
        bottom: 4px;
        left: 0;
        width: 100%;
        height: 8px;
        background-color: rgba(14, 165, 164, 0.15);
        z-index: -1;
    }

.page-desc {
    font-size: 1.05rem;
    color: var(--contact-text-muted);
    line-height: 1.8;
    margin-bottom: 32px;
}

/* --- 快速聯絡按鈕 (取代原本的底部純文字) --- */
.contact-quick-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 40px; 
    /* ✅ 新增：如果是單一按鈕，靠左對齊，不要置中拉伸 */
    justify-content: flex-start;
    flex-wrap: wrap; /* 允許換行，以防萬一 */
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
    background: #fff;
}

.action-btn {
        display: inline-flex; /* 改為 inline-flex */
        align-items: center;
        gap: 12px;
        padding: 12px 24px; /* 稍微增加左右內距，讓單一按鈕看起來大氣一點 */
        border-radius: 12px;
        text-decoration: none;
        transition: all 0.2s;
        border: 1px solid var(--border-color);
        background: #fff;
        min-width: 240px; /* ✅ 新增：設定一個合理的最小寬度 */
        max-width: 100%; /* 防止手機版破版 */
        cursor: pointer; /* 確保滑鼠游標正確 */
    }
        /* 電話按鈕：強調 */
        .action-btn.call {
            background-color: #fff;
            border-color: var(--contact-primary);
            color: var(--contact-primary);
        }
        /* Email 按鈕：次要 */
        .action-btn.email {
            color: var(--contact-text);
        }

        .action-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.05);
        }

        .action-btn .icon {
            font-size: 1.2rem;
        }

        .action-btn .text {
            display: flex;
            flex-direction: column;
            line-height: 1.2;
        }

        .action-btn small {
            font-size: 0.75rem;
            color: var(--contact-text-muted);
        }

        .action-btn strong {
            font-size: 0.95rem;
            font-weight: 700;
        }

@media (min-width: 992px) {
    /* 當有兩個以上的 .action-btn 時，才啟用 flex-grow */
    .contact-quick-actions:has(.action-btn:nth-child(2)) .action-btn {
        flex: 1;
    }

    /* 如果瀏覽器不支援 :has (舊版)，可以用這個備案：
       直接指定單一按鈕不要滿版 */
    .action-btn {
        flex: 0 1 auto; /* 不放大，可縮小，自動寬度 */
    }
}

    /* --- 系統優勢 (Grid) --- */
    .feature-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .feat-card {
        display: flex;
        align-items: center;
        background: rgba(255, 255, 255, 0.6);
        backdrop-filter: blur(10px);
        padding: 16px 20px;
        border-radius: 16px;
        border: 1px solid rgba(255, 255, 255, 0.8);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    }

    .feat-icon-circle {
        width: 40px;
        height: 40px;
        background: #fff;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        margin-right: 14px;
        color: var(--contact-primary);
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    .feat-details h5 {
        margin: 0 0 2px;
        font-size: 0.95rem;
        font-weight: 700;
        color: var(--contact-text);
    }

    .feat-details span {
        font-size: 0.8rem;
        color: var(--contact-text-muted);
    }
    /* --- 右側表單區 --- */
    .contact-form-wrapper {
        background-color: #fff;
        padding: 60px;
    }

    .card-header-text h3 {
        font-size: 1.8rem;
        font-weight: 800;
        color: var(--contact-text);
        margin-bottom: 8px;
    }

    .card-header-text p {
        color: var(--contact-text-muted);
        font-size: 0.95rem;
        margin-bottom: 32px;
    }
    /* 表單通用 */
    .form-label {
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--contact-text);
        margin-bottom: 6px;
    }

        .form-label.required::after {
            content: '*';
            color: #ef4444;
            margin-left: 4px;
        }

    .medical-input {
        border: 1px solid var(--border-color);
        background-color: #fcfcfc;
        border-radius: 10px;
        padding: 12px 16px;
        font-size: 1rem;
        color: var(--contact-text);
    }

        .medical-input:focus {
            background-color: #fff;
            border-color: var(--contact-primary);
            box-shadow: 0 0 0 4px rgba(14, 165, 164, 0.1);
            outline: none;
        }
    /* 按鈕 */
    .btn-lg-medical {
        padding: 14px;
        font-size: 1.05rem;
        font-weight: 700;
        border-radius: 10px;
        background-color: var(--contact-primary);
        color: #fff;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
    }

        .btn-lg-medical:hover {
            background-color: var(--contact-primary-dark);
        }

    .char-counter {
        text-align: right;
        font-size: 0.75rem;
        color: var(--contact-text-muted);
        margin-top: 4px;
    }

        .char-counter.at-limit {
            color: #ef4444;
        }
    /* 連結樣式 */
    .btn-link-text {
        background: none;
        border: none;
        padding: 0;
        color: var(--contact-primary);
        text-decoration: underline;
        font-weight: 500;
        font-size: inherit;
    }
    /* =========================================
   📱 Mobile RWD 專屬優化 (重頭戲)
   ========================================= */
    @media (max-width: 991px) {
        .contact-section {
            padding: 0; /* 移除外距，讓手機版滿版 */
            background-color: #fff;
        }

        .contact-grid {
            display: flex;
            flex-direction: column; /* 垂直排列 */
            box-shadow: none;
            border: none;
            border-radius: 0;
        }
        /* 上方：資訊區 */
        .contact-info {
            padding: 30px 20px 20px;
            text-align: left; /* 改回靠左，比較易讀 */
            border-bottom: 1px solid #f1f5f9;
            background: #fff; /* 手機版不使用漸層，保持乾淨 */
        }

        .page-title {
            font-size: 1.75rem; /* 標題縮小 */
            margin-bottom: 10px;
        }

        .page-desc {
            font-size: 0.95rem;
            margin-bottom: 24px;
        }
        /* 快速按鈕：保持並排，但按鈕變小一點 */
        .contact-quick-actions {
            margin-bottom: 24px;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .action-btn {
            padding: 16px; /* 手機版增加點擊範圍 */
            justify-content: center; /* 內容置中 */
            width: 100%; /* 佔滿寬度 */
            border-radius: 12px;
            background-color: #f8fafc;
            /* 移除 min-width 限制，讓它自適應 */
            min-width: 0;
        }

            .action-btn .text small {
                display: none;
            }
            /* 手機版隱藏小字，只留電話/寫信 */
            .action-btn strong {
                font-size: 0.9rem;
            }
        /* 橫向滑動容器 (Horizontal Scroll) */
        .feature-scroll-container {
            margin-right: -20px; /* 破框效果 */
            padding-right: 20px;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            padding-bottom: 10px; /* 留給 scrollbar */
        }
            /* 隱藏 scrollbar */
            .feature-scroll-container::-webkit-scrollbar {
                display: none;
            }

        .feature-grid {
            display: flex; /* 變成橫向 Flex */
            gap: 12px;
            width: max-content; /* 內容撐開寬度 */
        }

        .feat-card {
            min-width: 160px; /* 固定卡片寬度 */
            padding: 12px;
            background: #f8fafc; /* 淺灰底，更像卡片 */
            border: 1px solid #eee;
        }
        /* 下方：表單區 */
        .contact-form-wrapper {
            padding: 30px 20px 60px; /* 底部留白多一點 */
        }

        .form-card {
            /* 手機版移除卡片感，變成原生表單 */
            box-shadow: none;
            border: none;
            padding: 0;
        }

        .card-header-text h3 {
            font-size: 1.5rem;
        }
        /* 讓兩欄變單欄 */
        .row.g-3 {
            --bs-gutter-y: 1rem; /* 增加垂直間距 */
        }
        /* 讓輸入框更好點 */
        .medical-input {
            padding: 12px;
            font-size: 16px; /* 防止 iOS 縮放 */
        }
    }
    /* =========================================
   手機版 Tabs 切換樣式
   ========================================= */
    .mobile-tabs {
        display: flex;
        background: #fff;
        padding: 4px;
        border-radius: 12px;
        margin-bottom: 20px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.05);
        border: 1px solid #e2e8f0;
    }

    .tab-btn {
        flex: 1;
        padding: 10px;
        border: none;
        background: transparent;
        color: #64748b;
        font-weight: 600;
        font-size: 0.95rem;
        border-radius: 8px;
        transition: all 0.2s;
    }

        .tab-btn.active {
            background-color: var(--contact-primary);
            color: #fff;
            box-shadow: 0 2px 6px rgba(14, 165, 164, 0.2);
        }
    /* =========================================
   RWD 手機版邏輯 (修正版)
   ========================================= */
    @media (max-width: 991px) {
        .contact-section {
            padding: 20px 16px 40px; /* 增加頂部留白給 Tabs */
            align-items: flex-start; /* 靠上對齊 */
        }

        .container-limit {
            padding: 10px; /* 滿寬 */
        }

        /* 預設隱藏資訊區 (因為第一個 Tab 是表單) */
        #tab-info {
            display: none;
            padding: 20px;
            border: 1px solid #f1f5f9;
            border-radius: 16px;
            margin-top: 0;
        }

        /* 表單區預設顯示 */
        #tab-form {
            display: block;
            padding: 24px 20px;
            border: 1px solid #f1f5f9;
            border-radius: 16px;
        }
        /* 隱藏原本的 Grid 佈局，改由 Tab 控制顯示 */
        .contact-grid {
            display: block; /* 解除 Grid/Flex */
            box-shadow: none;
            border: none;
            background: transparent;
        }

        /* 按鈕樣式調整 (更像按鈕) */
        .action-btn {
            background-color: #fff;
            border: 1px solid #e2e8f0;
            cursor: pointer; /* 讓它像按鈕 */
        }

        .mobile-tabs {
            margin-bottom: 10px;
        }
    }
    /* =========================================
   📱 Mobile RWD 專屬優化 (修正版)
   ========================================= */
    @media (max-width: 991px) {
        .contact-grid {
            display: flex;
            flex-direction: column;
            box-shadow: none;
            border: none;
            border-radius: 0;
        }
        /* 上方：資訊區 */
        .contact-info {
            padding: 30px 20px 20px;
            text-align: left;
            border-bottom: 1px solid #f1f5f9;
            background: #fff;
        }

        .page-title {
            font-size: 1.75rem;
            margin-bottom: 10px;
        }

        .page-desc {
            font-size: 0.95rem;
            margin-bottom: 24px;
        }
        /* ✅ 修正重點：快速按鈕改為垂直堆疊，解決溢出問題 */
        .contact-quick-actions {
            margin-bottom: 24px;
            display: flex;
            flex-direction: column; /* 垂直排列 */
            gap: 12px; /* 按鈕間距 */
        }

        .action-btn {
            padding: 12px 16px; /* 增加點擊範圍 */
            justify-content: flex-start; /* 內容靠左對齊，看起來更像列表選項 */
            width: 100%; /* 佔滿寬度 */
            border-radius: 12px;
            background-color: #f8fafc; /* 給一點背景色區隔 */
        }
            /* 手機版讓 icon 與文字排版更清楚 */
            .action-btn .icon {
                font-size: 1.4rem;
                margin-right: 12px;
            }

            .action-btn .text {
                text-align: left;
            }
                /* 手機版顯示小標題，增加資訊清晰度 */
                .action-btn .text small {
                    display: block;
                    font-size: 0.75rem;
                    color: var(--contact-text-muted);
                }

            .action-btn strong {
                font-size: 1rem;
            }
        /* 橫向滑動容器 */
        .feature-scroll-container {
            margin-right: -20px;
            padding-right: 20px;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            padding-bottom: 10px;
        }

            .feature-scroll-container::-webkit-scrollbar {
                display: none;
            }

        .feature-grid {
            display: inline;
            gap: 12px;
            width: max-content;
        }

        .feat-card {
            min-width: 160px;
            padding: 12px;
            background: #fff;
            border: 1px solid #eee;
            box-shadow: 0 2px 8px rgba(0,0,0,0.03); /* 手機版加回一點陰影 */
        }
        /* 下方：表單區 */
        .contact-form-wrapper {
            padding: 30px 20px 60px;
        }

        .form-card {
            box-shadow: none;
            border: none;
            padding: 0;
        }

        .card-header-text h3 {
            font-size: 1.5rem;
        }

        .row.g-3 {
            --bs-gutter-y: 1rem;
        }

        .medical-input {
            padding: 12px;
            font-size: 16px;
        }
        /* 調整 reCAPTCHA 文字間距 */
        .recaptcha-note {
            margin-top: 1rem;
            padding-bottom: 1rem;
        }
    }


/* 1. 頁面背景紋理化 */
.contact-section {
    background-color: var(--bg-body);
    /* 加入微弱宣紙顆粒感 */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
}

/* 2. 資訊區域 (左側) 優化 */
.contact-info {
    background: var(--medical-accent) !important;
    border-right: 1px solid var(--border-color);
}

.badge-solution {
    background-color: var(--medical-accent-dark) !important;
    color: var(--medical-primary) !important;
    border: 1px solid var(--medical-primary) !important;
    font-family: "標楷體", serif;
}

.highlight-text {
    color: var(--medical-primary);
}

    .highlight-text::after {
        background-color: rgba(45, 90, 39, 0.1) !important; /* 墨綠劃線 */
    }

/* 3. 快速聯絡按鈕 */
.action-btn.call {
    border-color: var(--medical-primary) !important;
    color: var(--medical-primary) !important;
}

.action-btn:hover {
    background-color: var(--medical-accent-dark) !important;
    border-color: var(--medical-primary) !important;
}

/* 4. 系統優勢卡片 (宣紙浮水印感) */
.feat-card {
    background: rgba(255, 255, 255, 0.5) !important;
    border: 1px solid var(--border-color) !important;
}

.feat-icon-circle {
    color: var(--medical-primary) !important;
    background: var(--medical-accent) !important;
}

/* 5. 表單區 (右側) 優化 */
.contact-form-wrapper {
    background-color: #fff !important;
}

.medical-input {
    border: 1px solid var(--border-color) !important;
    background-color: var(--medical-accent) !important;
}

    .medical-input:focus {
        border-color: var(--medical-primary) !important;
        box-shadow: 0 0 0 4px rgba(45, 90, 39, 0.1) !important;
    }

/* 6. 送出按鈕：硃砂紅 */
.btn-lg-medical {
    background-color: var(--medical-highlight) !important;
    box-shadow: 0 4px 12px rgba(166, 61, 64, 0.2);
}

    .btn-lg-medical:hover {
        background-color: #8e3235 !important;
    }

/* 7. 手機版 Tab 優化 */
.tab-btn.active {
    background-color: var(--medical-primary) !important;
    box-shadow: 0 2px 6px rgba(45, 90, 39, 0.2) !important;
}

/* 8. 裝飾圓形 (調整為草本色調) */
.shape-1 {
    background: rgba(45, 90, 39, 0.1) !important;
}

.shape-2 {
    background: rgba(166, 61, 64, 0.05) !important;
}
/* --- 1. 整合式印章按鈕細節 --- */
.btn-stamp-integrated {
    position: relative;
    padding-left: 50px !important; /* 為左側印章留空間 */
    overflow: visible !important;
    border: 1.5px solid var(--medical-primary) !important;
    background: #fff !important;
    transition: all 0.3s ease;
}

/* 「聯」字小印章 */
.stamp-icon-mini {
    position: absolute;
    left: -12px; /* 稍微再往左推一點，因為印章變大了 */
    top: 50%;
    transform: translateY(-50%) rotate(-5deg);
    /* 調整尺寸以容納四個字 */
    width: 38px;
    height: 38px;
    background: radial-gradient(circle at center, var(--medical-highlight) 0%, #8e3235 100%);
    color: #fff;
    /* 核心：田字型排版 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
    font-family: "標楷體", serif;
    font-size: 11px; /* 縮小字體以塞入四個字 */
    font-weight: bold;
    border-radius: 4px;
    box-shadow: 2px 2px 5px rgba(166, 61, 64, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 2;
}

    .stamp-icon-mini span {
        display: block;
        letter-spacing: 2px; /* 增加字間距增加古風質感 */
        padding-left: 2px; /* 視覺微調對齊 */
    }

/* 修正按鈕內距，給更大的印章足夠空間 */
.btn-stamp-integrated {
    padding-left: 55px !important;
}

    /* Hover 效果同步更新 */
    .btn-stamp-integrated:hover .stamp-icon-mini {
        transform: translateY(-50%) rotate(0deg) scale(1.05);
    }

/* --- 2. 標題與文字和諧化 --- */
.page-title {
    color: var(--medical-primary) !important;
    letter-spacing: 1px;
}

.page-desc {
    color: var(--text-sub) !important;
    border-left: 3px solid var(--border-color); /* 加入引言線條增加穩重感 */
    padding-left: 15px;
}

/* --- 3. 表單輸入框優化 --- */
.medical-input {
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    background-color: #fff !important; /* 保持填寫區清爽 */
}

/* 送出按鈕維持硃砂紅，但調整為更穩重的漸層 */
.btn-lg-medical {
    background: linear-gradient(135deg, var(--medical-highlight), #8e3235) !important;
    border-radius: 8px !important;
}

/* --- 4. 手機版 RWD 修正 --- */
@media (max-width: 991px) {
    .btn-stamp-integrated {
        margin-left: 10px; /* 留位置給破框印章 */
        width: calc(100% - 10px);
    }
}

/* --- 系統優勢圖示中醫化 --- */
.feat-icon-circle {
    width: 48px; /* 稍微放大增加大氣感 */
    height: 48px;
    background: #fff !important;
    color: var(--medical-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px; /* 圓潤的方塊，像名貴的瓷器或硯台 */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* 輕微的外發光讓它從宣紙背景跳出來 */
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.03) !important;
    transition: all 0.3s ease;
}

    .feat-icon-circle svg {
        width: 24px;
        height: 24px;
        opacity: 0.85;
    }

/* 懸停效果：圖示與背景色彩反轉，產生蓋章後的實心感 */
.feat-card:hover .feat-icon-circle {
    background-color: var(--medical-primary) !important;
    color: var(--medical-accent) !important;
    transform: scale(1.05);
    box-shadow: 4px 6px 12px rgba(45, 90, 39, 0.15) !important;
}

.feat-details h5 {
    color: var(--medical-primary);
    font-weight: 800;
    margin-bottom: 4px;
}

.feat-details span {
    color: var(--text-sub);
    font-size: 0.85rem;
}