/**
 * EazyGo — صفحة الدفع (نافذة مستقلة + خطوة العملية)
 */
.eg-payment-modal.modal {
    backdrop-filter: blur(8px);
    background: rgba(15, 23, 42, 0.55);
    align-items: flex-start !important;
    justify-content: center !important;
    padding: max(12px, env(safe-area-inset-top, 12px)) 12px max(24px, env(safe-area-inset-bottom, 24px)) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

.eg-payment-modal.modal.show {
    display: flex !important;
}

.eg-payment-modal .modal-content {
    max-width: 520px;
    width: calc(100% - 1rem);
    margin: auto;
    border: none;
    border-radius: 24px;
    box-shadow:
        0 25px 50px -12px rgba(15, 23, 42, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    background: #f8fafc;
    padding: 0 !important;
    max-height: none !important;
    display: flex;
    flex-direction: column;
    overflow: visible;
    flex-shrink: 0;
}

.eg-payment-modal .modal-header {
    margin: 0;
    padding: 0;
    border: none;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 45%, #0c4a6e 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
}

.eg-payment-modal .modal-header::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 30%, rgba(56, 189, 248, 0.35), transparent 55%),
        radial-gradient(circle at 85% 70%, rgba(167, 139, 250, 0.25), transparent 50%);
    pointer-events: none;
}

.eg-payment-modal .modal-header h3 {
    position: relative;
    margin: 0;
    padding: 1.35rem 3rem 1.35rem 1.5rem;
    font-size: 1.2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    letter-spacing: -0.02em;
}

.eg-payment-modal .modal-header h3 i {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    font-size: 1rem;
}

.eg-payment-modal .close-btn {
    position: absolute;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    z-index: 2;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.eg-payment-modal .close-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-50%) scale(1.05);
}

.eg-payment-modal .modal-body {
    padding: 1.25rem 1.35rem 1.5rem;
    background: linear-gradient(180deg, #f1f5f9 0%, #f8fafc 40%, #fff 100%);
    overflow: visible;
    flex: 1 1 auto;
    min-height: 0;
}

/* تجاوز قواعد .modal-content العامة في styles.css */
.modal.eg-payment-modal.show .modal-content {
    width: min(520px, calc(100vw - 1.5rem)) !important;
    max-height: none !important;
    overflow: visible !important;
}

/* —— الحاوية الرئيسية —— */
.eg-payment {
    --eg-pay-navy: #0f172a;
    --eg-pay-blue: #0369a1;
    --eg-pay-cyan: #06b6d4;
    --eg-pay-mint: #10b981;
    --eg-pay-violet: #7c3aed;
    --eg-pay-surface: #ffffff;
    --eg-pay-muted: #64748b;
    --eg-pay-border: #e2e8f0;
    font-family: inherit;
}

.eg-payment__hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.15rem;
    padding: 0.15rem 0;
}

.eg-payment__hero-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: #fff;
    background: linear-gradient(145deg, #10b981, #06b6d4);
    box-shadow: 0 8px 20px rgba(6, 182, 212, 0.35);
}

.eg-payment__title {
    margin: 0 0 0.2rem;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--eg-pay-navy);
    letter-spacing: -0.02em;
}

.eg-payment__subtitle {
    margin: 0;
    font-size: 0.82rem;
    color: var(--eg-pay-muted);
    line-height: 1.45;
}

/* —— كود الخصم —— */
.eg-payment-promo {
    margin-bottom: 1.1rem;
    padding: 1rem 1.1rem;
    border-radius: 16px;
    background: linear-gradient(135deg, #faf5ff 0%, #f0f9ff 100%);
    border: 1px solid #c4b5fd;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.08);
}

.eg-payment-promo__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #5b21b6;
}

.eg-payment-promo__head i {
    color: #7c3aed;
}

.eg-payment-promo__applied {
    margin: 0 0 0.65rem;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
    font-size: 0.88rem;
    font-weight: 600;
}

