/**
 * Student Wallet Recharge Premium Styles
 */

:root {
    --sw-frontend-primary: #1d4ed8;
    --sw-frontend-primary-hover: #1e40af;
    --sw-frontend-badge-bg: #1d4ed8;
    --sw-frontend-badge-text: #fff;
}

/* Modal Backdrop */
.sw-modal-overlay {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    max-width: 100%;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-sizing: border-box;
}

.sw-modal-overlay[hidden] {
    display: none !important;
}

html.sw-modal-open,
body.sw-modal-open {
    overflow: hidden !important;
    overscroll-behavior: none;
}

html.sw-modal-open {
    scrollbar-gutter: stable;
}

#sw-recharge-modal-wrapper {
    inset: 0;
    width: auto;
    max-width: 100%;
    height: auto;
    padding: 16px;
    overflow-x: hidden;
    box-sizing: border-box;
    margin: 0 !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

#sw-recharge-modal-wrapper.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#sw-recharge-modal-wrapper .sw-modal-content,
#sw-recharge-modal-wrapper .sw-modal-content * {
    box-sizing: border-box;
}

#sw-recharge-modal-wrapper .sw-modal-content {
    width: min(700px, calc(100% - 32px)) !important;
    max-width: 700px !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#sw-recharge-modal-wrapper.active .sw-modal-content {
    opacity: 1;
    transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
    #sw-recharge-modal-wrapper,
    #sw-recharge-modal-wrapper .sw-modal-content {
        transition: none;
    }
}

#sw-recharge-modal-wrapper .sw-modal-header-premium,
#sw-recharge-modal-wrapper .sw-modal-body-premium,
#sw-recharge-modal-wrapper .sw-modal-tabs,
#sw-recharge-modal-wrapper .sw-modal-dashboard,
#sw-recharge-modal-wrapper .sw-amount-input-wrapper,
#sw-recharge-modal-wrapper .sw-verification-fields {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

#sw-recharge-modal-wrapper .sw-modal-content[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

#sw-recharge-modal-wrapper .sw-modal-content[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

#sw-recharge-modal-wrapper input,
#sw-recharge-modal-wrapper button,
#sw-recharge-modal-wrapper img {
    max-width: 100%;
}

#sw-recharge-modal-wrapper .sw-amount-input-wrapper > input {
    padding-inline: 12px !important;
}

#sw-recharge-modal-wrapper .sw-modal-content[dir="rtl"] #sw-back-to-amount svg {
    transform: scaleX(-1);
}

#sw-proceed-to-payment,
.sw-modal-tab.active {
    border-color: var(--sw-frontend-primary) !important;
    background-color: var(--sw-frontend-primary) !important;
}

#sw-recharge-modal-wrapper .sw-modal-tab {
    min-width: 0;
    color: #6c757d !important;
    border-bottom: 3px solid transparent !important;
}

#sw-recharge-modal-wrapper .sw-modal-tab.active {
    background: transparent !important;
    color: var(--sw-frontend-primary) !important;
    border-bottom-color: var(--sw-frontend-primary) !important;
}

#sw-proceed-to-payment:hover,
#sw-proceed-to-payment:focus {
    background-color: var(--sw-frontend-primary-hover) !important;
}

#sw-back-to-amount,
.sw-modal-header-premium .dashicons {
    color: var(--sw-frontend-primary) !important;
}

.sw-wallet-btn {
    background: var(--sw-frontend-badge-bg) !important;
}

.sw-wallet-btn:hover,
.sw-wallet-btn:focus {
    background: var(--sw-frontend-primary-hover) !important;
}

@media (max-width: 600px) {
    #sw-recharge-modal-wrapper {
        padding: 10px;
    }

    #sw-recharge-modal-wrapper .sw-modal-content {
        width: calc(100% - 20px) !important;
        max-height: calc(100vh - 20px) !important;
        border-radius: 12px !important;
    }

    #sw-recharge-modal-wrapper .sw-modal-header-premium,
    #sw-recharge-modal-wrapper .sw-modal-body-premium {
        padding: 15px !important;
    }

    #sw-recharge-modal-wrapper .sw-modal-header-premium h3 {
        min-width: 0;
        font-size: 17px !important;
    }

    #sw-recharge-modal-wrapper .sw-modal-tab {
        padding-inline: 8px !important;
        font-size: 14px !important;
    }

    #sw-recharge-modal-wrapper .sw-amount-input-wrapper,
    #sw-recharge-modal-wrapper #sw-proceed-to-payment,
    #sw-recharge-modal-wrapper .sw-quick-pay-btn {
        width: 100% !important;
    }
}

