/* 优惠券 / 代金券共用选择组件 + 价格计算器侧边栏扩展 */

/* ---------- 入口行 ---------- */
.rak-discount-summary {
    margin: 12px 0;
}

.rak-discount-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 14px;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s;
}

.rak-discount-row + .rak-discount-row {
    margin-top: 10px;
}

.rak-discount-row:hover {
    border-color: #FF5500;
}

.rak-discount-row-icon {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: #fff3eb;
    color: #ff5500;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.rak-discount-row-body {
    flex: 1;
    min-width: 0;
}

.rak-discount-row-title {
    font-size: 14px;
    font-weight: 600;
    color: #141414;
    line-height: 1.4;
}

.rak-discount-row-summary {
    margin-top: 4px;
    font-size: 13px;
    color: #999;
    line-height: 1.4;
}

.rak-discount-row-summary.has-discount {
    color: #ff5500;
}

.rak-discount-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.rak-discount-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    background: #fff3eb;
    color: #ff5500;
    border: 1px solid #ffd8bf;
    font-size: 12px;
    line-height: 1.4;
}

.rak-discount-row-arrow {
    flex: 0 0 auto;
    color: #bbb;
    font-size: 14px;
    align-self: center;
}

/* ---------- 右侧抽屉 ---------- */
.rak-discount-modal {
    position: fixed;
    inset: 0;
    z-index: 10060;
    visibility: hidden;
    pointer-events: none;
}

.rak-discount-modal.is-open {
    visibility: visible;
    pointer-events: auto;
}

body.rak-discount-drawer-open {
    overflow: hidden;
}

.rak-discount-modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.28s ease;
}

.rak-discount-modal.is-open .rak-discount-modal-mask {
    opacity: 1;
}

.rak-discount-modal-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(520px, 92vw);
    height: 100%;
    max-height: none;
    margin: 0;
    background: #fff;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: -6px 0 28px rgba(0, 0, 0, 0.16);
    transform: translateX(100%);
    transition: transform 0.28s ease;
}

.rak-discount-modal.is-open .rak-discount-modal-panel {
    transform: translateX(0);
}

.rak-discount-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: none;
}

.rak-discount-modal-header-left {
    flex: 1;
    min-width: 0;
}

.rak-discount-modal-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.rak-discount-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #141414;
}

.rak-discount-modal-more {
    font-size: 13px;
    color: #4096ff;
    text-decoration: none;
    white-space: nowrap;
    border: none;
    background: unset;
}

.rak-discount-modal-more:hover {
    color: #1677ff;
    text-decoration: none;
}

.rak-discount-modal-close {
    border: 0;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
}

.rak-discount-modal-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.rak-discount-tab {
    border: 0;
    background: transparent;
    padding: 8px 4px;
    margin-right: 16px;
    border-radius: 0;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.rak-discount-tab.is-active {
    background: transparent;
    color: #ff5500;
    font-weight: 600;
    border-bottom-color: #ff5500;
}

.rak-discount-tab-refresh {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
}

.rak-discount-modal-body {
    flex: 1;
    overflow: auto;
    padding: 10px 16px 12px;
}

.rak-discount-section + .rak-discount-section {
    margin-top: 16px;
}

.rak-discount-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.rak-discount-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #141414;
}

