/* ============================================================
   PROFESSIONAL PAYMENT UI — v3.0
   Clean, modern design inspired by Stripe / Booking.com
   ============================================================ */

/* ---------- Payment Container ---------- */
.payment-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 1.5rem;
    background: #f7f8fa;
    border-radius: 16px;
}

/* ---------- Payment Header ---------- */
.payment-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #e4e7ec;
}

.payment-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin: 0 0 0.4rem 0;
}

.payment-header h2 i {
    color: #f7b731;
    font-size: 1.4rem;
}

.payment-subtitle {
    font-size: 0.88rem;
    color: #6b7280;
    margin: 0;
}

/* ---------- Booking Summary Card ---------- */
.booking-summary-card {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.summary-header {
    background: #1e293b;
    color: #fff;
    padding: 0.875rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.summary-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.summary-header h3 i {
    color: #f7b731;
}

.summary-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.3s ease;
    transform: rotate(180deg);
    flex-shrink: 0;
    padding: 0;
}

.summary-toggle.collapsed {
    transform: rotate(0deg);
}

.summary-content {
    padding: 1.25rem;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
    max-height: 1500px;
}

.summary-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Detail rows */
.booking-details-grid {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #f7b731;
}

.detail-label {
    font-weight: 600;
    color: #4b5563;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.detail-value {
    font-weight: 500;
    color: #1a1a2e;
    font-size: 0.875rem;
    text-align: right;
}

/* Price breakdown */
.price-breakdown {
    border-top: 1px solid #e4e7ec;
    padding-top: 0.875rem;
}

.price-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    font-size: 0.9rem;
    color: #374151;
}

.price-row.total {
    border-top: 2px solid #f7b731;
    margin-top: 0.5rem;
    padding-top: 0.625rem;
    font-weight: 700;
    font-size: 1rem;
    color: #1a1a2e;
}

.total-amount {
    font-size: 1.2rem;
    font-weight: 800;
    color: #f7b731;
}

/* ---------- Payment Methods Section ---------- */
.payment-methods-section {
    background: transparent;
    padding: 0;
    margin-bottom: 1.25rem;
    box-shadow: none;
}

.payment-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 0.875rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.payment-section-title i {
    color: #f7b731;
    font-size: 0.9rem;
}

/* ---------- Payment Grid — 2 columns ---------- */
.payment-methods-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding-top: 22px; /* room for RECOMMENDED badge */
    align-items: start;
    margin-bottom: 0;
}

/* ---------- Payment Method Cards ---------- */
.payment-method-card {
    background: #fff;
    border: 2px solid #e4e7ec;
    border-radius: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    position: relative;
    overflow: visible;
}

.payment-method-card:hover {
    border-color: #f7b731;
    box-shadow: 0 4px 20px rgba(247, 183, 49, 0.18);
    transform: translateY(-2px);
}

.payment-method-card.selected {
    border-color: #f7b731;
    box-shadow: 0 0 0 3px rgba(247, 183, 49, 0.15), 0 4px 16px rgba(247, 183, 49, 0.2);
}

/* ---- CASH CARD (Pay to Driver) ---- */
.cash-card {
    border-color: #f7b731;
    box-shadow: 0 2px 16px rgba(247, 183, 49, 0.15);
    margin-top: 0; /* padding-top on grid handles the space */
}

/* Single RECOMMENDED badge — top center */
.cash-card::before {
    content: '★  RECOMMENDED';
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #f7b731, #ffc94a);
    color: #1a1a2e;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(247, 183, 49, 0.35);
    z-index: 10;
}

/* Remove v2 "MOST POPULAR" badge — only one badge per card */
.cash-card::after {
    display: none;
}

/* Hide inline POPULAR badge inside cash header — RECOMMENDED already covers it */
.cash-card .popular-badge {
    display: none;
}

/* Cash card header — always white, clean */
.cash-card .payment-method-header,
.cash-card.selected .payment-method-header {
    background: #fff !important;
    border-bottom: 1px solid #f0f0f0;
}