.eg-payment-promo__applied i {
    margin-left: 0.35rem;
}

.eg-payment-promo__row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: stretch;
}

.eg-payment-promo__input {
    flex: 1;
    min-width: 120px;
    padding: 0.65rem 0.9rem;
    border: 2px solid #e9d5ff;
    border-radius: 12px;
    background: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--eg-pay-navy);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.eg-payment-promo__input:focus {
    outline: none;
    border-color: #a78bfa;
    box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.25);
}

.eg-payment-promo__input::placeholder {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    color: #94a3b8;
}

.eg-payment-promo__btn {
    padding: 0.65rem 1.1rem;
    border: none;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
}

.eg-payment-promo__btn--apply {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    box-shadow: 0 4px 12px rgba(109, 40, 217, 0.35);
}

.eg-payment-promo__btn--apply:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(109, 40, 217, 0.45);
}

.eg-payment-promo__btn--remove {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid var(--eg-pay-border);
}

.eg-payment-promo__btn--remove:hover {
    background: #e2e8f0;
}

/* —— بطاقة الملخص —— */
.eg-payment__card {
    background: var(--eg-pay-surface);
    border-radius: 18px;
    border: 1px solid var(--eg-pay-border);
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    margin-bottom: 1.15rem;
}

.eg-payment__card-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.1rem;
    background: linear-gradient(90deg, #f8fafc, #f1f5f9);
    border-bottom: 1px solid var(--eg-pay-border);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--eg-pay-navy);
}

.eg-payment__card-head i {
    color: var(--eg-pay-cyan);
}

.eg-payment .payment-summary,
.eg-payment .eg-payment__summary {
    background: transparent !important;
    padding: 1rem 1.1rem 1.1rem !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

.eg-payment .eg-payment-summary__title {
    display: none;
}

.eg-payment .summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.55rem 0;
    margin: 0;
    font-size: 0.9rem;
    color: #334155;
    border-bottom: 1px dashed #f1f5f9;
}

.eg-payment .summary-item:last-of-type:not(.summary-item--total) {
    border-bottom: none;
}

.eg-payment .summary-item span:first-child {
    color: var(--eg-pay-muted);
    font-weight: 500;
}

.eg-payment .summary-item span:last-child {
    font-weight: 700;
    color: var(--eg-pay-navy);
    text-align: left;
}

.eg-payment .summary-item--route span:last-child {
    font-size: 0.85rem;
    max-width: 55%;
    line-height: 1.35;
}

.eg-payment .summary-item--discount {
    color: #059669 !important;
    background: #ecfdf5;
    margin: 0.35rem -0.5rem;
    padding: 0.5rem 0.5rem !important;
    border-radius: 10px;
    border: none !important;
}

.eg-payment .summary-item--discount span {
    color: #059669 !important;
    font-weight: 700 !important;
}

.eg-payment .service-fee-item,
.eg-payment .summary-item--fee {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin: 0.65rem 0 !important;
    padding: 0.9rem 1rem !important;
    border: none !important;
    border-radius: 14px !important;
    background: linear-gradient(135deg, #ecfeff 0%, #e0f2fe 50%, #ede9fe 100%) !important;
    box-shadow: 0 2px 12px rgba(6, 182, 212, 0.12) !important;
    position: relative;
    overflow: hidden;
}

.eg-payment .service-fee-item::before,
.eg-payment .summary-item--fee::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #06b6d4, #8b5cf6);
    border-radius: 0 14px 14px 0;
}

.eg-payment .service-fee-item span:first-child,
.eg-payment .summary-item--fee .eg-payment__fee-label {
    color: #0f172a !important;
    font-weight: 700 !important;
    font-size: 0.88rem !important;
}

.eg-payment .service-fee-item span:last-child,
.eg-payment .summary-item--fee .eg-payment__fee-value {
    color: #0369a1 !important;
    font-weight: 800 !important;
    font-size: 1.05rem !important;
}

