﻿/* --- 基礎設定 --- */
:root {
    --primary-color: #4285f4;
    --primary-hover: #357ae8;
    --bg-color: #f0f2f5; /* 背景稍微加深一點點，凸顯白色區塊 */
    --card-bg: #ffffff;
    --text-main: #202124;
    --text-sub: #5f6368;
    --link-color: #1a0dab;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    padding-top: 80px; /* 為固定的導航列留空間 */
}

/* --- 頂部導航列 (Tabs) --- */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    z-index: 1000;
}

.nav-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: center; /* 置中 */
    gap: 1rem;
    padding: 0 1rem;
}

.nav-item {
    text-decoration: none;
    color: var(--text-sub);
    padding: 1.2rem 1.5rem;
    font-weight: 500;
    font-size: 1rem;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .nav-item:hover {
        color: var(--primary-color);
        background-color: rgba(66, 133, 244, 0.04);
    }

    .nav-item.active {
        color: var(--primary-color);
        border-bottom-color: var(--primary-color);
    }

.icon {
    font-size: 1.2rem;
}

/* --- 主要容器 --- */
.main-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1.5rem 4rem;
}

/* --- 搜尋區塊 --- */
.search-section {
    text-align: center;
    margin-bottom: 2rem;
    background: var(--card-bg);
    padding: 3rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.page-title {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
}

.sub-title {
    color: var(--text-sub);
    margin-bottom: 2rem;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    flex: 1;
    padding: 12px 20px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    outline: none;
    transition: border-color 0.3s;
}

    .search-input:focus {
        border-color: var(--primary-color);
    }

.search-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0 28px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.2s;
}

    .search-btn:hover {
        background-color: var(--primary-hover);
    }

/* --- 結果列表區塊 --- */
.results-section {
    animation: fadeIn 0.4s ease-out;
}

.section-header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
    padding-left: 0.5rem;
}

.section-header {
    font-size: 1.2rem;
    color: var(--text-main);
}

.result-count {
    font-size: 0.9rem;
    color: var(--text-sub);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* --- 結果卡片 --- */
.result-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid transparent; /* 預留左側標示線 */
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

    .result-card:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-2px);
        border-left-color: var(--primary-color); /* Hover 時出現藍色線條 */
    }

.result-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.site-name {
    font-weight: 700;
    color: #333;
}

.result-url {
    color: var(--text-sub);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

.result-title {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    line-height: 1.4;
}

    .result-title a {
        text-decoration: none;
        color: var(--link-color);
    }

        .result-title a:hover {
            text-decoration: underline;
        }

.result-desc {
    color: #4d5156;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* 排名標籤 */
.rank-badge {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: #e8f0fe;
    color: #1967d2;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* --- RWD --- */
@media (max-width: 768px) {
    .nav-container {
        overflow-x: auto; /* 手機版可橫向滑動 */
        justify-content: flex-start;
        padding-bottom: 5px;
    }

    .nav-item {
        white-space: nowrap;
        padding: 1rem;
        font-size: 0.9rem;
    }

    .input-wrapper {
        flex-direction: column;
    }

    .search-btn {
        width: 100%;
        padding: 12px;
    }

    .rank-badge {
        position: static;
        display: inline-block;
        margin-top: 10px;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* --- 排名追蹤頁面專用樣式 --- */

/* 多欄位表單容器 */
.rank-form {
    max-width: 700px;
    margin: 0 auto;
    text-align: left; /* 讓 label 對齊左邊 */
}

.multi-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    margin-left: 10px;
}

/* 覆寫原本的 search-input 讓它在多行模式下更適合 */
.rank-form .search-input {
    width: 100%;
    border-radius: 12px; /* 方圓角，稍微不像膠囊那麼圓 */
    padding: 14px 20px;
    background-color: #fff;
}

/* 滿版按鈕 */
.block-btn {
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
    padding: 14px;
    border-radius: 12px;
    font-size: 1.1rem;
}

/* --- 排名結果大卡片 --- */
.rank-result-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid #e0e0e0;
    animation: fadeIn 0.5s ease-out;
}

/* 狀態條 (上方) */
.rank-status {
    padding: 12px 24px;
    font-weight: 500;
    font-size: 0.95rem;
}

    .rank-status.found {
        background-color: #e6f4ea;
        color: #137333;
        border-bottom: 1px solid #ceead6;
    }

    .rank-status.not-found {
        background-color: #fce8e6;
        color: #c5221f;
        border-bottom: 1px solid #fad2cf;
    }

/* 內容區 */
.rank-content {
    display: flex;
    padding: 2rem;
    gap: 2rem;
    align-items: center;
}

/* 左側大數字 */
.rank-number-box {
    text-align: center;
    min-width: 120px;
    padding-right: 2rem;
    border-right: 1px solid #f0f0f0;
}

.rank-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-sub);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.big-rank {
    font-size: 4rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
}

/* 右側詳細資訊 */
.rank-details {
    flex: 1;
}

    .rank-details .result-title {
        font-size: 1.4rem;
        margin-bottom: 0.5rem;
    }

    .rank-details .result-url {
        color: #188038; /* Google 的綠色網址顏色 */
        margin-bottom: 0.8rem;
        font-family: monospace;
        font-size: 0.95rem;
    }

/* 提示區塊 */
.tips-box {
    margin-top: 1.5rem;
    padding: 1rem 1.5rem;
    background-color: #e8f0fe;
    color: #1967d2;
    border-radius: 8px;
    font-size: 0.95rem;
    border: 1px solid #d2e3fc;
}

/* --- RWD 調整 --- */
@media (max-width: 768px) {
    .rank-content {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }

    .rank-number-box {
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
        padding-right: 0;
        padding-bottom: 1.5rem;
        margin-bottom: 1.5rem;
        width: 100%;
    }
}

/* --- 初始狀態 (Empty State) --- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-sub);
    background: #fff;
    border-radius: 16px;
    border: 2px dashed #e0e0e0; /* 虛線邊框，代表等待填入 */
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

/* --- Loading 狀態 --- */
.loading-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-sub);
}

