/* ===============================================================
   ToolDuck Payment & Pay-As-You-Go Module Styles
   =============================================================== */

.td-pay-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(10, 15, 29, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
}

.td-pay-overlay.is-active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.td-pay-modal {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    background: #0f172a;
    color: #f1f5f9;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
    padding: 28px 26px;
    box-sizing: border-box;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.td-pay-overlay.is-active .td-pay-modal {
    transform: translateY(0) scale(1);
}

.td-pay-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #94a3b8;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
}

.td-pay-close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    transform: rotate(90deg);
}

.td-pay-header {
    text-align: center;
    margin-bottom: 22px;
}

.td-pay-badge-crown {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(217, 119, 6, 0.25));
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fbbf24;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.td-pay-badge-crown span.crown-icon {
    font-size: 1rem;
}

.td-pay-title {
    margin: 0 0 6px;
    font-size: 1.45rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.015em;
}

.td-pay-sub {
    margin: 0;
    font-size: 0.85rem;
    color: #94a3b8;
    line-height: 1.45;
}

/* Pricing Card */
.td-pay-price-card {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.9) 100%);
    border: 1px solid rgba(99, 102, 241, 0.28);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 20px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
}

.td-pay-price-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.td-pay-price-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 12px;
}

.td-pay-price-main {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.td-pay-currency {
    font-size: 1.4rem;
    font-weight: 700;
    color: #60a5fa;
}

.td-pay-amount {
    font-size: 2.2rem;
    font-weight: 900;
    color: #ffffff;
    line-height: 1;
}

.td-pay-tag {
    font-size: 0.82rem;
    color: #cbd5e1;
    font-weight: 500;
}

.td-pay-validity-pill {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
}

/* Perks List */
.td-pay-perks {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.td-pay-perk {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.83rem;
    color: #e2e8f0;
}

.td-pay-perk svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: #10b981;
}

/* Form inputs */
.td-pay-inputs {
    margin-bottom: 18px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.td-pay-input-full {
    grid-column: 1 / -1;
}

.td-pay-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 4px;
}

.td-pay-field label .td-req {
    color: #f87171;
    margin-left: 2px;
    font-weight: 700;
}

.td-pay-field input {
    width: 100%;
    padding: 9px 12px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.84rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
    box-sizing: border-box;
}

.td-pay-field input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.td-pay-field input.is-invalid {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.08) !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25) !important;
}

.td-pay-error-msg {
    color: #f87171;
    font-size: 0.73rem;
    font-weight: 500;
    margin-top: 5px;
    line-height: 1.3;
    display: none;
    align-items: center;
    gap: 5px;
}

.td-pay-error-msg::before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Payment Action Buttons */
.td-pay-actions {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.td-pay-btn-payu {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 20px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
    transition: all 0.15s ease;
}

.td-pay-btn-payu:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    box-shadow: 0 6px 22px rgba(37, 99, 235, 0.55);
    transform: translateY(-1px);
    color: #ffffff;
}

.td-pay-methods-hint {
    display: block;
    text-align: center;
    font-size: 0.73rem;
    color: #94a3b8;
    margin-top: 6px;
}

.td-pay-security {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 0.73rem;
    color: #64748b;
    text-align: center;
}

.td-pay-security span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}


/* Sidebar usage & limits card */
.rsm-side__usage-card,
.rsm-side__pro-card {
    margin: 0.5rem 0 0.85rem;
    padding: 13px 14px;
    background: #161e2e;
    border: 1px solid #1e293b;
    border-radius: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.rsm-side__usage-card.is-pro-active,
.rsm-side__pro-card.is-pro-active {
    background: linear-gradient(180deg, #162438 0%, #101c2e 100%);
    border: 1px solid rgba(96, 165, 250, 0.35);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}

.rsm-side__usage-head,
.rsm-side__pro-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.84rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #f8fafc;
}

.rsm-side__usage-crown,
.rsm-side__pro-crown {
    font-size: 0.95rem;
}

.rsm-side__tier-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #cbd5e1;
    font-size: 0.64rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.rsm-side__tier-badge.is-pro {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.4);
    color: #34d399;
}

