/* ============================================================
   Taiwan PASS 網頁更新＿260819 (Redmine #38871) 新增樣式
   命名一律加上 tp- 前綴，避免與 Bootstrap / 既有 style.css 衝突
   ============================================================ */

/* ---------- 喔熊 AI 小幫手 (右下角固定按鈕) ---------- */
/* 尺寸為原版 1.5 倍（64px→96px／52px→78px）；bottom 預設值往上移，
   讓按鈕疊在「回到最上方」(.totop，bottom:110px/36px高) 正上方而不重疊，
   捲動到頁尾時改由 js/tp-ai-assistant.js 動態改寫 bottom，讓按鈕停在 footer 上方而不重疊 */
.tp-ai-assistant {
    position: fixed;
    right: 20px;
    bottom: 162px;
    z-index: 1050;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
    border: 2px solid #E9633B;
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease;
}

.tp-ai-assistant:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .28);
}

.tp-ai-assistant img,
.tp-ai-assistant .tp-ai-assistant-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.tp-ai-assistant .tp-ai-assistant-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #E9633B;
    color: #fff;
    font-size: 26px;
}

.tp-ai-assistant-label {
    position: absolute;
    right: 104px;
    bottom: 27px;
    background: #222;
    color: #fff;
    font-size: 13px;
    line-height: 1.4;
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

.tp-ai-assistant:hover .tp-ai-assistant-label {
    opacity: 1;
}

@media (max-width: 767px) {
    .tp-ai-assistant {
        width: 58.5px;
        height: 58.5px;
        right: 12px;
        bottom: 162px; /* 同桌機版邏輯：疊在「回到最上方」正上方，手機版 .totop 尺寸/位置不隨螢幕寬度變 */
    }

    .tp-ai-assistant-label {
        display: none;
    }
}

/* ---------- 最新消息：輪播卡片（取代原本靜態兩則清單） ---------- */
/* 移除 style.css 給 .home-news-wrap 的白底卡片背景（桌機／手機都不要） */
.home-news .home-news-wrap {
    background-color: transparent;
}

.tpnews-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.tpnews-shell {
    position: relative;
    padding: 0 38px;
}

.tpnews-viewport {
    overflow: hidden;
}

.tpnews-track {
    display: flex;
    gap: 18px;
    transition: transform .35s ease;
}

.tpnews-card {
    flex: 0 0 calc((100% - 54px) / 4);
    min-width: 0;
    border: 1px solid #ddd;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    color: inherit;
    display: block;
}

.tpnews-card img {
    display: block;
    width: 100%;
    aspect-ratio: 3/2;
    object-fit: cover;
}

.tpnews-card-body {
    padding: 13px 15px 17px;
    min-height: 100px;
}

.tpnews-date {
    color: #e34a16;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
}

.tpnews-title {
    font-size: 17px;
    line-height: 1.45;
    font-weight: 700;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tpnews-arrow {
    position: absolute;
    top: 40%;
    transform: translateY(-50%);
    z-index: 3;
    width: 35px;
    height: 35px;
    border: 0;
    border-radius: 50%;
    background: #f2f2f2;
    font-size: 18px;
    cursor: pointer;
}

/* 按鈕整顆移到白底卡片區（.home-news-wrap，寬度上限 1200px）外側，
   但用 min()/max() 夾住偏移量，確保視窗較窄（白底貼齊 .home-news 左右 20px 內距）時
   按鈕不會被推出瀏覽器可視範圍外（body 設有 overflow-x:hidden，超出會被裁掉） */
.tpnews-arrow.tp-prev {
    left: calc(-1 * min(45px, 20px + max(0px, (100vw - 1240px) / 2)));
}

.tpnews-arrow.tp-next {
    right: calc(-1 * min(45px, 20px + max(0px, (100vw - 1240px) / 2)));
}

.tpnews-arrow:disabled {
    opacity: .3;
    cursor: default;
}

.tpnews-dots {
    display: flex;
    justify-content: center;
    gap: 7px;
    margin: 20px 0 4px;
}

.tpnews-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 0;
    background: #ccc;
    padding: 0;
}

.tpnews-dot.is-active {
    background: #e34a16;
}

@media (max-width: 767px) {
    .tpnews-shell {
        padding: 0 30px;
    }

    .tpnews-card {
        flex-basis: calc((100% - 10px) / 2);
        border-radius: 10px;
    }

    .tpnews-title {
        font-size: 14px;
        -webkit-line-clamp: 3;
    }

    .tpnews-arrow {
        width: 30px;
        height: 30px;
    }

    .tpnews-arrow.tp-prev {
        left: -6px;
    }

    .tpnews-arrow.tp-next {
        right: -6px;
    }
}

/* ---------- 最新消息：列表頁 / 內頁 (news.html / news_detail.html 共用) ---------- */
.tpnews-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.tpnews-page.tpnews-detail {
    max-width: 1360px;
}

.tpnews-page .section-title {
    text-align: center;
    margin-bottom: 30px;
}

/* 覆寫 style.css 全域 h1 規則（該規則是設計給首頁大 Banner 用的白字/大留白/FontAwesome字型樣式，
   會讓最新消息頁的 <h1> 變成看不清楚的白色鬼影文字），這裡強制重設為一般標題樣式 */
.tpnews-page h1 {
    color: #222;
    text-shadow: none;
    padding: 0;
    font-family: Arial, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    font-size: 32px;
    text-align: left;
}

@media (max-width: 767px) {
    .tpnews-page h1 {
        font-size: 24px;
    }
}

.tpnews-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #bbb;
    background: #fff;
    border-radius: 8px;
    padding: 9px 16px;
    cursor: pointer;
    text-decoration: none;
    color: #222;
    margin-bottom: 22px;
}

