/* 密碼頁強制隱藏整個浮窗（雙重保險） */
.template-password #min-weight-floater,
body[data-template="password"] #min-weight-floater {
    display: none !important;
}

/* ====================== 20KG 浮動提醒器 – 電腦端最終版（≥769px）– 面板緊貼正下方 ====================== */
@media (min-width: 769px) {

    #min-weight-floater.logged-in {
        display: block !important;
        visibility: visible !important;
    }

    .min-weight-floater {
        position: fixed;
        top: 20vh;
        right: 15px;
        z-index: 9999;
        cursor: move;
        user-select: none;
        font-family: var(--body-font, sans-serif);
        contain: layout style;
        transform: translateZ(0);
    }

    .min-weight-floater.left {
        left: 15px !important;
        right: auto !important;
    }

    .min-weight-floater__wrapper {
        position: relative;
        width: 90px;
        height: 90px;
    }

    .min-weight-floater__flower {
        width: 90px;
        height: 90px;
        border-radius: 50%;
        background: #fff url('https://img.myshopline.com/image/store/1762062422157/-(-).png?w=350&h=350') center/78% no-repeat;
        box-shadow: 0 8px 30px rgba(0, 0, 0, .22);
        border: 5px solid #fff;
        transition: filter .6s ease;
    }

    .min-weight-floater:not(.success) .min-weight-floater__flower {
        filter: grayscale(100%) brightness(.7);
    }

    /* ====================== 氣泡文字（內側顯示）====================== */
    .min-weight-floater__text {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background: #333;
        color: #fff;
        padding: 14px 22px;
        border-radius: 999px;
        font-size: 15px;
        font-weight: 600;
        line-height: 1.4;
        white-space: nowrap;
        min-width: 200px;
        max-width: calc(100vw - 180px);
        pointer-events: none;
        box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
        z-index: 10;
    }

    .min-weight-floater:not(.left) .min-weight-floater__text {
        right: 105px;
        left: auto;
    }

    .min-weight-floater:not(.left) .min-weight-floater__text::after {
        content: '';
        position: absolute;
        top: 50%;
        right: -20px;
        transform: translateY(-50%);
        border: 12px solid transparent;
        border-left-color: #333;
    }

    .min-weight-floater.left .min-weight-floater__text {
        left: 105px;
        right: auto;
    }

    .min-weight-floater.left .min-weight-floater__text::after {
        content: '';
        position: absolute;
        top: 50%;
        left: -20px;
        transform: translateY(-50%);
        border: 12px solid transparent;
        border-right-color: #333;
    }

    .min-weight-floater.success .min-weight-floater__text {
        background: #4caf50;
    }

    .min-weight-floater.success:not(.left) .min-weight-floater__text::after {
        border-left-color: #4caf50;
    }

    .min-weight-floater.success.left .min-weight-floater__text::after {
        border-right-color: #4caf50;
    }

    /* ====================== 重點修正：面板緊貼浮窗正下方！====================== */
    .min-weight-panel {
        position: absolute;
        top: 100% !important;
        /* 緊貼浮窗底部 */
        left: 50% !important;
        transform: translateX(-95%) !important;
        /* 水平置中對齊浮窗 */
        margin-top: 12px !important;
        /* 與浮窗保持一點呼吸感 */
        width: 380px;
        max-width: 94vw;
        background: white;
        border-radius: 16px;
        box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
        padding: 20px;
        font-size: 14px;
        line-height: 1.8;
        z-index: 9999;
        max-height: 70vh;
        overflow-y: auto;
        display: none;
    }

    .min-weight-panel.show {
        display: block;
    }

    /* 如果螢幕太窄或拖太上面，自動往上翻（避免被切掉） */
    .min-weight-panel.upward {
        top: auto !important;
        bottom: 100% !important;
        margin-top: 0 !important;
        margin-bottom: 12px !important;
    }

    .min-weight-panel .item {
        display: flex;
        justify-content: space-between;
        padding: 10px 0;
        border-bottom: 1px solid #eee;
    }

    .min-weight-panel .item:last-child {
        border-bottom: none;
    }


    /* ====================== 成功特效 ====================== */
    @keyframes rippleStrong {
        0% {
            box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.9), 0 0 0 0 rgba(255, 223, 0, 0.7);
        }

        70% {
            box-shadow: 0 0 0 22px rgba(255, 193, 7, 0), 0 0 0 38px rgba(255, 223, 0, 0);
        }

        100% {
            box-shadow: 0 0 0 26px rgba(255, 193, 7, 0), 0 0 0 44px rgba(255, 223, 0, 0);
        }
    }

    @keyframes breathe {

        0%,
        100% {
            transform: scale(1);
        }

        50% {
            transform: scale(1.065);
        }
    }

    .min-weight-floater.success .min-weight-floater__flower {
        position: relative !important;
        overflow: visible !important;
        filter: none !important;
        animation: breathe 4s infinite ease-in-out;
    }

    .min-weight-floater.success .min-weight-floater__flower::after {
        content: '';
        position: absolute;
        inset: -12px;
        border-radius: 50%;
        pointer-events: none;
        z-index: -1;
        box-shadow:
            0 0 30px rgba(255, 193, 7, 0.8),
            0 0 0 0 rgba(255, 193, 7, 0.9),
            0 0 0 8px rgba(255, 223, 0, 0.7);
        animation: rippleStrong 2.6s infinite ease-out;
    }


}



