/* ============================================
   Installment Payment System - Dark Theme
   Unified Inline Payment Options
   ============================================ */

/* Payment Options Title */
.payment-options-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 15px 0 12px 0;
    color: var(--text-light);
    text-align: left;
}

/* Payment Options Container */
.payment-options-container {
    display: flex;
    flex-direction: column;
    gap: 12px; /* Exact 12px gap between all cards */
    margin-bottom: 15px;
}

/* Payment Option Card - Pixel Perfect Design */
.payment-option-card {
    display: flex;
    align-items: stretch; /* Equal height content */
    gap: 18px; /* Increased gap between icon and content */
    min-height: 110px; /* Increased to accommodate icon + badge */
    background-color: var(--card-bg);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px; /* Increased padding for more breathing room */
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-sizing: border-box; /* Ensure padding is included in height */
}

.payment-option-card:hover {
    border-color: rgba(26, 188, 156, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.payment-option-card.selected {
    border-color: var(--accent-border-color);
    background: linear-gradient(135deg,
        rgba(26, 188, 156, 0.08) 0%,
        rgba(26, 188, 156, 0.03) 100%);
    box-shadow: 0 0 20px rgba(26, 188, 156, 0.3);
}

.payment-option-card.selected::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, var(--accent-border-color), transparent);
    border-radius: 8px;
    z-index: -1;
    opacity: 0.2;
}

/* Option Icon */
.option-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(26, 188, 156, 0.1);
    border-radius: 8px;
    color: var(--accent-border-color);
    font-size: 1.2rem;
    position: relative; /* For checkmark and fee badge positioning */
    align-self: flex-start; /* Keep icon at top of card */
}

.payment-option-card.selected .option-icon {
    background: var(--accent-border-color);
    color: #fff;
}

/* Fee badge - positioned at bottom-left of card */
.card-fee-badge {
    position: absolute;
    bottom: 12px;
    left: 12px;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--accent-border-color) 0%, rgba(26, 188, 156, 0.85) 100%);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
    letter-spacing: 0.3px;
}

.payment-option-card.selected .card-fee-badge {
    box-shadow: 0 2px 8px rgba(26, 188, 156, 0.5);
}

/* Checkmark badge on selected icon */
.payment-option-card.selected .option-icon::after {
    content: "✓";
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-border-color);
    color: #fff;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(26, 188, 156, 0.6);
    border: 2px solid var(--card-bg);
}

/* Option Content */
.option-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Distribute content evenly in equal height cards */
}

.option-header {
    display: flex;
    align-items: center;
    gap: 8px; /* Exact 8px gap between title and badge */
    margin-bottom: 4px; /* Exact 4px spacing */
}

.option-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    padding: 0;
    color: var(--text-light);
    line-height: 1.2; /* Consistent line height */
}

.option-badge {
    background: linear-gradient(135deg, var(--accent-border-color) 0%, rgba(26, 188, 156, 0.8) 100%);
    color: #fff;
    padding: 2px 8px; /* Exact padding */
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap; /* Prevent badge text wrapping */
}

.option-description {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 8px 0; /* Exact 8px bottom margin */
    padding: 0;
    line-height: 1.3;
}

/* Option Pricing */
.option-pricing {
    display: flex;
    flex-direction: column;
    gap: 2px; /* Exact 2px gap between price elements */
    margin-top: auto; /* Push pricing to bottom of card */
}

.price-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-border-color);
    line-height: 1.2;
    margin: 0;
    padding: 0;
}

.price-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.2;
    margin: 0;
    padding: 0;
}

/* Checkout Button */
.checkout-button-primary {
    width: 100%;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1.5px solid var(--accent-border-color);
    background: var(--accent-color);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    margin-top: 10px;
}

.checkout-button-primary:hover {
    transform: translateY(-2px);
    background: var(--accent-border-color);
    box-shadow: 0 4px 16px rgba(26, 188, 156, 0.4);
}

.checkout-button-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.checkout-button-primary i {
    margin-right: 8px;
}

/* Animations */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.payment-option-card {
    animation: fadeSlideIn 0.3s ease-out;
}

/* Responsive Design - Mobile Pixel Perfect */
@media (max-width: 768px) {
    .payment-options-title {
        font-size: 1rem;
        margin: 12px 0 10px 0;
    }

    .payment-options-container {
        gap: 12px; /* Keep same 12px gap on mobile for consistency */
    }

    .payment-option-card {
        min-height: 110px; /* Match desktop height */
        padding: 14px; /* Slightly less than desktop but more than before */
        gap: 16px; /* Increased gap on mobile */
    }

    .option-icon {
        width: 40px; /* Keep same size on mobile for consistency */
        height: 40px;
        font-size: 1.1rem;
    }

    .option-title {
        font-size: 1rem;
        line-height: 1.2;
    }

    .option-description {
        font-size: 0.85rem;
        line-height: 1.3;
        margin: 0 0 8px 0; /* Exact spacing */
    }

    .price-amount {
        font-size: 1.35rem;
        line-height: 1.2;
    }

    .price-label {
        font-size: 0.85rem;
        line-height: 1.2;
    }

    .checkout-button-primary {
        padding: 12px 18px; /* Consistent 12px vertical padding */
        font-size: 0.95rem;
    }

    .payment-option-card.selected::after {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
        top: 6px;
        right: 6px;
    }
}

/* Loading State */
.payment-options-container[style*="opacity: 0.5"] {
    pointer-events: none;
    user-select: none;
}

/* Subtle Glow Effect on Hover */
.payment-option-card:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center,
        rgba(26, 188, 156, 0.08) 0%,
        transparent 70%);
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.payment-option-card:hover::before {
    opacity: 1;
}

/* Smooth Transitions */
* {
    transition: all var(--transition-speed) ease;
}

/* ============================================
   RTL Support for Arabic (lang=ar)
   ============================================ */

/* RTL Layout */
[dir="rtl"] .payment-options-title {
    text-align: right;
}

[dir="rtl"] .payment-option-card {
}

[dir="rtl"] .option-icon {
    margin-left: 0;
    margin-right: 0;
}

[dir="rtl"] .option-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .option-title {
    text-align: right;
}

[dir="rtl"] .option-description {
    text-align: right;
}

[dir="rtl"] .option-pricing {
    align-items: flex-end;
}

[dir="rtl"] .price-amount,
[dir="rtl"] .price-label {
    text-align: right;
}

[dir="rtl"] .checkout-button-primary i {
    margin-right: 0;
    margin-left: 8px;
}

/* RTL Checkmark on Icon */
[dir="rtl"] .payment-option-card.selected .option-icon::after {
    right: auto;
    left: -4px;
}

/* RTL Fee Badge - move to bottom-right in RTL */
[dir="rtl"] .card-fee-badge {
    left: auto;
    right: 12px;
}

/* RTL Checkout Button */
[dir="rtl"] .checkout-button-primary {
    direction: rtl;
}

#installmentOptionsContainerDesktop, #installmentOptionsContainerMobile {
    display: flex;
    flex-direction: column;
    gap: 12px;
}