/* 主容器：預設隱藏，使用 opacity 達成進場動畫 */
#jhl-floating-banner-container {
    position: fixed;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-sizing: border-box;
}

#jhl-floating-banner-container * {
    box-sizing: border-box;
}

/* 顯示時的狀態 */
#jhl-floating-banner-container.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 折疊狀態 */
#jhl-floating-banner-container.collapsed .jhl-floating-wrapper {
    display: none;
}
#jhl-floating-banner-container.collapsed .jhl-floating-toggle-handle {
    display: flex;
}

/* 折疊喚醒按鈕 */
.jhl-floating-toggle-handle {
    display: none;
    align-items: center;
    justify-content: center;
    background-color: #DD8703;
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    user-select: none;
    gap: 8px; /* 文字與箭頭間距 */
}

.jhl-floating-toggle-handle:hover {
    background-color: #C07502;
}

/* 關閉按鈕 */
.jhl-floating-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #333;
    color: #fff;
    font-size: 16px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
    font-weight: bold;
    user-select: none;
}

.jhl-floating-close:hover {
    background-color: #000;
}

/* 包裝內容與卡片 */
.jhl-floating-wrapper {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    gap: 10px;
    background: rgba(255, 255, 255, 0.97); /* 提高不透明度作為 backdrop-filter 的回退 */
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.jhl-carousel-track {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.jhl-carousel-btn {
    display: none;
}

.jhl-floating-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.jhl-floating-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
    margin-bottom: 2px;
}

.jhl-floating-links {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.jhl-floating-btn {
    text-decoration: none !important;
    font-size: 12px;
    color: #fff !important;
    background-color: #DD8703 !important;
    padding: 6px 10px;
    border-radius: 4px;
    line-height: 1.2;
    white-space: nowrap;
    transition: background-color 0.2s ease;
    flex: 1;
    text-align: center;
    border: none !important;
    box-shadow: none !important;
}

.jhl-floating-btn:hover {
    background-color: #C07502 !important;
    color: #fff !important;
}

/* =========================================
   電腦版樣式 (右下角懸浮卡片)
   ========================================= */
@media (min-width: 768px) {
    #jhl-floating-banner-container {
        bottom: 20px;
        right: 20px;
        max-width: 320px;
    }
    
    .jhl-floating-wrapper {
        border-radius: 8px;
        padding: 15px;
    }

    .jhl-floating-card {
        padding-bottom: 10px;
        border-bottom: 1px dashed #ddd;
    }

    .jhl-floating-card:last-child {
        padding-bottom: 0;
        border-bottom: none;
    }
}

/* =========================================
   手機版樣式 (置底滿版)
   ========================================= */
@media (max-width: 767px) {
    #jhl-floating-banner-container {
        bottom: 0;
        left: 0;
        width: 100%;
    }

    .jhl-floating-close {
        top: -30px;
        right: 10px;
        width: 25px;
        height: 25px;
        line-height: 25px;
        background-color: rgba(0,0,0,0.5);
    }
    
    .jhl-floating-toggle-handle {
        border-radius: 20px 20px 0 0;
        padding: 4px 30px;
        width: -webkit-fit-content;
        width: -moz-fit-content;
        width: fit-content;
        margin: 0 auto;
        font-size: 20px;
    }

    .jhl-toggle-text {
        display: none;
    }

    .jhl-floating-wrapper {
        border-radius: 12px 12px 0 0;
        padding: 10px 30px; /* 預留左右按鈕空間 */
        position: relative;
        overflow: hidden;
    }
    
    .jhl-carousel-track {
        -webkit-box-orient: horizontal;
        -webkit-box-direction: normal;
        -ms-flex-direction: row;
        flex-direction: row;
        -ms-flex-wrap: nowrap;
        flex-wrap: nowrap;
        gap: 0;
        -webkit-transition: -webkit-transform 0.4s ease-in-out;
        transition: transform 0.4s ease-in-out;
        width: 100%;
    }

    .jhl-floating-card {
        flex: 0 0 100%;
        min-width: 100%;
        box-sizing: border-box;
        padding: 5px 2px;
        border-bottom: none;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .jhl-carousel-btn {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 24px;
        height: 36px;
        background: rgba(255,255,255,0.8);
        color: #666;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 5;
        cursor: pointer;
        border-radius: 4px;
        font-weight: bold;
        user-select: none;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    .jhl-carousel-prev { left: 4px; }
    .jhl-carousel-next { right: 4px; }

    .jhl-floating-title {
        flex: 1;
        font-size: 14px;
        margin-bottom: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: left;
    }

    .jhl-floating-links {
        flex: 0 0 auto;
        flex-wrap: nowrap;
    }

    .jhl-floating-btn {
        font-size: 13px;
        padding: 6px 14px;
        border-radius: 50px; /* 膠囊狀圓角按鈕 */
    }
}
