/**
 * Checkout Upsell Styles - Ubenefit Pro Plan
 * Styled to match WooCommerce payment option boxes
 *
 * @package UCAM_Subscription_Upsell
 */

/* ============================================
   Main Container
   ============================================ */
.usu-upsell-container {
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.usu-upsell-container *,
.usu-upsell-container *::before,
.usu-upsell-container *::after {
    box-sizing: border-box;
}

/* ============================================
   Option Box (like payment method boxes)
   ============================================ */
.usu-option-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    margin: 0;
    background: #f0f9ff;
    border: 2px solid #7dd3fc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.usu-option-box:hover {
    background: #e0f2fe;
    border-color: #38bdf8;
}

/* Selected state - green theme */
.usu-option-box.usu-selected {
    background: #dcfce7;
    border-color: #22c55e;
}

.usu-option-box.usu-selected:hover {
    background: #bbf7d0;
    border-color: #16a34a;
}

/* ============================================
   Custom Checkbox (visible, styled)
   ============================================ */
.usu-option-box input[type="checkbox"] {
    /* Hide native checkbox but keep accessible */
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.usu-checkbox-custom {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    max-width: 22px;
    max-height: 22px;
    border: 2px solid #9ca3af;
    border-radius: 4px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-top: 2px;
}

.usu-option-box:hover .usu-checkbox-custom {
    border-color: #6b7280;
}

/* Checked state */
.usu-option-box.usu-selected .usu-checkbox-custom {
    background: #16a34a;
    border-color: #16a34a;
}

.usu-option-box.usu-selected .usu-checkbox-custom::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

/* ============================================
   Option Content
   ============================================ */
.usu-option-content {
    flex: 1;
    min-width: 0;
}

.usu-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.usu-plan-name-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.usu-plan-name {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

.usu-recommended-badge {
    display: inline-block;
    background: #dcfce7;
    color: #16a34a;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.usu-plan-price {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
}

.usu-plan-price .woocommerce-Price-amount {
    font-size: inherit;
    font-weight: inherit;
}

.usu-per-year {
    font-size: 13px;
    font-weight: 400;
    color: #6b7280;
}

.usu-option-details {
    font-size: 13px;
    color: #4b5563;
    line-height: 1.4;
}

/* Dynamic toggle labels - only show one at a time */
.usu-toggle-label {
    display: none;
}

.usu-label-add {
    display: inline;
}

.usu-option-box.usu-selected .usu-label-add {
    display: none;
}

.usu-option-box.usu-selected .usu-label-added {
    display: inline;
    color: #166534;
    font-weight: 500;
}

/* ============================================
   Benefits Panel (expands when selected)
   ============================================ */
.usu-benefits-panel {
    display: none;
    background: #f0f9ff;
    border: 2px solid #7dd3fc;
    border-top: none;
    border-radius: 0 0 8px 8px;
    margin-top: -8px;
    padding: 16px 20px;
    padding-left: 54px; /* Align with checkbox */
}

.usu-benefits-panel.usu-visible {
    display: block;
}

.usu-benefits-header {
    margin-bottom: 12px;
}

.usu-savings-badge {
    display: inline-block;
    background: #16a34a;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
}

/* Benefits List */
.usu-benefits-list {
    list-style: none !important;
    margin: 0 0 12px 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.usu-benefits-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #374151;
    margin: 0 !important;
    padding: 0 !important;
}

.usu-benefits-list li::before {
    display: none !important;
    content: none !important;
}

.usu-benefit-check {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    min-width: 18px;
    max-width: 18px;
    min-height: 18px;
    max-height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #16a34a;
    background: #dcfce7;
    border-radius: 50%;
}

.usu-benefits-list li strong {
    font-weight: 600;
}

/* Billing Note */
.usu-billing-note {
    font-size: 12px;
    color: #6b7280;
    padding-top: 8px;
    border-top: 1px solid #86efac;
}

.usu-billing-note em {
    font-style: italic;
}

/* ============================================
   Info Panel for Reservations
   ============================================ */
.usu-info-panel {
    margin-top: 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    overflow: hidden;
}

.usu-info-panel-header {
    padding: 12px 16px;
    background: #dbeafe;
    border-bottom: 1px solid #bfdbfe;
}

.usu-info-panel-header strong {
    font-size: 14px;
    color: #1e40af;
}

.usu-info-panel-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.usu-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.usu-step-num {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    min-width: 24px;
    max-width: 24px;
    min-height: 24px;
    max-height: 24px;
    background: #2563eb;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.usu-step-content {
    flex: 1;
    font-size: 13px;
    color: #374151;
    line-height: 1.4;
}

.usu-step-content strong {
    color: #1e40af;
}

/* ============================================
   Loading State
   ============================================ */
.usu-upsell-container.usu-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ============================================
   Order Table Savings Rows
   ============================================ */
.usu-savings-row td,
.usu-total-savings td {
    padding: 8px 0 !important;
}

.usu-savings-row .usu-plus {
    color: #555;
    font-size: 0.9em;
}

.usu-savings-row .usu-minus {
    display: block;
    margin-top: 2px;
    color: #10b981;
    font-weight: 600;
}

.usu-total-savings td {
    color: #10b981;
    font-weight: bold;
}

/* ============================================
   Subscriber Box (for existing subscribers)
   ============================================ */
.usu-subscriber-box {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 2px solid #3b82f6;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.usu-subscriber-box .usu-header {
    background: #2563eb;
    color: white;
    padding: 16px 20px;
}

.usu-subscriber-box .usu-content {
    padding: 20px;
}

.usu-subscriber-box .usu-pricing-breakdown {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

.usu-subscriber-box .usu-pricing-breakdown > div {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.usu-subscriber-box .usu-pricing-breakdown > div:last-child {
    border-bottom: none;
    padding-top: 12px;
    margin-top: 4px;
    border-top: 2px solid #e5e7eb;
}

/* ============================================
   Hide reservation elements when subscription active
   ============================================ */
body.usu-subscription-active .ucam-reservation-info,
body.usu-subscription-active .ucam-pay-in-full,
body.usu-subscription-active .ucam-authorization-notice,
body.usu-subscription-active .ucam-second-payment-auth,
body.usu-subscription-active .ucam-pay-full-wrapper,
body.usu-subscription-active .ucam-consent-checkbox-wrapper,
body.usu-subscription-active .ucam-reservation-steps,
body.usu-subscription-active .ucam-checkout-summary,
body.usu-subscription-active [class*="reservation-payment"],
body.usu-subscription-active [class*="pay-later"],
body.usu-subscription-active .woocommerce-checkout-reservation-info {
    display: none !important;
}

/* Styling for "Included in Plan" / "Free" labels in cart */
.usu-included-in-plan,
.usu-free-with-plan {
    color: #16a34a;
    font-weight: 600;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 480px) {
    .usu-option-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .usu-benefits-panel {
        padding-left: 20px;
    }
}