.tpnews-searchbar {
    display: flex;
    gap: 8px;
    margin: 0 auto 26px;
    max-width: 560px;
}

.tpnews-searchbar input {
    flex: 1;
    padding: 12px;
    border: 1px solid #bbb;
    border-radius: 8px;
}

.tpnews-searchbar button {
    padding: 10px 18px;
    border: 1px solid #bbb;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
}

.tpnews-list-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
}

.tpnews-list-item {
    display: flex;
    gap: 20px;
    border: 1px solid #e2e2e2;
    border-radius: 14px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    padding: 20px 24px;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.tpnews-list-item:hover {
    border-color: #ccc;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .06);
}

.tpnews-list-thumb {
    flex: 0 0 200px;
    border-radius: 10px;
    overflow: hidden;
}

.tpnews-list-thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 3/2;
    object-fit: cover;
}

.tpnews-list-copy {
    flex: 1;
    min-width: 0;
}

.tpnews-list-copy h3 {
    margin: 5px 0 10px;
    font-size: 20px;
    line-height: 1.5;
}

.tpnews-list-copy p {
    color: #555;
    line-height: 1.7;
    margin: 0;
}

@media (max-width: 767px) {
    .tpnews-list-item {
        flex-direction: column;
        padding: 16px;
    }

    .tpnews-list-thumb {
        flex-basis: auto;
        width: 100%;
    }

    .tpnews-list-copy h3 {
        font-size: 17px;
    }
}

.tpnews-detail h1 {
    font-size: 32px;
    line-height: 1.35;
    margin: 10px 0 14px;
}

.tpnews-meta {
    color: #666;
    border-bottom: 1px solid #ddd;
    padding-bottom: 18px;
    margin-bottom: 28px;
}

.tpnews-article {
    font-size: 18px;
    line-height: 1.9;
}

.tpnews-article p {
    margin: 0 0 20px;
}

.tpnews-article .tpnews-text-block {
    margin: 18px 0;
}

.tpnews-article ul {
    margin: 8px 0 20px;
    padding-left: 28px;
}

.tpnews-article ul.tpnews-plain {
    list-style: none;
    padding-left: 0;
}

.tpnews-article ul:not(.tpnews-plain) {
    list-style: disc;
}

.tpnews-info-list {
    margin: 8px 0 22px;
}

.tpnews-info-row {
    display: flex;
    gap: 12px;
}

.tpnews-info-row .tpnews-label {
    font-weight: 700;
    min-width: 90px;
}

.tpnews-divider {
    border: 0;
    border-top: 1px solid #e5e5e5;
    margin: 32px 0;
    opacity: 1;
}

.tpnews-gallery figure {
    margin: 0 0 28px;
}

.tpnews-gallery img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: auto;
}

.tpnews-gallery figcaption {
    color: #666;
    font-size: 14px;
    margin-top: 8px;
    text-align: center;
}