/* 簡單的轉圈圈動畫 */
.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}


/* --- 沒找到 (Red/Not Found) 樣式覆寫 --- */

/* 1. 狀態條變紅色 */
.rank-status.not-found {
    background-color: #fce8e6; /* 淺紅底 */
    color: #c5221f; /* 深紅字 */
    border-bottom: 1px solid #fad2cf;
}

/* 2. 卡片整體邊框變紅 (可選) */
.rank-result-card.not-found {
    border-color: #fad2cf;
}

    /* 3. 左側大數字變灰色或紅色 */
    .rank-result-card.not-found .big-rank {
        color: #c5221f; /* 或者用灰色 #9aa0a6 代表無效 */
        font-size: 3rem; /* 字稍微縮小一點以免 >100 爆版 */
    }

/* --- 站點診斷儀表板佈局 --- */
.audit-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.5s ease-out;
}

.audit-top-grid {
    display: grid;
    grid-template-columns: 300px 1fr; /* 左邊 300px，右邊自適應 */
    gap: 1.5rem;
}

.audit-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e0e0e0;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    color: var(--text-main);
    border-left: 4px solid var(--primary-color);
    padding-left: 10px;
}

/* --- 1. 評分圓圈 (CSS Trick) --- */
.score-card {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-circle-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 1.5rem;
}

.score-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* 這裡利用 conic-gradient 製作動態圓餅圖，--percent 由 HTML style 控制 */
    background: conic-gradient(var(--primary-color) calc(var(--percent) * 1%), #e0e0e0 0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

    /* 遮罩，做出甜甜圈效果 */
    .score-circle::before {
        content: '';
        position: absolute;
        width: 90px;
        height: 90px;
        background: #fff;
        border-radius: 50%;
    }

.score-number {
    position: relative; /* 確保在遮罩層之上 */
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
}

.score-label {
    position: relative;
    font-size: 0.9rem;
    color: var(--text-sub);
    margin-top: 10px;
    margin-left: 2px;
}

.score-summary {
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
}

.score-item {
    margin-bottom: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    background: #f8f9fa;
}

    .score-item.success {
        color: #137333;
        background: #e6f4ea;
    }

    .score-item.warning {
        color: #b06000;
        background: #fef7e0;
    }


/* --- 2. Meta 資訊卡 --- */
.meta-group {
    margin-bottom: 1.2rem;
}

.meta-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-sub);
    margin-bottom: 5px;
    text-transform: uppercase;
}

.meta-content {
    font-size: 1rem;
    color: var(--text-main);
    line-height: 1.5;
}

.desc-text {
    color: #4d5156;
}

.char-count {
    font-size: 0.8rem;
    color: #9aa0a6;
    margin-left: 5px;
}

.code-text {
    font-family: Consolas, monospace;
    background: #f1f3f4;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    color: #1a73e8;
}

/* --- 3. 標籤結構 (H1/H2) --- */
.audit-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 左右各半 */
    gap: 1.5rem;
}

.tag-section {
    margin-bottom: 1.5rem;
}