.rak-discount-toggle-unavailable {
    border: 0;
    background: transparent;
    color: #4096ff;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}

.rak-discount-toggle-unavailable:hover {
    color: #1677ff;
}

.rak-discount-card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rak-discount-card {
    position: relative;
    display: flex;
    align-items: stretch;
    min-height: 76px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.2s ease;
}

.rak-discount-card.is-available:hover {
    border-color: #ff5500;
}

.rak-discount-card.is-unavailable {
    cursor: not-allowed;
    background: #fff;
}

.rak-discount-card.is-unavailable:hover {
    border-color: #e8e8e8;
}

.rak-discount-card.is-selected {
    border-color: #ff5500;
    box-shadow: none;
    background: #fff;
}

.rak-discount-card-amount {
    flex: 0 0 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    min-height: 76px;
    padding: 12px 8px;
    background: #f5f5f5;
    color: #999;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

.rak-discount-card.is-available .rak-discount-card-amount {
    background: #fff7f0;
    color: #141414;
}

.rak-discount-card.is-unavailable .rak-discount-card-amount {
    background: #f5f5f5;
    color: #999;
}

.rak-discount-card-info {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 76px;
    padding: 12px 8px 12px 14px;
    min-width: 0;
    box-sizing: border-box;
}

.rak-discount-card-type {
    display: none;
}

.rak-discount-card-badges {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 4px;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
    z-index: 2;
    pointer-events: none;
}

.rak-discount-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 2px;
    font-size: 11px;
    line-height: 1.4;
    font-weight: 400;
    color: #ff5500;
    background: #fff1e6;
    border: 0;
    white-space: nowrap;
}

.rak-discount-badge-renewal,
.rak-discount-badge-nostack {
    color: #ff5500;
    background: #fff1e6;
    border: 0;
}

.rak-discount-card-name {
    font-size: 14px;
    color: #141414;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 2px;
    padding-right: 0;
}

.rak-discount-card-subtitle {
    font-size: 12px;
    color: #999;
    font-weight: 400;
    line-height: 1.5;
    margin-bottom: 2px;
}

.rak-discount-card-limit {
    font-size: 12px;
    color: #999;
    font-weight: 400;
    line-height: 1.5;
}

.rak-discount-card-reason {
    font-size: 12px;
    color: #ff4d4f;
    font-weight: 400;
    line-height: 1.5;
}

/* 被其它账单占用：提示为蓝色链接，可跳转到占用账单 */
.rak-discount-card-reason .rak-discount-claimed-link {
    color: #1677ff;
    text-decoration: underline;
}

.rak-discount-card-reason .rak-discount-claimed-link:hover {
    color: #4096ff;
}

.rak-discount-card-date {
    font-size: 12px;
    color: #999;
}

.rak-discount-card-select {
    flex: 0 0 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    padding: 0 12px 0 4px;
    position: relative;
    box-sizing: border-box;
}

.rak-discount-card-select.has-badges {
    justify-content: center;
    align-items: center;
}

.rak-discount-card-select input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}

.rak-discount-card-check {
    width: 18px;
    height: 18px;
    border: 1px solid #d9d9d9;
    border-radius: 50%;
    background: #fff;
    display: inline-block;
    position: relative;
    flex-shrink: 0;
}

.rak-discount-card.is-available:hover .rak-discount-card-check {
    border-color: #ff5500;
}

.rak-discount-card.is-selected .rak-discount-card-check {
    border-color: #ff5500;
    background: #ff5500;
}

.rak-discount-card.is-selected .rak-discount-card-check::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.rak-discount-card.is-unavailable .rak-discount-card-check {
    background: #f5f5f5;
    border-color: #d9d9d9;
}

.rak-discount-empty {
    text-align: center;
    color: #999;
    padding: 24px 0;
    font-size: 13px;
}

.rak-discount-modal-footer {
    border-top: 1px solid #f0f0f0;
    padding: 12px 16px 16px;
    background: #fafafa;
}

.rak-discount-price-lines {
    margin-bottom: 12px;
}

.rak-discount-price-line {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #666;
    line-height: 1.8;
}

.rak-discount-price-line .value {
    color: #333;
}

.rak-discount-price-line.discount .value {
    color: #ff5500;
}

.rak-discount-price-line.total {
    font-size: 16px;
    font-weight: 700;
    color: #141414;
    margin-top: 4px;
}

.rak-discount-price-line.total .value {
    color: #ff5500;
    font-size: 18px;
}

.rak-discount-price-line .strike {
    text-decoration: line-through;
    color: #999;
}

.rak-discount-modal-actions {
    display: flex;
    gap: 12px;
}

.rak-discount-modal-actions .btn {
    flex: 1;
    min-height: 40px;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 400;
}

.rak-discount-modal-actions .btn-clear {
    background: #fff;
    border: 1px solid #d9d9d9;
    color: #333;
}

.rak-discount-modal-actions .btn-clear:hover {
    border-color: #4096ff;
    color: #4096ff;
}

.rak-discount-modal-actions .btn-confirm {
    background: #ff5500;
    border: 1px solid #ff5500;
    color: #fff;
    font-weight: 600;
}

.rak-discount-modal-actions .btn-confirm:hover {
    background: #e64a00;
    border-color: #e64a00;
}

/* ---------- 获取最新价格按钮（手动算价） ---------- */
.rak-discount-fetch-price {
    display: block;
    width: 100%;
    min-height: 38px;
    margin-bottom: 12px;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 500;
    background: #fff;
    border: 1px solid #ff5500;
    color: #ff5500;
    cursor: pointer;
    transition: background-color .15s ease, opacity .15s ease;
}

.rak-discount-fetch-price:hover {
    background: #fff7f2;
}

.rak-discount-fetch-price.is-loading,
.rak-discount-fetch-price:disabled {
    opacity: .6;
    cursor: not-allowed;
    background: #fff;
}

.rak-discount-fetch-price.is-loading::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 6px;
    border: 2px solid #ff5500;
    border-top-color: transparent;
    border-radius: 50%;
    vertical-align: -1px;
    animation: rakFetchPriceSpin .7s linear infinite;
}

@keyframes rakFetchPriceSpin {
    to { transform: rotate(360deg); }
}

