/* Recharge page — extends site theme */
.recharge-page {
    position: relative;
    z-index: 1;
    padding: 20px var(--page-x-end) 48px var(--page-x);
    max-width: 1100px;
    margin: 0 auto;
}

.recharge-page h1 {
    margin: 0 0 8px;
    font-size: clamp(1.5rem, 5vw, 2rem);
    font-weight: 900;
    text-align: center;
    color: var(--text);
}

.recharge-page .section-intro {
    margin-bottom: 24px;
}

.recharge-layout {
    display: grid;
    gap: 18px;
}

@media (min-width: 900px) {
    .recharge-layout {
        grid-template-columns: 1.15fr 0.85fr;
        align-items: start;
    }
}

.recharge-card {
    padding: 18px 16px;
    background: var(--card);
    border: 2px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.recharge-card h2 {
    margin: 0 0 16px;
    font-size: 1.1rem;
    font-weight: 900;
    text-align: center;
    color: var(--text);
}

.package-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (min-width: 520px) {
    .package-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 900px) {
    .package-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.package-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 88px;
    padding: 12px 8px;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
    font-family: inherit;
    color: inherit;
}

.package-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.package-item.selected {
    border-color: var(--accent);
    background: linear-gradient(180deg, #fff9f0 0%, #ffe8c4 100%);
    box-shadow: 0 6px 16px rgba(230, 120, 30, 0.2);
}

.package-gems {
    font-size: 1rem;
    font-weight: 900;
    color: var(--text);
    line-height: 1.2;
}

.package-price {
    margin-top: 4px;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--accent-dark);
}

.package-label {
    margin-top: 2px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
}

.recharge-form .form-group {
    margin-bottom: 16px;
}

.recharge-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-soft);
}

.recharge-form input[type="text"],
.recharge-form input[type="email"] {
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    border: 2px solid var(--card-border);
    border-radius: 12px;
    background: #fff;
}

.recharge-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.payment-methods {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.payment-method {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-width: 100px;
    min-height: 88px;
    padding: 12px 12px 10px;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-soft);
}

.payment-method.selected {
    border-color: var(--green);
    background: linear-gradient(180deg, #f8fff6 0%, #e8f5e4 100%);
}

.payment-method__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    width: 100%;
    min-height: 48px;
    box-sizing: border-box;
}

.payment-method--applepay {
    padding-top: 4px;
}

.payment-method--applepay .payment-method__icon {
    align-items: flex-start;
    justify-content: center;
    padding-bottom: 8px;
}

.payment-method__label {
    flex: 0 0 auto;
    line-height: 1.2;
}

.payment-method svg {
    width: 40px;
    height: 40px;
    display: block;
    flex-shrink: 0;
    overflow: visible;
}

.recharge-summary {
    margin: 18px 0;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255, 248, 235, 0.9);
    border: 1px solid var(--line);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
}

.summary-row span:last-child {
    font-weight: 800;
    color: var(--text);
    text-align: right;
}

.summary-row.total {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    font-size: 1rem;
}

.summary-row.total span:last-child {
    color: var(--accent-dark);
    font-size: 1.1rem;
}

.recharge-form .btn-primary {
    width: 100%;
}

.recharge-form .btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    filter: none;
}

.recharge-form.is-locked {
    pointer-events: none;
    opacity: 0.92;
}

body.recharge-body-locked {
    overflow: hidden;
    touch-action: none;
}

/* Loading overlay */
.recharge-loading {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding:
        max(16px, env(safe-area-inset-top))
        max(16px, env(safe-area-inset-right))
        max(16px, env(safe-area-inset-bottom))
        max(16px, env(safe-area-inset-left));
    background: rgba(28, 22, 14, 0.52);
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.recharge-loading.is-open {
    display: flex;
}

.recharge-loading__panel {
    width: min(100%, 280px);
    padding: 22px 20px;
    text-align: center;
    background: var(--card);
    border: 2px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.recharge-loading__spinner {
    width: 44px;
    height: 44px;
    margin: 0 auto 14px;
    border: 3px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: recharge-spin 0.75s linear infinite;
}

@keyframes recharge-spin {
    to {
        transform: rotate(360deg);
    }
}

.recharge-loading__text {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
}

.recharge-loading__hint {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    line-height: 1.4;
}

/* Error alert */
.recharge-alert {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    padding:
        max(16px, env(safe-area-inset-top))
        max(16px, env(safe-area-inset-right))
        max(16px, env(safe-area-inset-bottom))
        max(16px, env(safe-area-inset-left));
}

.recharge-alert.is-open {
    display: flex;
}

.recharge-alert__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(28, 22, 14, 0.45);
}

.recharge-alert__dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 340px);
    max-height: min(80vh, 420px);
    overflow: auto;
    padding: 20px 18px 18px;
    background: var(--card);
    border: 2px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    -webkit-overflow-scrolling: touch;
}

.recharge-alert__title {
    margin: 0 0 10px;
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--text);
}

.recharge-alert__message {
    margin: 0 0 18px;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-soft);
    word-break: break-word;
}

.recharge-alert__btn {
    width: 100%;
    min-height: 48px;
}
