/**
 * Payment Options Styling
 *
 * Styles for the 50%-50% payment option UI.
 * Matches MPHB gateway list styling.
 *
 * @package BlijSchaapCore
 */

/* ==========================================================================
   Payment Options Container (inside mphb-billing-details)
   ========================================================================== */

.bsc-payment-options {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.bsc-payment-options-title {
    margin: 0 0 8px;
    padding: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1b3254;
}

.bsc-payment-options-intro {
    margin: 0 0 15px;
    padding: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* ==========================================================================
   Payment Options List - Match MPHB gateways-list styling
   ========================================================================== */

.bsc-payment-options-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   Individual Payment Option - Card-style with border and hover
   ========================================================================== */

.bsc-payment-option {
    display: block;
    position: relative;
    margin-bottom: 12px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bsc-payment-option:last-child {
    margin-bottom: 0;
}

.bsc-payment-option:hover {
    border-color: #1b3254;
    box-shadow: 0 2px 8px rgba(27, 50, 84, 0.1);
}

.bsc-payment-option.selected {
    border-color: #1b3254;
    background: #f8f9fb;
    box-shadow: 0 2px 12px rgba(27, 50, 84, 0.15);
}

/* Radio button styling */
.bsc-payment-option input[type="radio"] {
    margin-right: 10px;
    vertical-align: middle;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ==========================================================================
   Option Content
   ========================================================================== */

.bsc-payment-option-content {
    display: inline-block;
    vertical-align: middle;
    width: calc(100% - 30px);
}

.bsc-payment-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.bsc-payment-option-title {
    font-weight: 600;
    font-size: 15px;
    color: #1b3254;
}

.bsc-payment-option-amount {
    font-weight: 700;
    font-size: 16px;
    color: #1b3254;
}

/* ==========================================================================
   Option Description
   ========================================================================== */

.bsc-payment-option-description {
    display: block;
    margin: 0;
    padding: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.bsc-payment-option-reminder {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #888;
    font-style: italic;
}

/* ==========================================================================
   Selected State - Highlight selected option
   ========================================================================== */

.bsc-payment-option.selected .bsc-payment-option-title {
    color: #1b3254;
}

.bsc-payment-option.selected .bsc-payment-option-amount {
    color: #2ecc71;
}

/* ==========================================================================
   Pay Now Display (below total price)
   ========================================================================== */

.bsc-pay-now-amount {
    margin-top: 10px;
    padding: 12px 15px;
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    border-radius: 4px;
}

.bsc-pay-now-amount output {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
}

.bsc-pay-now-label {
    font-weight: 600;
    color: #333;
}

.bsc-pay-now-value {
    font-size: 18px;
    font-weight: 700;
    color: #1e7e34;
}

/* ==========================================================================
   Hide default MPHB deposit display when we have our custom one
   ========================================================================== */

.mphb-deposit-amount:not(.bsc-pay-now-amount) {
    display: none !important;
}

/* ==========================================================================
   Gateway List Title and Main Section Title
   ========================================================================== */

#mphb-billing-details .mphb-gateway-chooser-title {
    margin: 0 0 20px;
    padding: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1b3254;
}

.bsc-gateway-title {
    margin: 20px 0 12px;
    padding: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1b3254;
}

/* ==========================================================================
   Gateway List Styling - Match payment options style
   ========================================================================== */

#mphb-billing-details .mphb-gateways-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

#mphb-billing-details .mphb-gateway {
    display: block;
    position: relative;
    margin-bottom: 12px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* ==========================================================================
   Single Gateway Styling - When only one payment method is available
   JavaScript wraps title + description in .bsc-single-gateway-card
   ========================================================================== */

/* Single gateway card - unified container with checkmark (green theme) */
.bsc-single-gateway-card {
    position: relative;
    display: block;
    padding: 15px 15px 15px 50px;
    border: 2px solid #28a745;
    border-radius: 6px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.15);
}

/* Checkmark indicator */
.bsc-gateway-checkmark {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: #28a745;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
}

/* Title inside card */
.bsc-single-gateway-card .mphb-gateway-title {
    display: block;
    margin: 0 0 5px;
}

.bsc-single-gateway-card .mphb-gateway-title strong {
    font-weight: 600;
    font-size: 15px;
    color: #166534;
}

/* Description inside card */
.bsc-single-gateway-card .mphb-gateway-description {
    margin: 0;
    padding: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

/* Hide original elements when JS has wrapped them */
#mphb-billing-details.bsc-single-gateway > .mphb-gateway-title,
#mphb-billing-details.bsc-single-gateway > .mphb-gateway-description {
    display: none;
}

#mphb-billing-details .mphb-gateway:hover {
    border-color: #1b3254;
    box-shadow: 0 2px 8px rgba(27, 50, 84, 0.1);
}

#mphb-billing-details .mphb-gateway.selected {
    border-color: #1b3254;
    background: #f8f9fb;
    box-shadow: 0 2px 12px rgba(27, 50, 84, 0.15);
}

#mphb-billing-details .mphb-gateway input[type="radio"] {
    margin-right: 10px;
    vertical-align: middle;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

#mphb-billing-details .mphb-gateway-title {
    display: inline-block;
    vertical-align: middle;
}

