/* ===== 兌換優惠券區塊 ===== */

/* 新增兌換券 */
.coupon-redeem-bar {
    background: #f5f5f5;
    border-radius: 4px;
    padding: 16px 20px;
}

.coupon-redeem-label {
    font-size: 1rem;
    margin-bottom: 0;
}

.coupon-redeem-group {
    max-width: 400px;
    gap: 10px;
}

.coupon-redeem-input {
    max-width: 280px;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    border-radius: 4px !important;
    margin-right: 10px;
    height: 45px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.coupon-redeem-input:focus {
    border: 1px solid #999 !important;
    box-shadow: none !important;
    outline: none;
}

.btn-coupon-add {
    background: #c00;
    color: #fff;
    border-radius: 5px !important;
    padding-left: 2rem !important;
    padding-right: 2rem !important;
    height: 45px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: 45px;
    border: none;
}

/* Tab 導航 */
.coupon-tabs {
    border-bottom: 2px solid #e0e0e0;
}

.coupon-tab {
    color: #555;
    padding: 8px 24px;
    border: none;
    background: none;
    cursor: pointer;
    margin-bottom: -2px;
}

.coupon-tab.active {
    color: #c00;
    border-bottom: 3px solid #c00;
    font-weight: bold;
    margin-bottom: -2px;
}

/* 優惠券列表間距 */
#tab-usable .row,
#tab-expired .row,
#tab-used .row {
    row-gap: 24px !important;
}

/* 優惠券卡片外層 wrapper */
.coupon-card-wrap {
    position: relative;
}

/* 無需額外元素 */

/* 優惠券卡片 */
.coupon-card {
    border-radius: 12px;
    /* overflow: hidden; */
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    background: white;
    position: relative;
}

/* 半圓凹口：定位在 coupon-card-body，不受展開影響 */
.coupon-card-body::before {
    content: '';
    position: absolute;
    left: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: white;
    border-radius: 50%;
    z-index: 3;
    box-shadow: none;
}

.coupon-card-body {
    padding: 0;
    gap: 16px;
    align-items: stretch !important;
    position: relative;
}

/* 折扣數字區 */
.coupon-discount {
    min-width: 130px;
    text-align: center;
    background: #ebebeb;
    border-radius: 11px 0 0 11px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    flex-shrink: 0;
    position: relative;
}

/* 金額＋單位同行 */
.discount-amount-wrap {
    display: flex;
    align-items: baseline;
    white-space: nowrap;
}

.coupon-discount .amount {
    font-size: 2.2rem;
    font-weight: bold;
    color: #c00;
    line-height: 1;
}

.coupon-discount .amount-lg {
    font-size: 2rem;
    font-weight: bold;
    color: #c00;
    line-height: 1;
}

.coupon-discount .unit {
    font-size: 1.1rem;
    color: #c00;
    font-weight: bold;
    padding-left: 5px;
}

.coupon-discount .unit-sm {
    font-size: 1rem;
    color: #c00;
    font-weight: bold;
    padding-left: 5px;
}

/* 虛線分隔 — 移除 */
.coupon-divider {
    display: none;
}

/* 內容區 */
.coupon-card-body .flex-grow-1 {
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    align-self: center;
}

/* 優惠券名稱 */
.coupon-name {
    font-size: 1rem;
    min-height: 2.8em;
    line-height: 1.4;
    font-weight: bold;
    width: 100%;
}

/* 有效日期 */
.coupon-date {
    font-size: 0.85rem;
}

/* 立即使用按鈕容器 */
.coupon-card-body>div:last-child {
    align-self: center;
}

/* 立即使用按鈕 */
.btn-coupon-use {
    padding: 10px 15px !important;
    background: #c00;
    color: #fff;
    border-radius: 5px;
    padding: 8px 16px;
    font-size: 0.9rem;
    white-space: nowrap;
    margin-right: 16px;
}

/* 使用規則展開按鈕 */
.coupon-rule-toggle {
    color: #555;
    background: none;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 4px 14px !important;
    font-size: 0.85rem;
    margin-top: 6px;
    width: fit-content;
}

.coupon-rule-toggle .kyicon-arrow-right {
    font-size: 0.7rem;
    transform: rotate(90deg);
    display: inline-block;
    transition: transform 0.3s ease;
}

.coupon-rule-toggle.open .kyicon-arrow-right {
    transform: rotate(270deg);
}

.coupon-rule-toggle.open {
    background: #fff0f0;
    border-color: #f5c0c0;
    color: #c00;
}

/* 使用規則內容 */
.coupon-rule-body {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    background: #fafafa;
    font-size: 0.88rem;
    color: #444;
    border-radius: 0 0 12px 12px;
    transition: max-height 0.35s ease, opacity 0.3s ease, padding 0.3s ease;
    padding: 0 20px;
}

.coupon-rule-body.show {
    max-height: 300px;
    opacity: 1;
    padding: 12px 20px;
}

