body.tour-page-body {
    margin: 20px;
}

.tour-shell {
    display: block;
    max-width: 1400px;
}

body.tour-page-body .container.tour-shell {
    display: block;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.tour-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.tour-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
}

.tour-topbar .lang-switch {
    position: static;
    right: auto;
    top: auto;
}

.tour-topbar .site-nav {
    margin: 0;
    justify-content: flex-end;
}

.brand-link {
    display: inline-block;
    text-decoration: none;
}

.tour-topbar .brand-logo {
    margin-bottom: 0;
    max-width: 100%;
}

.site-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.site-nav-link {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    color: #111827;
    text-decoration: none;
    font-size: 13px;
    background: #fff;
}

.site-nav-link:hover {
    background: #f3f4f6;
}

.site-nav-link.is-active {
    background: #283e8a;
    border-color: #283e8a;
    color: #fff;
}

.tour-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    color: #4b5563;
}

.tour-breadcrumb a {
    color: #283e8a;
    text-decoration: none;
}

.tour-breadcrumb a:hover {
    text-decoration: underline;
}

.tour-breadcrumb .is-active {
    color: #111827;
    font-weight: 700;
}

.tour-breadcrumb-sep {
    color: #9ca3af;
}

.tour-content {
    min-height: 240px;
}

.tour-content .public-header {
    display: none !important;
}

#tour-content .tour-info-links {
    display: none !important;
}

.tour-content .container,
.tour-content .continer,
.tour-content .main-content {
    max-width: 1400px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
    box-shadow: none;
    background: transparent;
    border-radius: 0;
    min-width: 0;
    box-sizing: border-box;
}

/* 覆蓋後端 scoped 的 #tour-content .continer { max-width: 1230px } */
#tour-content .continer,
#tour-content .main-content.continer {
    max-width: 1400px !important;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

#tour-content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
}

.tour-content .tour-detail-box {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    width: 100%;
    box-sizing: border-box;
}

.tour-content input[type="checkbox"],
.tour-content input[type="radio"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    max-width: 16px;
    margin: 0 6px 0 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
    box-shadow: none;
    vertical-align: middle;
    display: inline-block;
    appearance: auto;
    flex: none;
}

.tour-content .people-form-radio-group label,
.tour-content .people-form-checkbox-group label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    margin: 0;
}

.tour-content .unassigned-section .add-more-btn {
    display: flex;
    margin-top: 12px;
}

.tour-content #unassigned-list .person-item {
    display: flex;
    min-height: 40px;
    visibility: visible;
}

.tour-content .main-content {
    padding-top: 0;
}

/* 列表：隱藏「更多xxx旅行團」 */
#tour-content .tour-box-header-more {
    display: none !important;
}

#tour-content .tour-box {
    margin-bottom: 36px;
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#tour-content .tour-carousel {
    position: relative;
    margin-top: 20px;
    padding: 0 44px;
    overflow: visible;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#tour-content .tour-carousel.is-single {
    padding: 0;
}

/* 預留陰影空間，避免 overflow:hidden 裁切上下左右 box-shadow */
#tour-content .tour-carousel-viewport {
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 12px 10px;
}

#tour-content .tour-carousel-track.tour-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 14px;
    margin-top: 0;
    justify-content: flex-start;
    will-change: transform;
    min-width: 0;
}

#tour-content .tour-carousel-track .tour-item {
    flex: 0 0 calc((100% - 56px) / 5);
    width: calc((100% - 56px) / 5);
    max-width: 100%;
    min-width: 0; /* 覆蓋 flex 預設 min-width:auto，否則會被 222px 內容撐住 */
    box-sizing: border-box;
}

/* 覆蓋後端固定 222px，改為隨卡片寬度縮放 */
#tour-content .tour-item-img,
#tour-content .tour-carousel-track .tour-item-img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
}

#tour-content .good-info,
#tour-content .tour-carousel-track .good-info {
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0;
    box-sizing: border-box;
}

#tour-content .good-use {
    min-width: 0;
    gap: 6px;
}

#tour-content .use-tip,
#tour-content .use-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tour-content .goods-name {
    word-break: break-word;
    overflow-wrap: anywhere;
}

#tour-content .tour-carousel-btn {
    position: absolute;
    top: 111px;
    z-index: 3;
    width: 40px;
    height: 40px;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #fff;
    color: #283e8a;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18);
    padding: 0;
}

#tour-content .tour-carousel-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

#tour-content .tour-carousel-btn:hover {
    background: #283e8a;
    border-color: #283e8a;
    color: #fff;
}

#tour-content .tour-carousel-btn:disabled,
#tour-content .tour-carousel-btn[hidden] {
    display: none;
}

#tour-content .tour-carousel-btn-prev {
    left: 0;
}

#tour-content .tour-carousel-btn-next {
    right: 0;
}

.tour-error-box {
    padding: 28px 22px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    border-radius: 10px;
    color: #7f1d1d;
}

.tour-error-box h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.tour-error-box p {
    margin: 0 0 8px;
}

.tour-error-hint {
    font-size: 12px;
    color: #991b1b;
}

.tour-error-hint code {
    word-break: break-all;
}

.tour-error-actions {
    margin-top: 14px;
}

.tour-error-actions .btn-outline {
    display: inline-block;
    text-decoration: none;
}

/* SweetAlert v1（後端 swal 確認框）樣式優化 */
.sweet-overlay {
    background: rgba(17, 24, 39, 0.45);
    z-index: 10000;
}

.sweet-alert {
    z-index: 10001;
    border-radius: 12px;
    padding: 28px 24px 20px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
    font-family: Arial, "Microsoft JhengHei", "PingFang TC", sans-serif;
}