/* Modal Content Box */
.sw-modal-content {
    background: #fff;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
}

.sw-history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    background: #fff;
}

.sw-history-main {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.sw-history-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    flex: 0 0 35px;
    border-radius: 50%;
    font-size: 16px;
}

.sw-history-summary {
    min-width: 0;
}

#sw-recharge-modal-wrapper .sw-history-reason-label,
#sw-recharge-modal-wrapper button.sw-history-reason-toggle {
    appearance: none !important;
    -webkit-appearance: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 118px;
    max-width: 100%;
    width: auto !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 4px 9px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #eff6ff !important;
    color: var(--sw-frontend-primary) !important;
    box-shadow: none !important;
    font: inherit !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    letter-spacing: normal !important;
    text-align: center !important;
    text-decoration: none !important;
    text-transform: none !important;
    transform: none !important;
}

#sw-recharge-modal-wrapper button.sw-history-reason-toggle::before,
#sw-recharge-modal-wrapper button.sw-history-reason-toggle::after {
    content: none !important;
    display: none !important;
}

#sw-recharge-modal-wrapper button.sw-history-reason-toggle {
    cursor: pointer !important;
}

#sw-recharge-modal-wrapper button.sw-history-reason-toggle:hover,
#sw-recharge-modal-wrapper button.sw-history-reason-toggle:focus {
    background: #dbeafe !important;
    color: var(--sw-frontend-primary) !important;
    box-shadow: none !important;
    outline: none !important;
    transform: none !important;
}

#sw-recharge-modal-wrapper .sw-history-reason-details {
    display: grid;
    width: min(300px, 100%);
    max-width: 100%;
    gap: 3px;
    margin-top: 7px;
    padding: 9px 10px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
    overflow-wrap: anywhere;
}

#sw-recharge-modal-wrapper .sw-history-reason-details[hidden] {
    display: none !important;
}

#sw-recharge-modal-wrapper .sw-history-reason-details span {
    color: #64748b;
    font-size: 11px;
}

#sw-recharge-modal-wrapper .sw-history-reason-details strong {
    color: #1e293b;
    font-size: 13px;
    font-weight: 600;
}

.sw-history-amount {
    flex: 0 0 auto;
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
}

#sw-recharge-modal-wrapper .sw-frontend-history-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding-top: 14px;
}

#sw-recharge-modal-wrapper .sw-frontend-history-pagination:empty {
    display: none;
}

#sw-recharge-modal-wrapper button.sw-frontend-history-page {
    appearance: none !important;
    min-width: 78px !important;
    min-height: 34px !important;
    margin: 0 !important;
    padding: 6px 13px !important;
    border: 1px solid var(--sw-frontend-primary) !important;
    border-radius: 7px !important;
    background: #fff !important;
    color: var(--sw-frontend-primary) !important;
    box-shadow: none !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    text-transform: none !important;
    cursor: pointer !important;
}

#sw-recharge-modal-wrapper button.sw-frontend-history-page:hover,
#sw-recharge-modal-wrapper button.sw-frontend-history-page:focus {
    background: var(--sw-frontend-primary) !important;
    color: #fff !important;
    box-shadow: none !important;
    outline: none !important;
}

#sw-recharge-modal-wrapper .sw-frontend-history-page-status {
    min-width: 48px;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    direction: ltr;
}

@media (max-width: 520px) {
    .sw-history-row {
        align-items: flex-start;
        padding-inline: 10px;
    }

    .sw-history-amount {
        font-size: 14px;
    }
}