.tag-header {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.h1-tag {
    background: #fee2e2;
    color: #991b1b;
}
/* 紅色系 */
.h2-tag {
    background: #dbeafe;
    color: #1e40af;
}
/* 藍色系 */

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.keyword-pill {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #333;
}

/* --- 4. 關鍵字排名表格 --- */
.table-card {
    grid-column: span 2; /* 手機版可能需要調整 */
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.action-btn {
    background: #fff;
    border: 1px solid #dadce0;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

    .action-btn:hover {
        background: #f1f3f4;
    }

.table-responsive {
    overflow-x: auto;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

    .audit-table th {
        text-align: left;
        padding: 12px;
        background: #f8f9fa;
        border-bottom: 2px solid #e0e0e0;
        color: var(--text-sub);
        font-weight: 600;
    }

    .audit-table td {
        padding: 12px;
        border-bottom: 1px solid #f1f3f4;
        vertical-align: middle;
    }

.source-badge {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

    .source-badge.title {
        background: #e8f0fe;
        color: #1967d2;
    }

    .source-badge.h1 {
        background: #fce8e6;
        color: #c5221f;
    }

    .source-badge.h2 {
        background: #e6f4ea;
        color: #137333;
    }

    .source-badge.meta {
        background: #f1f3f4;
        color: #5f6368;
    }

.rank-num {
    font-weight: 700;
}

    .rank-num.top-3 {
        color: #137333;
    }

    .rank-num.not-found {
        color: #9aa0a6;
        font-weight: 400;
    }

.link-btn {
    color: var(--link-color);
    text-decoration: none;
    font-size: 0.9rem;
}

    .link-btn:hover {
        text-decoration: underline;
    }

/* --- RWD 調整 --- */
@media (max-width: 900px) {
    .audit-top-grid, .audit-bottom-grid {
        grid-template-columns: 1fr; /* 手機版變單欄 */
    }

    .score-circle-wrapper {
        margin: 0 auto 1.5rem;
    }

    .table-card {
        grid-column: span 1;
    }
}

/* --- 狀態一：初始輸入畫面 (Idle) --- */
.initial-audit-box {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 700px;
    margin: 4rem auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.5s ease-out;
}

.audit-icon-wrapper {
    width: 80px;
    height: 80px;
    background: #e8f0fe;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.audit-icon {
    font-size: 3rem;
}

.audit-search-form {
    display: flex;
    gap: 10px;
    margin-top: 2rem;
}

.audit-input-lg {
    flex: 1;
    padding: 15px 20px;
    font-size: 1.1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
}

    .audit-input-lg:focus {
        border-color: var(--primary-color);
    }

.audit-btn-lg {
    padding: 0 30px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: 700;
    white-space: nowrap;
}

    .audit-btn-lg:hover {
        background: var(--primary-hover);
    }

/* --- 狀態二：掃描中畫面 (Scanning) --- */
.scanning-state {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 600px;
    margin: 4rem auto;
    animation: fadeIn 0.5s ease-out;
}

.scanning-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.scanning-url {
    color: var(--text-sub);
    margin-bottom: 2rem;
    font-family: monospace;
    background: #f1f3f4;
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
}

/* 進度條容器 */
.progress-bar-wrapper {
    width: 100%;
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 2rem;
}

/* 進度條本體 */
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4285f4, #34a853); /* Google 藍綠漸層 */
    transition: width 0.3s ease;
}

/* 步驟指示器 */
.scanning-steps {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #ccc;
    position: relative;
}

.step {
    position: relative;
    font-weight: 500;
}

    .step.active {
        color: var(--text-main);
        font-weight: 700;
    }

        .step.active::after {
            content: '●';
            color: var(--primary-color);
            position: absolute;
            top: -35px; /* 調整圓點位置到進度條下方附近 */
            left: 50%;
            transform: translateX(-50%);
            font-size: 0.8rem;
        }


/* --- 狀態三：儀表板 (Dashboard) --- */
.audit-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.5s ease-out;
}

/* 重新診斷工具列 */
.compact-search-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: var(--shadow-sm);
}

.re-audit-btn {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

    .re-audit-btn:hover {
        background: #e8f0fe;
    }

/* 網格佈局 */
.audit-top-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
}

.audit-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* 卡片通用樣式 */
.audit-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e0e0e0;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    color: var(--text-main);
    border-left: 4px solid var(--primary-color);
    padding-left: 10px;
}

/* 1. 評分圓圈 */
.score-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-circle-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    margin-bottom: 1.5rem;
}

