/* ===================================
   Modern Stripe Payment UI - Dark Theme
   Integrates with Lagom2 Dark Theme
   =================================== */

/* Keep dark background */
body.page-viewinvoice,
body.page-invoice-payment,
body.page-account-paymentmethods,
body.page-account-paymentmethods-manage,
body.page-cart {
    background: #0d0d0d !important;
}

/* Main content transparent */
.page-viewinvoice .main-content,
.page-invoice-payment .main-content,
.page-account-paymentmethods .main-content,
.page-cart .main-content {
    background: transparent !important;
}

/* Section titles - white text */
.section-header h2,
.invoice-payment .section-header h2,
.payment-section-title {
    color: #ffffff !important;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
}

/* Dark gray card containers (match existing cards) */
.panel.panel-form.cc-payment-form,
.cc-input-container .panel,
.payment-method-container,
.section .section-body .panel {
    background: #2b2b2b !important;
    border: 1px solid #3a3a3a !important;
    border-radius: 12px !important;
    padding: 32px !important;
    box-shadow: none !important;
    margin-bottom: 24px !important;
}

/* Stripe Element Container - ensure it's visible */
#stripe-payment-element-container,
.stripe-payment-wrapper,
#stripe-payment-element,
#stripe-card-element,
.StripeElement {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 200px !important;
    width: 100% !important;
}

/* Stripe iframes must be visible */
iframe[name*="__privateStripe"],
iframe[name*="stripe"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    border: none !important;
}

/* Payment method selection tabs - dark gray */
.payment-method-tabs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.payment-method-tab {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #333333;
    border: 1px solid #444444;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.payment-method-tab:hover {
    border-color: #7c3aed;
    background: #3a3a3a;
}

.payment-method-tab.active {
    border-color: #7c3aed;
    background: #3d2d5f;
}

.payment-method-tab-icon {
    width: 32px;
    height: 32px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.payment-method-tab-label {
    font-size: 15px;
    font-weight: 500;
    color: #ffffff;
    flex: 1;
}

.payment-method-tab-badge {
    font-size: 13px;
    color: #00aa9e;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Form labels - light gray */
.form-group label,
.payment-method-name-input label {
    color: #d1d5db !important;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
}

/* Input fields - white background for readability */
input[type="text"].form-control,
input[type="tel"].form-control,
input[type="email"].form-control,
select.form-control {
    background: #ffffff !important;
    border: 1px solid #444444 !important;
    border-radius: 6px !important;
    padding: 12px 16px !important;
    font-size: 16px !important;
    color: #1a1a1a !important;
    transition: all 0.2s ease !important;
}

input[type="text"].form-control:focus,
input[type="tel"].form-control:focus,
input[type="email"].form-control:focus,
select.form-control:focus {
    border-color: #7c3aed !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2) !important;
}

input[type="text"].form-control::placeholder,
input[type="tel"].form-control::placeholder,
input[type="email"].form-control::placeholder {
    color: #9ca3af !important;
}

/* Payment method name input */
.payment-method-name-input {
    margin-top: 24px;
}

.payment-method-name-input input {
    background: #ffffff !important;
    border: 1px solid #444444 !important;
    border-radius: 6px !important;
    padding: 12px 16px !important;
    width: 100%;
    max-width: 400px;
}

/* Terms and consent text */
.payment-consent-text {
    font-size: 13px;
    color: #9ca3af;
    line-height: 1.5;
    margin-top: 16px;
}

.payment-consent-text a {
    color: #7c3aed;
    text-decoration: none;
}

.payment-consent-text a:hover {
    text-decoration: underline;
}

/* Alert/error messages */
.alert.alert-danger,
.gateway-errors {
    background: #fef2f2 !important;
    border: 1px solid #fecaca !important;
    border-radius: 8px !important;
    color: #991b1b !important;
    padding: 12px 16px !important;
    margin-bottom: 16px !important;
}

.alert.alert-success {
    background: #f0fdf4 !important;
    border: 1px solid #bbf7d0 !important;
    border-radius: 8px !important;
    color: #166534 !important;
    padding: 12px 16px !important;
}

/* Security notice */
.checkout-security-msg {
    background: #3a2f1f !important;
    border: 1px solid #5a4a2a !important;
    border-radius: 8px !important;
    color: #fbbf24 !important;
    padding: 12px 16px !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Payment button - purple accent matching theme */
.btn-payment,
.btn-submit-payment,
#btnSubmit {
    background: #7c3aed !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 14px 24px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    width: 100%;
    max-width: 400px;
}

.btn-payment:hover,
.btn-submit-payment:hover,
#btnSubmit:hover {
    background: #6d28d9 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3) !important;
}

.btn-payment:active,
.btn-submit-payment:active,
#btnSubmit:active {
    transform: translateY(0);
}