.sweet-alert h2 {
    margin: 12px 0 8px;
    color: #111827;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.35;
}

.sweet-alert p {
    color: #4b5563;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.55;
}

/* 非 input 類型時隱藏內建輸入與英文驗證字，避免缺 CSS 時露出長條與 Not valid! */
.sweet-alert:not(.input-field) .form-group,
.sweet-alert:not(.input-field) input,
.sweet-alert:not(.input-field) .sa-error-container,
.sweet-alert:not(.input-field) .sa-input-error {
    display: none !important;
}

.sweet-alert .sa-error-container {
    background-color: #fef2f2;
    border-radius: 8px;
    margin-top: 10px;
    padding: 8px 10px;
}

.sweet-alert .sa-error-container p {
    color: #b91c1c;
    font-size: 13px;
    font-weight: 600;
}

.sweet-alert .sa-error-container.show {
    display: block !important;
}

.sweet-alert button {
    min-width: 96px;
    padding: 10px 18px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    box-shadow: none !important;
    margin: 16px 6px 0 !important;
}

.sweet-alert button.cancel {
    background-color: #e5e7eb !important;
    color: #374151 !important;
    border: 1px solid #d1d5db !important;
}

.sweet-alert button.cancel:hover {
    background-color: #d1d5db !important;
}

.sweet-alert button.confirm {
    background-color: #08ab7c !important;
    border: 1px solid #08ab7c !important;
}

.sweet-alert button.confirm:hover {
    filter: brightness(0.96);
}

@media (max-width: 768px) {
    body.tour-page-body {
        margin: 8px;
    }

    body.tour-page-body .container.tour-shell {
        padding: 14px 12px 18px;
        border-radius: 8px;
    }

    .tour-topbar {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        gap: 10px;
        margin-bottom: 6px;
    }

    .tour-topbar .brand-link {
        flex: 1 1 auto;
        min-width: 0;
    }

    .tour-topbar .brand-logo {
        width: min(200px, 52vw);
        height: auto;
    }

    .tour-topbar-actions {
        width: auto;
        margin-left: 0;
        flex: 0 0 auto;
        gap: 6px;
    }

    .site-nav {
        width: auto;
        flex: none;
    }

    .site-nav-link,
    .tour-topbar .lang-btn {
        padding: 6px 10px;
        font-size: 12px;
        white-space: nowrap;
    }

    .tour-breadcrumb {
        margin-bottom: 12px;
        padding: 8px 10px;
        font-size: 12px;
        gap: 6px;
    }

    .tour-content .tour-detail-box {
        flex-direction: column;
        gap: 16px;
    }

    /* 後端在窄屏把左右欄設成 flex: 1 1 100%，欄高被壓到比內容更矮，縮圖會蓋住團名 */
    #tour-content .tour-detail-box {
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        align-items: stretch;
    }

    #tour-content .tour-left,
    #tour-content .tour-info {
        flex: 0 0 auto !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    #tour-content .tour-info-title {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    #tour-content .tour-box {
        margin-bottom: 28px;
    }

    #tour-content .tour-box-header-title {
        font-size: 20px !important;
        line-height: 1.35 !important;
    }

    #tour-content .tour-carousel {
        margin-top: 14px;
        padding: 0 40px;
    }

    #tour-content .tour-carousel.is-single-col {
        padding: 0;
    }

    #tour-content .tour-carousel-viewport {
        overflow: hidden;
        touch-action: pan-y;
    }

    #tour-content .tour-carousel-track.tour-list {
        gap: 12px;
    }

    #tour-content .tour-carousel-track .tour-item {
        flex-basis: auto;
        width: auto;
        max-width: none;
        padding: 4px;
    }

    #tour-content .tour-item-img {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
    }

    #tour-content .good-info {
        max-width: none;
        width: 100%;
    }

    #tour-content .goods-name {
        font-size: 13px;
        line-height: 1.4;
        min-height: 2.8em;
    }

    #tour-content .use-tip,
    #tour-content .use-name {
        font-size: 12px;
    }

    #tour-content .day-num,
    #tour-content .price-num {
        font-size: 20px;
    }

    #tour-content .day-unit,
    #tour-content .price-unit,
    #tour-content .price-unit-start {
        font-size: 12px;
    }

    /* 窄屏按鈕疊在邊緣；雙列以上仍留側邊空間 */
    #tour-content .tour-carousel-btn {
        width: 32px;
        height: 32px;
        background: rgba(255, 255, 255, 0.92);
        box-shadow: 0 2px 10px rgba(15, 23, 42, 0.16);
    }

    #tour-content .tour-carousel-btn svg {
        width: 18px;
        height: 18px;
    }

    #tour-content .tour-carousel.is-single-col .tour-carousel-btn-prev {
        left: 4px;
    }

    #tour-content .tour-carousel.is-single-col .tour-carousel-btn-next {
        right: 4px;
    }

    .footer-note {
        font-size: 11px;
        margin-top: 16px;
        line-height: 1.5;
    }

    .sweet-alert {
        width: calc(100% - 24px) !important;
        margin-left: 12px !important;
        margin-right: 12px !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        box-sizing: border-box;
        padding: 22px 16px 16px;
    }

    .sweet-alert h2 {
        font-size: 18px;
    }

    .sweet-alert button {
        min-width: 84px;
        margin: 14px 4px 0 !important;
    }
}

@media (max-width: 420px) {
    body.tour-page-body {
        margin: 6px;
    }

    body.tour-page-body .container.tour-shell {
        padding: 12px 10px 16px;
    }

    .tour-topbar .brand-logo {
        width: min(168px, 48vw);
    }

    #tour-content .tour-box-header-title {
        font-size: 18px !important;
    }
}