.score-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(var(--primary-color) calc(var(--percent) * 1%), #f1f3f4 0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

    .score-circle::before {
        content: '';
        position: absolute;
        width: 110px;
        height: 110px;
        background: #fff;
        border-radius: 50%;
    }

.score-number {
    position: relative;
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
}

.score-label {
    position: relative;
    font-size: 1rem;
    color: var(--text-sub);
    margin-top: 15px;
    margin-left: 4px;
}

.score-summary {
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
}

.score-item {
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 500;
}

    .score-item.success {
        color: #137333;
        background: #e6f4ea;
    }

    .score-item.warning {
        color: #b06000;
        background: #fef7e0;
    }

/* 2. Meta 資訊 */
.meta-group {
    margin-bottom: 1.2rem;
    border-bottom: 1px solid #f8f9fa;
    padding-bottom: 1rem;
}

    .meta-group:last-child {
        border-bottom: none;
    }

.meta-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #9aa0a6;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meta-content {
    font-size: 1rem;
    color: #3c4043;
    line-height: 1.6;
}

.char-count {
    font-size: 0.8rem;
    color: #9aa0a6;
    margin-left: 5px;
}

.code-text {
    font-family: 'Consolas', monospace;
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 4px;
    color: #1a73e8;
    font-size: 0.9rem;
}

/* 3. 標籤與表格 */
.tag-section {
    margin-bottom: 1.5rem;
}