/* Invoice summary sidebar - dark gray */
.invoice-summary,
.order-summary {
    background: #2b2b2b !important;
    border: 1px solid #3a3a3a !important;
    border-radius: 12px !important;
    padding: 24px !important;
    box-shadow: none !important;
}

.invoice-summary h3,
.order-summary h3 {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.invoice-summary *,
.order-summary * {
    color: #d1d5db;
}

/* Saved payment methods list */
.cc-item {
    background: #333333 !important;
    border: 2px solid #444444 !important;
    border-radius: 8px !important;
    padding: 16px !important;
    margin-bottom: 12px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.cc-item:hover {
    border-color: #7c3aed !important;
}

.cc-item.active {
    border-color: #7c3aed !important;
    background: #3d2d5f !important;
}

.cc-item-brand {
    font-weight: 600;
    color: #ffffff;
}

.cc-item-number {
    color: #9ca3af;
    font-size: 14px;
}

/* Text colors in dark panels */
.panel.panel-form p,
.panel.panel-form label,
.panel.panel-form span {
    color: #d1d5db !important;
}

.panel.panel-form h1,
.panel.panel-form h2,
.panel.panel-form h3,
.panel.panel-form h4 {
    color: #ffffff !important;
}

/* Radio buttons styling */
.payment-method-tab input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.payment-method-tab::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #666666;
    border-radius: 50%;
    margin-right: 12px;
    transition: all 0.2s ease;
    background: #2b2b2b;
}

.payment-method-tab.active::before {
    border-color: #7c3aed;
    background: #7c3aed;
    box-shadow: inset 0 0 0 3px #2b2b2b;
}

/* Table styling in invoice summary */
.invoice-summary table,
.order-summary table {
    color: #d1d5db;
}

.invoice-summary table td,
.order-summary table td,
.invoice-summary table th,
.order-summary table th {
    color: #d1d5db !important;
    border-color: #444444 !important;
}

/* Responsive */
@media (max-width: 768px) {
    .panel.panel-form.cc-payment-form,
    .cc-input-container .panel {
        padding: 24px 20px !important;
    }
    
    .section-header h2 {
        font-size: 20px;
    }
    
    .btn-payment,
    .btn-submit-payment,
    #btnSubmit {
        max-width: 100%;
    }
}

/* Override any Lagom white backgrounds */
.lagom .panel-form {
    box-shadow: none !important;
    background: #2b2b2b !important;
}

/* Ensure all text in payment sections is light */
.page-viewinvoice .section-body,
.page-invoice-payment .section-body,
.page-viewinvoice p,
.page-invoice-payment p,
.page-viewinvoice label,
.page-invoice-payment label {
    color: #d1d5db;
}

/* Keep input fields readable */
.page-viewinvoice input,
.page-invoice-payment input,
.page-account-paymentmethods input {
    color: #1a1a1a !important;
}

/* Promo code section styling */
.section.section-promo {
    background: #2b2b2b;
    border: 1px solid #3a3a3a;
    border-radius: 12px;
    padding: 24px;
}

.section-promo input {
    background: #ffffff !important;
    border: 1px solid #444444 !important;
}

.section-promo button {
    background: #444444 !important;
    color: #ffffff !important;
    border: 1px solid #555555 !important;
}

.section-promo button:hover {
    background: #555555 !important;
}

/* CRITICAL: Don't hide Stripe elements */
#stripe-payment-element *,
#stripe-card-element *,
.StripeElement * {
    display: initial !important;
    visibility: visible !important;
}