/* Limit rows */
.rsm-side__limit-row {
    margin-bottom: 9px;
    padding-bottom: 9px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.rsm-side__limit-row:last-of-type {
    margin-bottom: 11px;
    padding-bottom: 0;
    border-bottom: none;
}

.rsm-side__limit-label-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    margin-bottom: 4px;
}

.rsm-side__limit-name {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #94a3b8;
    font-weight: 600;
}

.rsm-side__limit-icon {
    font-size: 0.78rem;
}

.rsm-side__limit-val {
    font-weight: 700;
    color: #f1f5f9;
    font-variant-numeric: tabular-nums;
}

.rsm-side__limit-val.is-exhausted {
    color: #f87171;
}

.rsm-side__limit-val.is-active {
    color: #34d399;
}

.rsm-side__limit-track {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    height: 5px;
    overflow: hidden;
    margin-bottom: 4px;
}

.rsm-side__limit-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease;
}

.rsm-side__limit-bar--ai {
    background: linear-gradient(90deg, #8b5cf6, #ec4899);
}

.rsm-side__limit-bar--download {
    background: linear-gradient(90deg, #3b82f6, #10b981);
}

.rsm-side__limit-note {
    margin: 0;
    font-size: 0.68rem;
    color: #64748b;
    line-height: 1.35;
}

.rsm-side__limit-note a {
    color: #60a5fa;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.rsm-side__limit-note a:hover {
    color: #93c5fd;
}

/* Button */
.rsm-side__pro-btn {
    display: block;
    width: 100%;
    background: #2563eb;
    color: #ffffff;
    font-size: 0.77rem;
    font-weight: 600;
    text-align: center;
    padding: 7px 12px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.rsm-side__pro-btn:hover {
    background: #1d4ed8;
    color: #ffffff;
    transform: translateY(-1px);
}

.rsm-side__pro-btn.rsm-side__pro-btn--topup {
    background: rgba(37, 99, 235, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #93c5fd;
}

.rsm-side__pro-btn.rsm-side__pro-btn--topup:hover {
    background: rgba(37, 99, 235, 0.35);
    border-color: rgba(59, 130, 246, 0.6);
    color: #ffffff;
}

/* Step 4 Download Allowance Card */
.rsm-download__allowance-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 18px;
    margin-bottom: 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

html[data-theme="dark"] .rsm-download__allowance-card {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(255, 255, 255, 0.12);
}

.rsm-download__allowance-card.is-pro {
    background: #f0fdf4;
    border-color: #86efac;
}

html[data-theme="dark"] .rsm-download__allowance-card.is-pro {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(30, 41, 59, 0.7) 100%);
    border-color: rgba(16, 185, 129, 0.4);
}

.rsm-download__allowance-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rsm-download__allowance-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.rsm-download__allowance-text strong {
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
}

html[data-theme="dark"] .rsm-download__allowance-text strong {
    color: #f8fafc;
}

.rsm-download__allowance-text span {
    font-size: 0.78rem;
    color: #475569;
}

html[data-theme="dark"] .rsm-download__allowance-text span {
    color: #94a3b8;
}

/* Bottom pinned bar quota badge */
.rsm-bar__quota-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.74rem;
    font-weight: 600;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.rsm-bar__quota-badge.is-pro {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.35);
    color: #34d399;
}

/* Floating Success Banner */
.td-pay-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100000;
    max-width: 400px;
    background: #064e3b;
    border: 1px solid #059669;
    border-radius: 12px;
    padding: 14px 18px;
    color: #ecfdf5;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: tdToastSlideIn 0.3s ease-out;
}

.td-pay-toast-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.td-pay-toast-body h4 {
    margin: 0 0 2px;
    font-size: 0.92rem;
    color: #ffffff;
}

.td-pay-toast-body p {
    margin: 0;
    font-size: 0.78rem;
    color: #a7f3d0;
}

@keyframes tdToastSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