.tag-header {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.h1-tag {
    background: #fce8e6;
    color: #c5221f;
}

.h2-tag {
    background: #e6f4ea;
    color: #137333;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.keyword-pill {
    background: #fff;
    border: 1px solid #dadce0;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.9rem;
    color: #3c4043;
}

.table-card {
    grid-column: span 2;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.action-btn {
    background: #fff;
    border: 1px solid #dadce0;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

    .audit-table th {
        text-align: left;
        padding: 12px;
        background: #f8f9fa;
        border-bottom: 2px solid #e0e0e0;
        color: #5f6368;
        font-weight: 600;
    }

    .audit-table td {
        padding: 12px;
        border-bottom: 1px solid #f1f3f4;
        vertical-align: middle;
    }

.source-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 700;
}

    .source-badge.title {
        background: #e8f0fe;
        color: #1967d2;
    }

    .source-badge.h1 {
        background: #fce8e6;
        color: #c5221f;
    }

    .source-badge.h2 {
        background: #e6f4ea;
        color: #137333;
    }

    .source-badge.meta {
        background: #f1f3f4;
        color: #5f6368;
    }

.rank-num {
    font-weight: 700;
}

    .rank-num.top-3 {
        color: #137333;
    }

    .rank-num.not-found {
        color: #9aa0a6;
        font-weight: 400;
    }

.link-btn {
    color: #1a0dab;
    text-decoration: none;
    font-size: 0.9rem;
}

    .link-btn:hover {
        text-decoration: underline;
    }

/* RWD */
@media (max-width: 900px) {
    .audit-top-grid, .audit-bottom-grid {
        grid-template-columns: 1fr;
    }

    .table-card {
        grid-column: span 1;
    }

    .audit-search-form {
        flex-direction: column;
    }

    .audit-btn-lg {
        width: 100%;
    }
}

/* --- 競品分析專用樣式 --- */

/* 1. 雙欄位輸入區 */
.competitor-input-wrapper {
    display: flex;
    align-items: flex-end; /* 底部對齊 */
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.vs-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.input-label.mysite {
    color: #1a73e8;
}
/* 藍色代表我方 */
.input-label.rival {
    color: #d93025;
}
/* 紅色代表敵方 */

/* VS 圓圈標章 */
.vs-badge {
    width: 40px;
    height: 40px;
    background: #f1f3f4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-style: italic;
    color: #5f6368;
    margin-bottom: 5px; /* 調整位置 */
    flex-shrink: 0;
}

/* 2. 比對總分卡片 */
.comparison-grid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.comp-col {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.site-badge {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 10px;
}

    .site-badge.mysite {
        background: #e8f0fe;
        color: #1967d2;
    }

    .site-badge.rival {
        background: #fce8e6;
        color: #c5221f;
    }

.big-score {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 5px;
}

    .big-score.win {
        color: #137333;
    }

    .big-score.lose {
        color: #ea8600;
    }

.site-url {
    font-size: 0.85rem;
    color: #5f6368;
}

/* 中間指標條 */
.comp-metrics {
    flex: 1.5; /* 中間寬一點 */
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    border-left: 1px solid #f0f0f0;
    border-right: 1px solid #f0f0f0;
    padding: 0 1.5rem;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}

.m-label {
    color: var(--text-sub);
    font-size: 0.9rem;
}

.m-val {
    font-weight: 700;
    color: #202124;
}

    .m-val.win {
        color: #137333;
        position: relative;
    }

        .m-val.win::after {
            content: '▲';
            font-size: 0.6rem;
            margin-left: 4px;
            position: absolute;
            top: 2px;
        }

/* 3. 比對表格樣式 */
.comparison-table th {
    text-align: center; /* 表頭置中 */
}

    .comparison-table th:first-child {
        text-align: left; /* 第一欄靠左 */
    }

.rank-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    background: #f1f3f4;
    font-weight: 500;
    min-width: 50px;
}

    .rank-pill.win {
        background: #e6f4ea;
        color: #137333;
        font-weight: 700;
    }

    .rank-pill.not-found {
        color: #9aa0a6;
        background: transparent;
    }

.win-icon {
    color: #137333;
    font-weight: 700;
    font-size: 0.9rem;
}

.lose-icon {
    color: #d93025;
    font-weight: 700;
    font-size: 0.9rem;
}

.text-center {
    text-align: center;
}

/* --- RWD 手機版 --- */
@media (max-width: 768px) {
    .competitor-input-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .vs-badge {
        margin: 0 auto; /* 置中 */
        transform: rotate(90deg); /* 轉成直的 */
    }

    .comparison-grid {
        flex-direction: column;
        gap: 2rem;
    }

    .comp-metrics {
        width: 100%;
        border: none;
        border-top: 1px solid #f0f0f0;
        border-bottom: 1px solid #f0f0f0;
        padding: 1.5rem 0;
    }
}

/* --- 讓驗證碼輸入框與圖片同一行 --- */
.captcha-inline-wrapper {
    display: flex; /* 啟用 Flex 佈局，預設就是橫向排列 */
    align-items: center; /* 垂直置中對齊 */
    gap: 10px; /* 輸入框與圖片之間的間距 */
}

    /* 讓輸入框自動填滿剩餘空間 */
    .captcha-inline-wrapper .search-input {
        flex: 1; /* 佔據剩下的寬度 */
        width: auto; /* 覆寫原本可能設定的 100% */
        margin: 0; /* 清除不必要的邊距 */
    }

/* 圖片樣式設定 */
.captcha-img {
    height: 52px; /* 設定與 search-input 差不多或是相同的高度 */
    border: 1px solid #e0e0e0;
    border-radius: 12px; /* 配合原本輸入框的圓角風格 */
    cursor: pointer; /* 滑鼠移上去變手指 */
    transition: opacity 0.2s;
    background-color: #fff; /* 避免圖片載入前背景透視 */
}

    .captcha-img:hover {
        opacity: 0.8; /* Hover 效果 */
    }

/* (選用) 手機版微調 */
@media (max-width: 480px) {
    .captcha-img {
        max-width: 120px; /* 防止手機上圖片過大擠壓輸入框 */
    }
}

/* --- 全站健檢頁面專用修改 --- */

/* 1. 改為垂直佈局容器 */
.audit-search-form.column-layout {
    display: flex;
    flex-direction: column; /* 上下排列 */
    gap: 15px; /* 上下間距 */
    max-width: 100%; /* 確保不超過父容器 */
}

/* 2. 網址輸入框滿版 */
.audit-input-lg.full-width {
    width: 100%;
    flex: none; /* 取消原本可能的 flex 伸縮 */
}

/* 3. 下方動作列 (驗證碼 + 按鈕) */
.audit-action-row {
    display: flex;
    gap: 15px;
    justify-content: space-between; /* 左右撐開或置中視需求而定 */
}

/* 4. 驗證碼包覆器 (Input + Image) */
.captcha-inline-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1; /* 佔據左側空間 */
    background: #fff;
    border-radius: 8px; /* 如果需要可以加背景 */
}

/* 驗證碼輸入框微調 */
.audit-input-lg.captcha-input {
    flex: 1;
    min-width: 0; /* 防止擠壓 */
}

/* 5. 大張的驗證碼圖片 */
.captcha-img-lg {
    height: 54px; /* 配合 audit-input-lg 的高度 (通常 lg input 約 50-60px) */
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    background-color: #fff;
    transition: opacity 0.2s;
}

    .captcha-img-lg:hover {
        opacity: 0.8;
    }

/* --- RWD 手機版適配 --- */
@media (max-width: 600px) {
    .audit-action-row {
        flex-direction: column; /* 手機上改成垂直堆疊 */
    }

    .audit-btn-lg {
        width: 100%; /* 按鈕變滿版 */
    }

    .captcha-img-lg {
        width: 120px; /* 圖片固定寬度 */
        object-fit: cover;
    }
}