/**
 * vBuy Refund UI — Premium Dark Theme Styles
 *
 * Covers:
 * - Customer "Request Refund" button & modal
 * - Refund type radio cards (GBP vs v£ + 5% bonus)
 * - Item summary card inside modal
 * - Merchant approve / reject action buttons
 * - Reject reason textarea (expandable)
 * - Toast notifications (success / error)
 * - Loading spinner overlay
 * - Responsive breakpoints
 *
 * @package VBuy
 */

/* ──────────────────────────────────────────
 * Keyframe Animations
 * ────────────────────────────────────────── */

@keyframes vbuyFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes vbuySlideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes vbuySlideInRight {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes vbuySlideDown {
    from { opacity: 0; max-height: 0; }
    to   { opacity: 1; max-height: 200px; }
}

@keyframes vbuyPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(246, 173, 85, 0.4); }
    50%      { box-shadow: 0 0 0 6px rgba(246, 173, 85, 0); }
}

@keyframes vbuySpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes vbuyShimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ──────────────────────────────────────────
 * Customer: Request Refund Button
 * ────────────────────────────────────────── */

.vbuy-refund-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    border: 1.5px solid #f6ad55;
    border-radius: 9999px;
    background: transparent;
    color: #f6ad55;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    line-height: 1.4;
}

.vbuy-refund-btn:hover {
    background: rgba(246, 173, 85, 0.12);
    color: #fbd38d;
    border-color: #fbd38d;
    transform: translateY(-1px);
    animation: vbuyPulse 1.8s ease-in-out infinite;
}

.vbuy-refund-btn:active {
    transform: translateY(0);
    animation: none;
}

.vbuy-refund-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    animation: none;
}

.vbuy-refund-btn__icon {
    font-size: 13px;
    line-height: 1;
}

/* Requested status badge (replaces button after submission) */
.vbuy-refund-requested-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 9999px;
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ──────────────────────────────────────────
 * Modal: Overlay & Container
 * ────────────────────────────────────────── */

.vbuy-refund-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.vbuy-refund-modal[aria-hidden="true"] {
    display: none;
}

.vbuy-refund-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: vbuyFadeIn 0.25s ease-out;
}

.vbuy-refund-modal__content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    background: rgba(20, 24, 38, 0.97);
    border: 1px solid #2d3748;
    border-radius: 20px;
    padding: 32px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04),
        0 24px 80px rgba(0, 0, 0, 0.6),
        0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: vbuySlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Scrollbar styling inside modal */
.vbuy-refund-modal__content::-webkit-scrollbar {
    width: 4px;
}

.vbuy-refund-modal__content::-webkit-scrollbar-track {
    background: transparent;
}

.vbuy-refund-modal__content::-webkit-scrollbar-thumb {
    background: #2d3748;
    border-radius: 4px;
}

/* ──────────────────────────────────────────
 * Modal: Header
 * ────────────────────────────────────────── */

.vbuy-refund-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(45, 55, 72, 0.6);
}

.vbuy-refund-modal__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: #e2e8f0;
    margin: 0;
}

.vbuy-refund-modal__title-icon {
    font-size: 22px;
}

.vbuy-refund-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(45, 55, 72, 0.5);
    border-radius: 10px;
    background: transparent;
    color: #718096;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.vbuy-refund-modal__close:hover {
    background: rgba(252, 129, 129, 0.1);
    border-color: rgba(252, 129, 129, 0.3);
    color: #fc8181;
    transform: rotate(90deg);
}

/* ──────────────────────────────────────────
 * Modal: Body
 * ────────────────────────────────────────── */

.vbuy-refund-modal__body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ──────────────────────────────────────────
 * Item Summary Card
 * ────────────────────────────────────────── */

