/* --- 1. 基礎內文：1200px 置中 (僅針對文字與基礎列表) --- */
/* 排除所有帶有 alignfull (全幅) 或 alignwide (寬幅) 標籤的區塊 */
.single-post .entry-content p:not([class*="align"]), 
.single-post .entry-content ul:not([class*="align"]), 
.single-post .entry-content ol:not([class*="align"]),
.single-post .entry-content .wp-block-buttons:not([class*="align"]) {
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    width: 100%;
    box-sizing: border-box;
}

/* --- 2. 標題 H2-H5 漸層 (排除按鈕與 Jetpack) --- */
.single-post .entry-content h2:not([class*="sd-"]):not([id*="jp-"]):not(.sd-title):not(.wp-block-button__link), 
.single-post .entry-content h3:not([class*="sd-"]):not([id*="jp-"]):not(.sd-title):not(.wp-block-button__link), 
.single-post .entry-content h4:not([class*="sd-"]):not([id*="jp-"]):not(.sd-title):not(.wp-block-button__link), 
.single-post .entry-content h5:not([class*="sd-"]):not([id*="jp-"]):not(.sd-title):not(.wp-block-button__link) {
    max-width: 1200px !important;
    margin: 20px auto !important;
    background: linear-gradient(90deg, #8c52ff, #5ce1e6) !important;
    color: #ffffff !important;
    padding: 15px 20px;
    border-radius: 8px;
    display: block;
    clear: both;
}

/* --- 3. 圖片與圖庫保護：維持置中但不強制 1200px (交給主題控制) --- */
.single-post .entry-content figure, 
.single-post .entry-content .wp-block-image, 
.single-post .entry-content .wp-block-gallery {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* --- 4. 按鈕顏色與尺寸還原 (橘色漸層 - 匹配截圖) --- */
.single-post .entry-content .wp-block-button__link {
    /* 這裡改成了截圖中的橘色漸層 */
    background: linear-gradient(90deg, #ff9800, #f57c00) !important;
    color: #ffffff !important;
    border: 1px solid #ffffff !important;
    border-radius: 4px !important;
    padding: 15px 20px !important;
    text-align: center !important;
    font-weight: bold !important;
    display: block !important;
    width: 100% !important;
}

/* 保持按鈕在手機上並排的彈性 */
.wp-block-buttons.is-content-justification-center .wp-block-button,
.wp-block-buttons.is-content-justification-space-between .wp-block-button {
    flex: 1 1 45% !important;
    min-width: 120px !important;
}

/* --- 5. 影片 (FB/YouTube) 響應式優化 --- */
.single-post .entry-content .wp-block-embed,
.single-post .entry-content iframe {
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* --- 6. 手機版表格滑動 --- */
@media screen and (max-width: 1024px) {
    .single-post .entry-content .wp-block-table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .single-post .entry-content table {
        min-width: 600px !important;
        display: table !important;
    }
}

/* --- 7. 徹底修復 Jetpack 分享與點讚 --- */
div.sharedaddy, #jp-relatedposts, div.wpl-likebox {
    max-width: 1200px !important;
    margin: 40px auto !important;
    padding: 0 20px !important;
    background: transparent !important;
    clear: both !important;
}
.sd-title, .wpl-likebox h3, #jp-relatedposts h3.jp-relatedposts-headline {
    background: none !important;
    color: inherit !important;
    padding: 0 !important;
    margin: 10px 0 !important;
    display: block !important;
}
.sharedaddy ul {
    display: flex !important;
    flex-wrap: wrap !important;
    list-style: none !important;
    padding: 0 !important;
}

/* --- 8. 全幅群組修正 (允許背景鋪滿) --- */
.entry-content .alignfull {
    width: 100vw !important;
    position: relative !important;
    left: 50% !important;
    right: 50% !important;
    margin-left: -50vw !important;
    margin-right: -50vw !important;
    max-width: 100vw !important;
}
/* --- 9. 僅針對「文章」與「分頁」原生表格區塊：手機美化與滑動 --- */

@media screen and (max-width: 767px) {
    /* 1. 精確鎖定原生表格容器，完全避開外掛 */
    .single-post .entry-content .wp-block-table,
    .page .entry-content .wp-block-table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important; /* 啟用滑動 */
        -webkit-overflow-scrolling: touch;
        margin: 20px 0 !important;
        border: 1px solid #eeeeee;
    }

    /* 2. 針對表格主體：設定足夠寬度以供滑動，並修正結構 */
    .single-post .entry-content .wp-block-table table,
    .page .entry-content .wp-block-table table {
        display: table !important; 
        width: auto !important;
        min-width: 700px !important; /* 確保內容有足夠空間，不擁擠 */
        table-layout: auto !important;
        border-collapse: collapse !important;
    }

    /* 3. 比例協調優化：針對前三列設定寬度與置中 */
    /* 第一列：季節 */
    .wp-block-table table td:nth-child(1),
    .wp-block-table table th:nth-child(1) {
        width: 60px !important;
        text-align: center !important;
        font-weight: bold !important;
    }
    /* 第二列：推薦月份 */
    .wp-block-table table td:nth-child(2),
    .wp-block-table table th:nth-child(2) {
        width: 90px !important;
        text-align: center !important;
    }
    /* 第三列：平均氣溫 */
    .wp-block-table table td:nth-child(3),
    .wp-block-table table th:nth-child(3) {
        width: 110px !important;
        text-align: center !important;
    }
    /* 第四列：穿搭建議 (文字內容多，允許換行且靠左) */
    .wp-block-table table td:nth-child(4),
    .wp-block-table table th:nth-child(4) {
        text-align: left !important;
        padding: 12px 15px !important;
        white-space: normal !important; /* 確保文字在格子內自動換行 */
    }

    /* 4. 儲存格細節 */
    .wp-block-table td, .wp-block-table th {
        padding: 12px 8px !important;
        border: 1px solid #dddddd !important;
        vertical-align: middle !important;
        line-height: 1.6 !important;
    }
}

/* --- 10. Yoast 麵包屑基礎置中 (獨立設定) --- */
.yoast-breadcrumb {
    max-width: 1200px !important;
    margin: 10px auto !important;
}
/* --- 11. 針對「分頁 (Pages)」手機版標題尺寸優化 --- */
/* 
   策略：
   1. 僅作用於 .page (分頁)，不影響文章或其他頁面。
   2. 使用直接子代選擇器 (>) 確保只影響內容區的標準標題，
      絕對避開外掛（外掛標題通常嵌套在多層 div 內）。
*/

@media screen and (max-width: 767px) {
    /* 縮小標題尺寸以迎合手機螢幕，並確保置中或留白正確 */
    .page .entry-content h1,
    .page .entry-content h2,
    .page .entry-content h3,
    .page .entry-content h4,
    .page .entry-content h5,
    .page .entry-content h6 {
        width: 100% !important;
        max-width: 1200px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        word-wrap: break-word !important; /* 確保長標題不衝出螢幕 */
        box-sizing: border-box !important;
    }

    /* 具體尺寸調整 (可根據視覺喜好微調數值) */
    .page .entry-content h1 { font-size: 28px !important; line-height: 1.2 !important; margin: 20px 0 !important; }
    .page .entry-content h2 { font-size: 24px !important; line-height: 1.3 !important; margin: 18px 0 !important; }
    .page .entry-content h3 { font-size: 20px !important; line-height: 1.4 !important; margin: 15px 0 !important; }
    .page .entry-content h4 { font-size: 18px !important; line-height: 1.4 !important; }
    .page .entry-content h5 { font-size: 16px !important; line-height: 1.4 !important; }
    .page .entry-content h6 { font-size: 14px !important; line-height: 1.4 !important; }

    /* 如果您分頁的 H2-H5 也有套用之前的漸層背景，確保 padding 在手機上不會太擠 */
    .page .entry-content h2, 
    .page .entry-content h3, 
    .page .entry-content h4, 
    .page .entry-content h5 {
        padding: 12px 15px !important;
    }
}

/* --- 12. 外部外掛強制保護隔離帶 --- */
/* 
   再次明確宣告：禁止上述規則干擾特定外掛標題 
*/
.jet-form-builder h1, .jet-form-builder h2, .jet-form-builder h3,
.glsr h1, .glsr h2, .glsr h3,
.yoast-breadcrumb,
.ow-weather-widget h1, .ow-weather-widget h2 {
    font-size: inherit !important;
    margin: inherit !important;
    padding: inherit !important;
    background: inherit !important;
    width: auto !important;
}
/* 浮動按鈕組總容器 */
#floating-buttons-group {
    position: fixed;
    bottom: 50px;
    right: 20px;
    display: none; /* 初始隱藏，由 JS 控制顯示 */
    flex-direction: column;
    gap: 10px; /* 統一按鈕之間的距離 */
    z-index: 10000;
}