#mphb-billing-details .mphb-gateway-title strong {
    font-weight: 600;
    font-size: 15px;
    color: #1b3254;
}

#mphb-billing-details .mphb-gateway-description {
    display: block;
    margin: 5px 0 0 28px;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 768px) {
    .bsc-payment-option,
    #mphb-billing-details .mphb-gateway {
        padding: 12px;
    }

    .bsc-payment-option-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .bsc-payment-option-amount {
        font-size: 15px;
    }

    .bsc-pay-now-amount output {
        gap: 8px;
    }

    .bsc-pay-now-value {
        font-size: 17px;
    }
}

@media (max-width: 480px) {
    .bsc-payment-options-intro {
        font-size: 13px;
    }

    .bsc-payment-option,
    #mphb-billing-details .mphb-gateway {
        padding: 10px;
    }

    .bsc-payment-option-content {
        width: calc(100% - 25px);
    }

    .bsc-payment-option-title,
    #mphb-billing-details .mphb-gateway-title strong {
        font-size: 14px;
    }

    .bsc-payment-option-amount {
        font-size: 14px;
    }

    .bsc-payment-option-description,
    #mphb-billing-details .mphb-gateway-description {
        font-size: 12px;
    }

    .bsc-pay-now-amount output {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .bsc-pay-now-value {
        font-size: 16px;
    }
}

/* ==========================================================================
   Price Loading Spinner
   ========================================================================== */

.bsc-price-loading {
    display: inline-block;
    position: relative;
    min-width: 50px; /* Ensure space for spinner */
    min-height: 20px;
}

/* Hide ALL text content while loading using font-size 0 trick */
.bsc-price-loading,
.bsc-price-loading * {
    font-size: 0 !important;
    color: transparent !important;
    text-shadow: none !important;
}

/* Show spinner in center of element, replacing text */
.bsc-price-loading::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid #1b3254;
    border-top-color: transparent;
    border-radius: 50%;
    animation: bsc-spinner-rotate 0.6s linear infinite;
}

@keyframes bsc-spinner-rotate {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Spinner for payment option amounts - smaller */
.bsc-payment-option-amount.bsc-price-loading::after {
    width: 14px;
    height: 14px;
}

/* Spinner in sidebar summary - larger */
.mphb-total-price-field.bsc-price-loading::after {
    width: 18px;
    height: 18px;
    border-width: 2.5px;
}

/* Spinner in sidebar price breakdown */
.mphb-booking-details .mphb-price.bsc-price-loading::after,
.mphb-reserve-room-section .mphb-price.bsc-price-loading::after,
.bsc-checkout-sidebar .mphb-price.bsc-price-loading::after {
    width: 14px;
    height: 14px;
}

/* Spinner for "Te betalen nu" value */
.bsc-pay-now-value.bsc-price-loading::after {
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   Deposit Display in Sidebar Price Breakdown
   ========================================================================== */

/* Deposit row in price breakdown table - match mphb-price-breakdown styling */
.bsc-checkout-sidebar .bsc-deposit-row td,
.bsc-checkout-sidebar .bsc-deposit-row td .mphb-price {
    padding: 3px 0 !important;
    font-size: 0.78rem !important;
    line-height: 1.4 !important;
    color: var(--bsc-text, #333) !important;
    background: transparent !important;
    border: none !important;
}

.bsc-checkout-sidebar .bsc-deposit-row td:first-child {
    width: 65%;
    padding-right: 8px !important;
}

.bsc-checkout-sidebar .bsc-deposit-row td:last-child,
.bsc-checkout-sidebar .bsc-deposit-row td:last-child .mphb-price {
    width: 35%;
    text-align: right !important;
    font-weight: 500 !important;
    white-space: nowrap;
    font-size: 0.78rem !important;
}

/* "Now to pay" row - highlighted, matches total row styling */
.bsc-checkout-sidebar .bsc-now-to-pay-row td,
.bsc-checkout-sidebar .bsc-now-to-pay-row td .mphb-price {
    padding-top: 8px !important;
    border-top: 2px solid var(--bsc-text, #333) !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    color: var(--bsc-text, #333) !important;
    background: transparent !important;
}

.bsc-checkout-sidebar .bsc-now-to-pay-row td:last-child,
.bsc-checkout-sidebar .bsc-now-to-pay-row td:last-child .mphb-price {
    text-align: right !important;
    color: #1e7e34 !important;
    font-size: 0.85rem !important;
}

/* ==========================================================================
   Total Price Box - Deposit Mode Styling
   ========================================================================== */

/* Label in total price box */
.bsc-checkout-sidebar .mphb-total-price .bsc-total-label {
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.9;
}

/* Remaining amount display below total */
.bsc-checkout-sidebar .bsc-remaining-amount {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.8rem;
    opacity: 0.85;
}

.bsc-checkout-sidebar .bsc-remaining-label {
    font-weight: 400;
}

.bsc-checkout-sidebar .bsc-remaining-value {
    font-weight: 600;
}