.vbuy-refund-item-summary {
    background: #1a1f2e;
    border: 1px solid rgba(45, 55, 72, 0.5);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vbuy-refund-item-summary__name {
    font-size: 15px;
    font-weight: 600;
    color: #e2e8f0;
    line-height: 1.4;
}

.vbuy-refund-item-summary__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.vbuy-refund-item-summary__price {
    font-size: 14px;
    color: #e2e8f0;
    font-weight: 600;
}

.vbuy-refund-item-summary__qty {
    font-size: 13px;
    color: #a0aec0;
}

.vbuy-refund-item-summary__reward {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
}

/* ──────────────────────────────────────────
 * Refund Type Selection Label
 * ────────────────────────────────────────── */

.vbuy-refund-type-label {
    font-size: 13px;
    font-weight: 600;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}

/* ──────────────────────────────────────────
 * Refund Type: Radio Cards
 * ────────────────────────────────────────── */

.vbuy-refund-type-cards {
    display: flex;
    gap: 12px;
}

.vbuy-refund-type-card {
    flex: 1;
    position: relative;
    background: #1a1f2e;
    border: 2px solid #2d3748;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Hidden radio input */
.vbuy-refund-type-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.vbuy-refund-type-card:hover {
    border-color: #4a5568;
    background: #1e2536;
    transform: translateY(-2px);
}

/* Selected state */
.vbuy-refund-type-card--selected {
    border-color: #00d4aa !important;
    background: rgba(0, 212, 170, 0.04);
    box-shadow:
        0 0 0 1px rgba(0, 212, 170, 0.15),
        0 0 20px rgba(0, 212, 170, 0.08),
        inset 0 1px 0 rgba(0, 212, 170, 0.06);
}

.vbuy-refund-type-card--selected::before {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 12px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #00d4aa;
    color: #0f1219;
    font-size: 12px;
    font-weight: 700;
    border-radius: 50%;
    line-height: 1;
}

.vbuy-refund-type-card__icon {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}

.vbuy-refund-type-card__title {
    font-size: 15px;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 6px;
    line-height: 1.3;
}

.vbuy-refund-type-card__desc {
    font-size: 13px;
    color: #a0aec0;
    line-height: 1.5;
    margin: 0;
}

.vbuy-refund-type-card__highlight {
    color: #00d4aa;
    font-weight: 700;
}

/* Recommended tag on v£ bonus card */
.vbuy-refund-type-card__tag {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(0, 212, 170, 0.12);
    color: #00d4aa;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-radius: 4px;
    margin-bottom: 10px;
}

/* ──────────────────────────────────────────
 * Modal: Footer Buttons
 * ────────────────────────────────────────── */

.vbuy-refund-modal__footer {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

.vbuy-refund-confirm-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 24px;
    background: linear-gradient(135deg, #00d4aa, #00b894);
    color: #0f1219;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0, 212, 170, 0.25);
    letter-spacing: 0.01em;
}

.vbuy-refund-confirm-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(0, 212, 170, 0.35);
    filter: brightness(1.05);
}

.vbuy-refund-confirm-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 212, 170, 0.2);
}

.vbuy-refund-confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.vbuy-refund-cancel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 20px;
    background: transparent;
    color: #718096;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid rgba(45, 55, 72, 0.5);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vbuy-refund-cancel-btn:hover {
    color: #a0aec0;
    border-color: #4a5568;
    background: rgba(255, 255, 255, 0.02);
}

/* ──────────────────────────────────────────
 * Modal: Error Message
 * ────────────────────────────────────────── */

.vbuy-refund-modal__error {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(252, 129, 129, 0.08);
    border: 1px solid rgba(252, 129, 129, 0.2);
    border-radius: 10px;
    color: #fc8181;
    font-size: 13px;
    line-height: 1.5;
    animation: vbuySlideUp 0.2s ease;
}

.vbuy-refund-modal__error-icon {
    flex-shrink: 0;
    font-size: 16px;
    margin-top: 1px;
}

/* ──────────────────────────────────────────
 * Merchant: Refund Action Buttons
 * ────────────────────────────────────────── */

.vbuy-merchant-refund-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.vbuy-merchant-approve-btn,
.vbuy-merchant-reject-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.vbuy-merchant-approve-btn {
    background: #68d391;
    color: #0f1219;
    border: none;
    box-shadow: 0 2px 8px rgba(104, 211, 145, 0.2);
}

.vbuy-merchant-approve-btn:hover {
    background: #48bb78;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(104, 211, 145, 0.3);
}

.vbuy-merchant-approve-btn:active {
    transform: translateY(0);
}

.vbuy-merchant-approve-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.vbuy-merchant-reject-btn {
    background: transparent;
    color: #fc8181;
    border: 1.5px solid #fc8181;
}

.vbuy-merchant-reject-btn:hover {
    background: rgba(252, 129, 129, 0.12);
    border-color: #feb2b2;
    color: #feb2b2;
    transform: translateY(-1px);
}

.vbuy-merchant-reject-btn:active {
    transform: translateY(0);
}