.coupon-rule-body ul {
    list-style: disc;
    padding-left: 20px;
    line-height: 1.8;
}

/* ===== 已使用優惠券 ===== */
.coupon-card-used .coupon-discount {
    background: #fdf0f0;
}

.coupon-card-used .coupon-discount .amount,
.coupon-card-used .coupon-discount .amount-lg,
.coupon-card-used .coupon-discount .unit,
.coupon-card-used .coupon-discount .unit-sm {
    color: #d97070;
}

.btn-coupon-used {
    background: #fce4e4;
    color: #c00;
    border-radius: 2px;
    padding: 8px 16px !important;
    font-size: 0.9rem;
    white-space: nowrap;
    margin-right: 16px;
    border: none;
    cursor: default;
}

.btn-coupon-use:hover,
.btn-coupon-add:hover {
    color: white !important;
    background: rgb(175, 0, 0);
}

.coupon-used-note {
    font-size: 0.85rem;
    color: #c00;
}

/* ===== 已失效優惠券 ===== */
.coupon-card-expired .coupon-discount {
    background: #555;
}

.coupon-card-expired .coupon-discount .amount,
.coupon-card-expired .coupon-discount .amount-lg {
    color: #661919;
}

.coupon-card-expired .coupon-discount .unit,
.coupon-card-expired .coupon-discount .unit-sm {
    color: #661919;
}

.expired-label {
    display: inline-block;
    font-size: 1rem;
    font-weight: 600;
    color: rgb(255 255 255);
    background: none;
    margin: 3px 0;
    position: absolute;
    letter-spacing: 2px;
}

.btn-coupon-expired {
    background: #d0d0d0;
    color: #888;
    border-radius: 5px;
    padding: 8px 16px !important;
    font-size: 0.9rem;
    white-space: nowrap;
    margin-right: 16px;
    border: none;
    cursor: default;
}


@media (max-width: 992px) {
    .coupon-tab-content .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
    }
}

@media (max-width: 575px) {

    /* 折扣區縮小 */
    .coupon-discount {
        min-width: 80px;
        padding: 12px 15px;
        width: 110px;
    }

    .coupon-discount .amount {
        font-size: 1.8rem;
    }

    .coupon-discount .amount-lg {
        font-size: 1.3rem;
    }

    .coupon-discount .unit {
        font-size: 0.85rem;
        padding-left: 5px;
    }

    .coupon-discount .unit-sm {
        font-size: 0.85rem;
        padding-left: 5px;
    }

    .coupon-card-body {
        gap: 10px;
    }

    /* 內容區間距 */
    .coupon-card-body .flex-grow-1 {
        padding: 12px 0 12px 0px;
        align-items: stretch;
        min-width: 0;
    }

    /* 優惠券名稱 */
    .coupon-name {
        font-size: 0.9rem;
        min-height: unset;
        width: 100%;
    }

    /* 有效日期 */
    .coupon-date {
        font-size: 0.8rem;
    }

    .coupon-date-value {
        display: block;
    }

    /* 立即使用按鈕 */
    .btn-coupon-use,
    .btn-coupon-used,
    .btn-coupon-expired {
        margin-right: 10px;
        padding: 8px 10px !important;
        font-size: 13px !important;
    }

    .btn-coupon-use {
        font-size: 13px !important;
    }

    /* 兌換券輸入區手機版改直排 */
    .coupon-redeem-bar {
        flex-direction: column;
        align-items: flex-start !important;
        padding: 10px 14px;
        margin-bottom: 24px;
        gap: 8px;
    }

    .coupon-redeem-group {
        width: 100%;
        max-width: 100%;
        gap: 6px;
    }

    .coupon-redeem-input {
        max-width: unset;
        flex: 1;
        margin-right: 0;
        height: 40px !important;
    }

    .btn-coupon-add {
        height: 40px !important;
        line-height: 40px;
    }
}

/* ===== 查無優惠活動 Modal ===== */
.error-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease, background 0.25s ease;
}

.error-modal-overlay.is-visible {
    opacity: 1;
    background: rgba(0, 0, 0, 0.5);
}

.error-modal-box {
    background: #fff;
    border-radius: 12px;
    max-width: 300px;
    width: 90%;
    padding: 32px 24px;
    text-align: center;
    position: relative;
    transform: scale(0.85) translateY(20px);
    transition: transform 0.25s ease;
    border-top: 6px solid #c00;
}

.error-modal-overlay.is-visible .error-modal-box {
    transform: scale(1) translateY(0);
}

.error-modal-close {
    position: absolute;
    top: 5px;
    right: 7px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #555;
}

.error-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #222;
    color: #fff;
    font-size: 1.6rem;
    font-weight: bold;
    margin-bottom: 16px;
}

.error-modal-msg {
    margin-bottom: 24px;
    font-size: 1rem;
}