/* ====================== 手機端 – 真·最終完美版（≤768px）====================== */
@media (max-width: 768px) {

  /* ───── 浮窗主體（永遠穩在左下角） ───── */
  #min-weight-floater,
  .min-weight-floater {
    position: fixed !important;
    bottom: 70px !important;
    left: 14px !important;
    top: auto !important;
    right: auto !important;
    z-index: 9 !important;
    display: block !important;
  }

  .min-weight-floater__wrapper {
    position: relative !important;
    width: 68px !important;
    height: 68px !important;
  }

  /* ───── 圖標 + 完整特效（跟電腦端 100% 一致） ───── */
  .min-weight-floater__flower {
    width: 68px !important;
    height: 68px !important;
    border-radius: 50% !important;
    background: #fff url('https://img.myshopline.com/image/store/1762062422157/-(-).png?w=350&h=350') center/70% no-repeat !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .22) !important;
    border: 4px solid #fff !important;
    transition: filter .6s ease !important;
  }

  /* 未達20KG → 灰色 */
  .min-weight-floater:not(.success) .min-weight-floater__flower {
    filter: grayscale(100%) brightness(.7) !important;
  }

  /* 達標 → 金色波紋 + 呼吸 */
  @keyframes rippleStrong {
    0% {
      box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.9), 0 0 0 0 rgba(255, 223, 0, 0.7);
    }

    70% {
      box-shadow: 0 0 0 22px rgba(255, 193, 7, 0), 0 0 0 38px rgba(255, 223, 0, 0);
    }

    100% {
      box-shadow: 0 0 0 26px rgba(255, 193, 7, 0), 0 0 0 44px rgba(255, 223, 0, 0);
    }
  }

  @keyframes breathe {

    0%,
    100% {
      transform: scale(1);
    }

    50% {
      transform: scale(1.065);
    }
  }

  .min-weight-floater.success .min-weight-floater__flower {
    position: relative !important;
    overflow: visible !important;
    filter: none !important;
    animation: breathe 4s infinite ease-in-out !important;
  }

  .min-weight-floater.success .min-weight-floater__flower::after {
    content: '' !important;
    position: absolute !important;
    inset: -12px !important;
    border-radius: 50% !important;
    pointer-events: none !important;
    z-index: -1 !important;
    box-shadow:
      0 0 30px rgba(255, 193, 7, 0.8),
      0 0 0 0 rgba(255, 193, 7, 0.9),
      0 0 0 8px rgba(255, 223, 0, 0.7) !important;
    animation: rippleStrong 2.6s infinite ease-out !important;
  }

  /* ───── 氣泡文字（右側 + 箭頭向左） ───── */
  .min-weight-floater__text {
    position: absolute !important;
    top: 50% !important;
    left: 80px !important;
    transform: translateY(-50%) !important;
    min-width: 165px !important;
    max-width: calc(100vw - 110px) !important;
    padding: 11px 18px !important;
    font-size: 13.8px !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    background: #333 !important;
    color: #fff !important;
    border-radius: 999px !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .25) !important;
    pointer-events: none !important;
    z-index: 10 !important;
  }

  .min-weight-floater__text::after {
    content: "" !important;
    position: absolute !important;
    top: 50% !important;
    left: -20px !important;
    transform: translateY(-50%) !important;
    border: 12px solid transparent !important;
    border-right-color: #333 !important;
  }

  .min-weight-floater.success .min-weight-floater__text {
    background: #4caf50 !important;
  }

  .min-weight-floater.success .min-weight-floater__text::after {
    border-right-color: #4caf50 !important;
  }

  /* ───── 手機端面板：文字縮小 ───── */
  .min-weight-panel {
    position: fixed !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    bottom: 150px !important;
    width: 380px !important;
    max-width: calc(100vw - 40px) !important;
    background: white !important;
    border-radius: 16px !important;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.35) !important;
    padding: 20px !important;
    max-height: calc(100vh - 180px) !important;
    overflow-y: auto !important;
    z-index: 99999 !important;
    display: none !important;
    font-size: 13px !important;
    /* 整體基底字體縮小 */
    line-height: 1.55 !important;
  }

  .min-weight-panel.show {
    display: block !important;
  }

  .min-weight-panel__list {
    max-height: none !important;
    overflow: visible !important;
  }

  /* 針對 footer 內各重點文字縮小（覆蓋 inline style） */
  .min-weight-panel__footer>div[style*="font-size:20px"] {
    font-size: 17px !important;
    /* Total Weight */
  }

  .min-weight-panel__footer>div[style*="font-size:24px"] {
    font-size: 20px !important;
    /* 綠色成功大字 */
  }

  .min-weight-panel__footer>div[style*="font-size:19px"] {
    font-size: 16px !important;
    /* 紅色警告文字 */
  }

  .min-weight-panel__footer>div[style*="font-size:17px"] {
    font-size: 14.5px !important;
    /* Current Rate & Estimated Shipping */
  }

  .min-weight-panel__footer>div[style*="font-size:14px"] {
    font-size: 12.5px !important;
    /* Important 提示框 + 小字註解 */
  }

  /* 實際重量小字提示（更細） */
  .min-weight-panel__footer>div[style*="color:#666"] {
    font-size: 11.5px !important;
  }

  .weight-warning {
    font-size: 14px !important;
    /* 結帳按鈕警告文字也微縮 */
    padding: 12px 18px !important;
    min-height: 48px !important;
  }
}