.tpnews-prevnext {
    display: flex;
    gap: 16px;
    border-top: 1px solid #ddd;
    margin-top: 32px;
    padding-top: 20px;
}

.tpnews-prevnext button {
    flex: 1 1 0;
    min-width: 0;
    border: 0;
    background: none;
    font-size: 15px;
    line-height: 1.5;
    cursor: pointer;
    text-align: left;
    color: #222;
    word-break: break-word;
}

.tpnews-prevnext button:last-child {
    text-align: right;
}

.tpnews-prevnext button:disabled {
    opacity: .3;
    cursor: default;
}

@media (max-width: 767px) {
    .tpnews-detail h1 {
        font-size: 24px;
    }

    .tpnews-article {
        font-size: 16px;
    }

    .tpnews-prevnext {
        flex-direction: column;
    }

    .tpnews-prevnext button:last-child {
        text-align: left;
    }
}

/* ---------- 推薦遊程 (首頁新增區塊) ---------- */
.tp-recommended-tours {
    background: #F7F2E8;
    text-align: center;
    padding: 60px 20px;
}

.tp-recommended-tours .section-title h2 {
    margin: 0 0 6px;
}

.tp-recommended-tours .section-title p {
    color: #666;
    margin-bottom: 30px;
}

.tp-tour-cards {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    max-width: 900px;
    margin: 0 auto;
}

.tp-tour-card {
    position: relative;
    width: 380px;
    max-width: 100%;
    min-height: 190px;
    border-radius: 10px;
    overflow: visible;
    text-align: left;
    background: #fff;
}

.tp-tour-card__media {
    position: absolute;
    inset: 0;
    border-radius: 10px;
    overflow: hidden;
    background: #ddd;
}

.tp-tour-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tp-tour-card__media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            rgba(255, 255, 255, .97) 0%,
            rgba(255, 255, 255, .88) 36%,
            rgba(255, 255, 255, .48) 52%,
            rgba(255, 255, 255, 0) 68%);
    pointer-events: none;
}

.tp-tour-card__content {
    position: relative;
    z-index: 2;
    width: 56%;
    min-height: 190px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.tp-tour-card__badge {
    display: inline-block;
    margin-bottom: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.tp-tour-card[data-theme="hsr"] .tp-tour-card__badge {
    background: #D94A24;
}

.tp-tour-card[data-theme="tra"] .tp-tour-card__badge {
    background: #2E6F9E;
}

.tp-tour-card__title {
    margin: 0 0 12px;
    color: #222;
    font-size: 18px;
    line-height: 1.6;
    font-weight: 700;
}

.tp-tour-card__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 16px;
    border: 1px solid;
    border-radius: 999px;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.tp-tour-card[data-theme="hsr"] .tp-tour-card__button {
    color: #D94A24;
    border-color: #D94A24;
}

.tp-tour-card[data-theme="tra"] .tp-tour-card__button {
    color: #2E6F9E;
    border-color: #2E6F9E;
}

@media (max-width: 767px) {
    .tp-recommended-tours {
        padding: 36px 20px;
    }

    .tp-tour-cards {
        flex-direction: column;
        align-items: center;
        gap: 14px;
    }

    .tp-tour-card {
        width: 100%;
        max-width: 320px;
        min-height: 150px;
    }

    .tp-tour-card__content {
        width: 58%;
        min-height: 150px;
        padding: 12px;
    }

    .tp-tour-card__title {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .tp-tour-card__button {
        font-size: 12px;
        padding: 5px 12px;
    }
}

/* ---------- 素材待補提示（僅開發階段可見，方便找出待換圖） ---------- */
.tp-placeholder-flag {
    position: absolute;
    left: 8px;
    top: 8px;
    z-index: 4;
    background: rgba(233, 99, 59, .92);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    pointer-events: none;
}

/* ---------- 無障礙：Redmine #38871 新增元件的鍵盤 focus 樣式 ---------- */
.tpnews-card:focus-visible,
.tpnews-list-item:focus-visible,
.tpnews-back:focus-visible,
.tpnews-searchbar input:focus-visible,
.tpnews-searchbar button:focus-visible,
.tpnews-arrow:focus-visible,
.tpnews-dot:focus-visible,
.tpnews-prevnext button:focus-visible,
.tp-tour-card__button:focus-visible,
.tp-ai-assistant:focus-visible {
    outline: 3px solid #2E6F9E;
    outline-offset: 2px;
}