.eg-payment .summary-item--total {
    margin-top: 0.75rem !important;
    padding: 1rem 0 0 !important;
    border-top: 2px solid #e2e8f0 !important;
    border-bottom: none !important;
    font-size: 1.05rem !important;
}

.eg-payment .summary-item--total span:first-child {
    font-weight: 800;
    color: var(--eg-pay-navy) !important;
    font-size: 1rem;
}

.eg-payment .eg-payment__total-value {
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    background: linear-gradient(135deg, #0369a1, #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.eg-payment .eg-payment__total-currency {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--eg-pay-muted);
    -webkit-text-fill-color: var(--eg-pay-muted);
    margin-right: 0.25rem;
}

/* —— طرق الدفع —— */
.eg-payment__methods {
    margin-bottom: 0.75rem;
}

.eg-payment__methods-title {
    margin: 0 0 0.85rem;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--eg-pay-navy);
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.eg-payment__methods-title i {
    color: var(--eg-pay-mint);
}

.eg-payment .payment-options,
.eg-payment .eg-payment__options {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 0.65rem !important;
    margin: 0 !important;
}

.eg-payment .eg-payment-method {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 1rem 1.15rem;
    border: 2px solid var(--eg-pay-border);
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    text-align: right;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--eg-pay-navy);
}

.eg-payment .eg-payment-method:hover {
    border-color: #38bdf8;
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.15);
    transform: translateY(-2px);
}

.eg-payment .eg-payment-method__icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    font-size: 1.25rem;
    color: #fff;
}

.eg-payment .eg-payment-method--credit .eg-payment-method__icon {
    background: linear-gradient(145deg, #3b82f6, #1d4ed8);
}

.eg-payment .eg-payment-method--bank .eg-payment-method__icon {
    background: linear-gradient(145deg, #10b981, #059669);
}

.eg-payment .eg-payment-method--wallet .eg-payment-method__icon {
    background: linear-gradient(145deg, #8b5cf6, #6d28d9);
}

.eg-payment .eg-payment-method__text {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
}

.eg-payment .eg-payment-method__label {
    font-size: 0.95rem;
}

.eg-payment .eg-payment-method__hint {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--eg-pay-muted);
}

.eg-payment .eg-payment-method__arrow {
    color: #cbd5e1;
    font-size: 0.85rem;
    transition: color 0.2s, transform 0.2s;
}

.eg-payment .eg-payment-method:hover .eg-payment-method__arrow {
    color: #0ea5e9;
    transform: translateX(-4px);
}

.eg-payment__secure {
    margin: 0;
    padding: 0.65rem 0 0;
    text-align: center;
    font-size: 0.78rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.eg-payment__secure i {
    color: #10b981;
}

/* خطوة العملية (#step4) */
/* خطوة الدفع داخل نافذة تتبع العملية */
#step4.step,
.step#step4 {
    flex-direction: column;
    align-items: stretch;
    max-height: none;
    overflow: visible;
}

#step4 .step-icon,
#step4 .step-status {
    display: none;
}

#step4 .step-content {
    margin: 0;
    width: 100%;
    max-width: 100%;
    overflow: visible;
}

#step4 .step-content > h4:first-child {
    display: none;
}

#step4 .eg-payment {
    max-width: 100%;
    padding: 0.25rem 0 0.5rem;
}

.order-process-modal .process-steps {
    overflow: visible;
}

.order-process-modal {
    max-height: none !important;
    overflow: visible !important;
}

.order-process-modal .modal-content,
.modal.order-process-modal {
    max-height: 94vh;
    overflow-y: auto;
}

@media (min-width: 480px) {
    .eg-payment .payment-options,
    .eg-payment .eg-payment__options {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 400px) {
    .eg-payment-promo__row {
        flex-direction: column;
    }

    .eg-payment-promo__btn {
        width: 100%;
    }
}