/* 核心樣式：確保全部尺寸一致 */
.float-btn {
    width: 45px !important;
    height: 45px !important;
    border-radius: 5px;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 2px 4px 12px rgba(0,0,0,0.15);
    text-decoration: none !important;
    padding: 0 !important;
}

.float-btn:hover {
    transform: scale(1.1);
    filter: brightness(1.05);
}

/* Facebook 漸變藍 */
.fb-btn {
    background: linear-gradient(to right, #0052D4, #4364F7, #6FB1FC) !important;
}

/* IG 經典漸變 */
.ig-btn {
    background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%) !important;
}

/* LINE 漸變綠：處理圖示+文字垂直居中 */
.line-btn {
    background: linear-gradient(to bottom, #00c300 0%, #008f00 100%) !important;
}
.line-btn-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.line-text {
    color: white;
    font-size: 8px;
    font-weight: bold;
    margin-top: 1px;
    font-family: Arial, sans-serif;
}

/* 回到頂部：採用截圖漸變青色 */
.top-btn {
    background: linear-gradient(to right, #E0F2F1, #B2DFDB, #4DB6AC, #00897B) !important;
}

/* 手機版同步一致尺寸 */
@media screen and (max-width: 767px) {
    #floating-buttons-group {
        bottom: 40px;
        right: 15px;
        gap: 8px;
    }
    .float-btn {
        width: 42px !important;
        height: 42px !important;
    }
}