/* 价格待刷新提示（勾选变动后、点按钮前） */
.rak-discount-price-stale {
    font-size: 13px;
    color: #ff8a3d;
    line-height: 1.8;
    padding: 6px 0;
    text-align: center;
}

/* ---------- 账单页 ---------- */
.rak-invoice-discount-mount {
    margin: 0 0 12px;
}

/* ---------- 价格计算器侧边栏 ---------- */
.rak-calculator-sidebar-tail {
    padding: 0 12px 12px;
}

.rak-calculator-disclaimer {
    margin-top: 12px;
    padding: 0 2px;
    font-size: 12px;
    line-height: 1.5;
    color: #999;
    text-align: left;
}

.rak-calculator-discount-mount {
    margin-top: 10px;
    margin-bottom: 6px;
}

.rak-calculator-coupon-summary {
    margin: 0;
}

.rak-calculator-coupon-summary .rak-discount-row {
    border: 1px dashed #ff5500;
    border-radius: 4px;
    background: #fffaf5;
    gap: 0;
    padding: 10px 12px;
    transition: background-color 0.2s ease;
}

.rak-calculator-coupon-summary .rak-discount-row:hover {
    background: #fff5eb;
}

.rak-calculator-coupon-summary .rak-discount-row-icon {
    display: none;
}

.rak-order-summary-extras {
    margin-top: 18px;
    padding-top: 0;
    border-top: none;
}

.rak-extras-section + .rak-extras-section {
    margin-top: 12px;
}

.rak-extras-title {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #141414;
    margin-bottom: 8px;
}

.rak-extras-notes {
    margin-top: 4px;
    padding: 0 2px;
}

.rak-extras-notes textarea {
    resize: vertical;
    min-height: 72px;
    font-size: 13px;
}

.rak-extras-tos {
    padding: 0 2px;
}

.rak-tos-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: #333;
    margin: 0;
    font-weight: normal;
}

.rak-tos-label input {
    margin-top: 3px;
}

.rak-tos-label a {
    color: #1677ff;
}

.rak-calculator-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.rak-calculator-footer table {
    width: 100%;
}

.rak-calculator-footer .ptng-btn {
    white-space: nowrap;
}

/* ---------- 领券子弹窗（就地领取） ---------- */
.rak-claim-modal {
    position: fixed;
    inset: 0;
    z-index: 10070;
    visibility: hidden;
    pointer-events: none;
}

.rak-claim-modal.is-open {
    visibility: visible;
    pointer-events: auto;
}

.rak-claim-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.24s ease;
}

.rak-claim-modal.is-open .rak-claim-mask {
    opacity: 1;
}

.rak-claim-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(760px, 92vw);
    max-height: 82vh;
    transform: translate(-50%, -48%);
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.24s ease, transform 0.24s ease;
}

.rak-claim-modal.is-open .rak-claim-panel {
    opacity: 1;
    transform: translate(-50%, -50%);
}

.rak-claim-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.rak-claim-title {
    font-size: 16px;
    font-weight: 600;
    color: #141414;
}

.rak-claim-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.rak-claim-all {
    background: #ff5500;
    border: 1px solid #ff5500;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
}

.rak-claim-all:hover {
    background: #e64a00;
    border-color: #e64a00;
}

.rak-claim-all:disabled {
    background: #ffb891;
    border-color: #ffb891;
    cursor: not-allowed;
}

.rak-claim-close {
    background: transparent;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: #999;
    cursor: pointer;
}

.rak-claim-close:hover {
    color: #333;
}

.rak-claim-body {
    padding: 16px 20px 20px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.rak-claim-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    padding: 48px 0;
    font-size: 14px;
}

.rak-claim-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid #ffe0cc;
    border-radius: 10px;
    background: #fffaf5;
}

.rak-claim-card-value {
    flex-shrink: 0;
    min-width: 84px;
    font-size: 20px;
    font-weight: 700;
    color: #ff5500;
    text-align: center;
}

.rak-claim-card-main {
    flex: 1;
    min-width: 0;
}

.rak-claim-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #141414;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rak-claim-card-tag {
    font-size: 11px;
    font-weight: 400;
    color: #ff5500;
    border: 1px solid #ffcaa8;
    border-radius: 4px;
    padding: 0 5px;
    white-space: nowrap;
}

.rak-claim-card-desc {
    font-size: 12px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.rak-claim-card-btn {
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #ff5500;
    color: #ff5500;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
}

.rak-claim-card-btn:hover {
    background: #ff5500;
    color: #fff;
}

.rak-claim-card-btn:disabled {
    border-color: #ffb891;
    color: #ffb891;
    background: #fff;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    .rak-claim-body {
        grid-template-columns: 1fr;
    }
}