/* Accordion Core */
.sw-wallet-accordion-item {
    margin-bottom: 12px;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sw-wallet-top-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sw-wallet-icon-wrapper {
    width: 45px;
    height: 45px;
    background: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.sw-wallet-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.sw-wallet-header {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.sw-wallet-header .sw-arrow {
    transition: transform 0.3s ease;
}

.sw-wallet-header.active .sw-arrow {
    transform: rotate(180deg);
}

.sw-wallet-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 0;
}

.sw-wallet-body.active {
    max-height: 1000px;
    opacity: 1;
}

.sw-confirm-recharge-btn.sw-confirmed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #16a34a !important;
}

.sw-confirmed-check {
    width: 21px;
    height: 21px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #fff;
    border-radius: 50%;
    flex: 0 0 21px;
}

.sw-confirmed-check svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: #fff;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Success Modal Visibility */
#sw-success-modal {
    display: none;
    margin: 0 !important;
    overflow-x: clip;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.22s ease;
}

#sw-success-modal.active {
    display: flex !important;
    opacity: 1;
}

#sw-success-modal .sw-modal-content {
    width: min(430px, calc(100% - 32px));
    max-width: 430px;
    min-width: 0;
    padding: 54px 36px 48px;
    text-align: center;
    border-radius: 20px;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

#sw-success-modal.active .sw-modal-content {
    opacity: 1;
    transform: translateY(0) scale(1);
}

#sw-success-modal .sw-success-animation {
    margin-bottom: 28px;
}

#sw-success-modal .sw-success-checkmark {
    display: block;
    width: 96px;
    height: 96px;
    margin: 0 auto;
}

#sw-success-modal .sw-success-checkmark-circle,
#sw-success-modal .sw-success-checkmark-check {
    stroke: #22c55e;
    fill: none;
}

#sw-success-modal .sw-success-checkmark-circle {
    stroke-width: 2;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
}

#sw-success-modal .sw-success-checkmark-check {
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
}

#sw-success-modal.active .sw-success-checkmark-circle {
    animation: sw-success-stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

#sw-success-modal.active .sw-success-checkmark-check {
    animation: sw-success-stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

@keyframes sw-success-stroke {
    to {
        stroke-dashoffset: 0;
    }
}

#sw-success-modal .sw-modal-title {
    margin: 0 0 10px;
    font-size: 24px;
    color: #333;
    font-weight: 800;
    line-height: 1.35;
}

#sw-success-modal .sw-success-message {
    margin: 0;
    color: #64748b;
    font-size: 16px;
    font-weight: 500;
}

@media (max-width: 480px) {
    #sw-success-modal .sw-modal-content {
        padding: 42px 24px 38px;
    }

    #sw-success-modal .sw-success-checkmark {
        width: 82px;
        height: 82px;
    }

    #sw-success-modal .sw-modal-title {
        font-size: 21px;
    }

    #sw-success-modal .sw-success-message {
        font-size: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #sw-success-modal,
    #sw-success-modal .sw-modal-content {
        transition: none;
    }

    #sw-success-modal .sw-success-checkmark-circle,
    #sw-success-modal .sw-success-checkmark-check {
        animation: none;
        stroke-dashoffset: 0;
    }
}

/* Step Animations */
.sw-recharge-step-1,
.sw-recharge-step-2 {
    animation: swFadeIn 0.3s ease;
}

@keyframes swFadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* RTL Support */
body.rtl .sw-wallet-header .sw-arrow {
    margin-right: auto;
    margin-left: 0;
}

/* Button Loading Spinner */
.sw-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: swSpinnerRotate 0.8s linear infinite;
    vertical-align: middle;
    margin-left: 8px;
}

@keyframes swSpinnerRotate {
    to {
        transform: rotate(360deg);
    }
}

/* Dynamic Focus Color for Evidence Input */
.sw-evidence-input {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.sw-evidence-input:focus {
    outline: none;
}

/* Wallet-specific focus colors */
.sw-wallet-accordion-item[data-wallet-id="vodafone"] .sw-evidence-input:focus {
    border-color: #e60000 !important;
    box-shadow: 0 0 0 3px rgba(230, 0, 0, 0.15);
}

.sw-wallet-accordion-item[data-wallet-id="etisalat"] .sw-evidence-input:focus {
    border-color: #009900 !important;
    box-shadow: 0 0 0 3px rgba(0, 153, 0, 0.15);
}

.sw-wallet-accordion-item[data-wallet-id="orange"] .sw-evidence-input:focus {
    border-color: #ff6600 !important;
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.15);
}