.vbuy-merchant-reject-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Merchant status badge (replaces buttons after action) */
.vbuy-merchant-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.vbuy-merchant-status-badge--approved {
    background: rgba(104, 211, 145, 0.12);
    color: #68d391;
}

.vbuy-merchant-status-badge--rejected {
    background: rgba(252, 129, 129, 0.12);
    color: #fc8181;
}

/* ──────────────────────────────────────────
 * Merchant: Reject Reason Textarea
 * ────────────────────────────────────────── */

.vbuy-merchant-reject-reason {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                margin 0.3s ease;
    margin-top: 0;
}

.vbuy-merchant-reject-reason--open {
    max-height: 220px;
    opacity: 1;
    margin-top: 12px;
}

.vbuy-merchant-reject-reason__label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #a0aec0;
    margin-bottom: 6px;
}

.vbuy-merchant-reject-reason__textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px 14px;
    background: #0f1219;
    border: 1px solid #2d3748;
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.vbuy-merchant-reject-reason__textarea:focus {
    outline: none;
    border-color: #fc8181;
    box-shadow: 0 0 0 3px rgba(252, 129, 129, 0.1);
}

.vbuy-merchant-reject-reason__textarea::placeholder {
    color: #4a5568;
}

.vbuy-merchant-reject-reason__submit {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    padding: 8px 18px;
    background: #fc8181;
    color: #0f1219;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vbuy-merchant-reject-reason__submit:hover {
    background: #feb2b2;
    transform: translateY(-1px);
}

.vbuy-merchant-reject-reason__submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ──────────────────────────────────────────
 * Toast Notifications
 * ────────────────────────────────────────── */

.vbuy-refund-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999999;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 300px;
    max-width: 420px;
    padding: 16px 20px;
    background: rgba(20, 24, 38, 0.97);
    border: 1px solid #2d3748;
    border-radius: 14px;
    border-left: 4px solid #2d3748;
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.5),
        0 4px 16px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: vbuySlideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.vbuy-refund-toast--dismissing {
    opacity: 0;
    transform: translateX(100%);
}

.vbuy-refund-toast--success {
    border-left-color: #68d391;
}

.vbuy-refund-toast--error {
    border-left-color: #fc8181;
}

.vbuy-refund-toast__icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 1px;
}

.vbuy-refund-toast__body {
    flex: 1;
    min-width: 0;
}

.vbuy-refund-toast__title {
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 2px;
}

.vbuy-refund-toast__message {
    font-size: 13px;
    color: #a0aec0;
    line-height: 1.4;
    word-break: break-word;
}

.vbuy-refund-toast__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    color: #4a5568;
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.vbuy-refund-toast__close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #a0aec0;
}

/* ──────────────────────────────────────────
 * Loading Spinner Overlay
 * ────────────────────────────────────────── */

.vbuy-refund-loading {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(20, 24, 38, 0.85);
    border-radius: 20px;
    animation: vbuyFadeIn 0.15s ease;
}

.vbuy-refund-loading__spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(0, 212, 170, 0.15);
    border-top-color: #00d4aa;
    border-radius: 50%;
    animation: vbuySpin 0.7s linear infinite;
}

.vbuy-refund-loading__text {
    font-size: 13px;
    color: #a0aec0;
    font-weight: 500;
}

/* ──────────────────────────────────────────
 * Responsive: Stack Cards on Mobile
 * ────────────────────────────────────────── */

@media (max-width: 600px) {
    .vbuy-refund-type-cards {
        flex-direction: column;
    }

    .vbuy-refund-modal__content {
        padding: 24px 20px;
        border-radius: 16px;
        max-width: none;
        margin: 8px;
    }

    .vbuy-refund-modal__title {
        font-size: 16px;
    }

    .vbuy-refund-modal__footer {
        flex-direction: column;
    }

    .vbuy-refund-cancel-btn {
        order: 1;
    }

    .vbuy-refund-toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        min-width: auto;
        max-width: none;
    }

    .vbuy-merchant-refund-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .vbuy-merchant-approve-btn,
    .vbuy-merchant-reject-btn {
        justify-content: center;
        padding: 10px 16px;
    }
}

@media (max-width: 380px) {
    .vbuy-refund-modal__content {
        padding: 20px 16px;
    }

    .vbuy-refund-type-card {
        padding: 16px;
    }

    .vbuy-refund-item-summary {
        padding: 14px 16px;
    }
}