/* Cash card icon — green */
.cash-card .payment-method-icon {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

/* ---- PAYPAL CARD ---- */
.paypal-card {
    border-color: #e4e7ec;
}

.paypal-card:hover {
    border-color: #0070ba;
    box-shadow: 0 4px 20px rgba(0, 112, 186, 0.15);
}

.paypal-card.selected {
    border-color: #0070ba;
    box-shadow: 0 0 0 3px rgba(0, 112, 186, 0.1), 0 4px 16px rgba(0, 112, 186, 0.15);
}

/* PayPal card icon */
.paypal-card .payment-method-icon {
    background: linear-gradient(135deg, #003087, #009cde);
    color: #fff;
}

/* PayPal benefits accent */
.paypal-card .benefit i {
    color: #0070ba;
}

/* ---------- Card Header ---------- */
.payment-method-header {
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 14px 14px 0 0;
}

.payment-method-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    color: #fff;
}

.payment-method-info {
    flex: 1;
    min-width: 0;
}

.payment-method-info h4 {
    margin: 0 0 2px 0;
    color: #1a1a2e !important;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.payment-method-info p {
    margin: 0;
    color: #6b7280 !important;
    font-size: 0.775rem;
    line-height: 1.3;
}

.payment-method-badge {
    margin-left: auto;
    flex-shrink: 0;
}

.popular-badge {
    background: #f7b731;
    color: #1a1a2e;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.secure-badge {
    background: linear-gradient(135deg, #0070ba, #003087);
    color: #fff;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---------- Card Content ---------- */
.payment-method-content {
    padding: 1rem;
    background: #fafbfc;
    border-radius: 0 0 14px 14px;
}

.payment-benefits {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0;
    background: none;
    border: none;
}

.benefit {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #374151;
    font-size: 0.82rem;
    font-weight: 500;
}

.benefit i {
    color: #10b981;
    font-size: 0.85rem;
    width: 15px;
    text-align: center;
    flex-shrink: 0;
}

/* ---------- Pay to Driver Button ---------- */
.pay-later-btn {
    width: 100%;
    background: linear-gradient(135deg, #1e3a5f, #2563eb);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 0.875rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
    min-height: 42px;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.pay-later-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.08) 100%);
    pointer-events: none;
}

.pay-later-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1e3a5f);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

.pay-later-btn:active {
    transform: translateY(0);
}

.pay-later-btn .button-content {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pay-later-btn .button-icon { font-size: 0.85rem; }

.pay-later-btn .button-text {
    font-weight: 700;
    letter-spacing: 0.4px;
}

.pay-later-btn .button-price {
    font-size: 0.9rem;
    font-weight: 800;
    padding: 0.2rem 0.55rem;
    background: rgba(255,255,255,0.2);
    border-radius: 6px;
    letter-spacing: 0.2px;
}

.pay-later-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

/* ---------- PayPal Container ---------- */
#paypal-button-container {
    margin-top: 0.25rem;
    border-radius: 8px;
    overflow: hidden;
}

/* ---------- Fee Notice (small, appended by JS) ---------- */
.fee-notice {
    margin-top: 0.625rem;
    padding: 0.4rem 0.7rem;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #92400e;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.fee-notice i { color: #d97706; font-size: 0.8rem; }

/* ---------- PayPal Fee Banner (prominent, always visible) ---------- */
.paypal-fee-banner {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 0.625rem 0.875rem;
    margin-bottom: 0.75rem;
}

.paypal-fee-banner i {
    color: #d97706;
    font-size: 1rem;
    flex-shrink: 0;
}

.paypal-fee-banner .fee-banner-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.paypal-fee-banner .fee-banner-text strong {
    color: #92400e;
    font-weight: 700;
    font-size: 0.85rem;
}

.paypal-fee-banner .fee-banner-text span {
    color: #b45309;
    font-size: 0.72rem;
}

/* ---------- Security Section ---------- */
.security-section {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.security-badges {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 0;
}

.security-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.75rem 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.2s ease;
}

.security-badge:hover { transform: translateY(-2px); }

.security-badge i {
    color: #10b981;
    font-size: 1.1rem;
}

.security-badge span {
    font-size: 0.72rem;
    font-weight: 600;
    color: #374151;
    line-height: 1.2;
}

.payment-guarantee { display: none; } /* Hidden — security badges are enough */

/* ---------- Accessibility ---------- */
.payment-method-card:focus-visible {
    outline: 3px solid #f7b731;
    outline-offset: 2px;
}

.pay-later-btn:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.5);
    outline-offset: 2px;
}

/* ============================================================
   RESPONSIVE — TABLET  (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
    .payment-container {
        padding: 1rem;
        border-radius: 12px;
    }

    .payment-header h2 { font-size: 1.3rem; }
    .payment-subtitle { font-size: 0.82rem; }

    .payment-methods-grid {
        grid-template-columns: 1fr;   /* Stack on tablet */
        gap: 0.875rem;
    }

    .security-badges {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================
   RESPONSIVE — MOBILE (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
    .payment-container {
        padding: 0.875rem;
        border-radius: 10px;
        margin: 0 0.25rem;
    }

    .payment-header {
        margin-bottom: 1rem;
        padding-bottom: 0.875rem;
    }

    .payment-header h2 { font-size: 1.15rem; }

    .payment-method-header {
        padding: 0.75rem 0.875rem;
        gap: 0.625rem;
    }

    .payment-method-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
        border-radius: 8px;
    }

    .payment-method-info h4 { font-size: 0.9rem; }
    .payment-method-info p  { font-size: 0.72rem; }

    .payment-method-content { padding: 0.875rem; }

    .benefit { font-size: 0.78rem; }

    .pay-later-btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.8rem;
        min-height: 40px;
    }

    .security-badges {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .security-badge { padding: 0.625rem 0.4rem; }
    .security-badge span { font-size: 0.68rem; }
}

/* ============================================================
   RESPONSIVE — SMALL PHONE (≤ 360px)
   ============================================================ */
@media (max-width: 360px) {
    .payment-container { padding: 0.75rem; }

    .payment-method-header { padding: 0.625rem 0.75rem; }

    .payment-method-icon {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }

    .payment-method-content { padding: 0.75rem; }

    .pay-later-btn {
        padding: 0.55rem 0.75rem;
        font-size: 0.78rem;
        min-height: 38px;
    }
}