/*全局設定*/

/* 全局最底層 z-index（兩端共用） */
#min-weight-floater {
    z-index: 9 !important;
}

/* ==================== 面板商品列表：固定最多顯示 4 個商品，超出就滾動 ==================== */
.min-weight-panel__list {
    max-height: 180px !important;
    /* 4 個商品 × 約 62px 高度（含 padding + border） */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-right: 8px !important;
    /* 留一點空間給滾動條，避免文字被擋 */
    scrollbar-width: thin;
    /* Firefox 細滾動條 */
}

/* Webkit 瀏覽器（Chrome/Safari/手機）美化滾動條 */
.min-weight-panel__list::-webkit-scrollbar {
    width: 6px !important;
}

.min-weight-panel__list::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
    border-radius: 10px !important;
}

.min-weight-panel__list::-webkit-scrollbar-thumb {
    background: #c1c1c1 !important;
    border-radius: 10px !important;
}

.min-weight-panel__list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8 !important;
}

/* 每個商品項目高度統一（確保正好 4 個就填滿） */
.min-weight-panel .item {
    min-height: 56px !important;
    padding: 12px 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

    /* ==================== 新增：未滿20KG 結帳按鈕紅色強烈警告樣式 ==================== */
    .weight-warning {
        background: linear-gradient(135deg, #d32f2f, #c62828) !important;
        color: #ffffff !important;
        border: none !important;
        box-shadow: 0 4px 20px rgba(211, 47, 47, 0.5) !important;
        animation: warningPulse 2.2s infinite ease-in-out !important;
        font-weight: 700 !important;
        position: relative !important;
        overflow: hidden !important;
        transition: all 0.3s ease !important;
    }

    .weight-warning:hover,
    .weight-warning:focus {
        background: linear-gradient(135deg, #c62828, #b71c1c) !important;
        transform: translateY(-2px) !important;
        box-shadow: 0 8px 25px rgba(211, 47, 47, 0.6) !important;
    }

    /* 強烈跳動動畫（讓人無法忽略） */
    @keyframes warningPulse {
        0% {
            transform: scale(1);
        }

        50% {
            transform: scale(1.04);
        }

        100% {
            transform: scale(1);
        }
    }

    /* 可選：加上紅色閃光條從左到右掃過（超顯眼） */
    .weight-warning::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 50%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
        animation: warningShine 3s infinite;
        pointer-events: none;
    }

    @keyframes warningShine {
        0% {
            left: -100%;
        }

        100% {
            left: 100%;
        }
    }
