/**
 * beOne Payment Plugin - Frontend Styles (Updated)
 * Version: 2.0.0
 */

/* Container & Grundstruktur - Mit besserer Isolation */
.beone-payment-wrapper {
    /* Reset inherited styles */
    all: initial;
    /* Apply our styles */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    color: #333 !important;
    box-sizing: border-box !important;
    /* Fix display and width */
    display: block !important; /* WICHTIG: block statt inline */
    width: 100% !important;
    overflow-x: hidden !important;
}

.beone-payment-wrapper * {
    box-sizing: border-box !important;
}

.beone-payment-container {
    max-width: 100%; /* Nimmt die volle Breite des umgebenden Containers */
    width: 100%; /* Nimmt volle verfügbare Breite */
    margin: 0 auto;
    background: #ffffff !important;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07), 0 10px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Ensure container doesn't exceed viewport */
    box-sizing: border-box !important;
}

/* Breiten-Varianten für verschiedene Layouts */
.beone-payment-wrapper.narrow .beone-payment-container {
    max-width: 500px; /* Für schmale Spalten */
}

.beone-payment-wrapper.medium .beone-payment-container {
    max-width: 600px; /* Standard-Breite */
}

.beone-payment-wrapper.wide .beone-payment-container {
    max-width: 100%; /* Für 2-Spalten-Layout - nutzt volle verfügbare Breite */
}

.beone-payment-wrapper.full .beone-payment-container {
    max-width: 100%; /* Volle Breite */
    max-width: 1200px; /* Aber maximal 1200px */
}

/* Responsive Anpassungen */
@media (max-width: 820px) {
    .beone-payment-wrapper {
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .beone-payment-container {
        max-width: 100%;
        width: 100%;
        border-radius: 0;
        box-shadow: none;
        border: none;
        margin: 0;
    }
}

@media (max-width: 600px) {
    .beone-payment-container {
        padding: 0;
        width: 100vw;
        max-width: 100vw;
        margin-left: 0;
        margin-right: 0;
    }
    
    .beone-form-section {
        padding: 20px !important;
        margin: 15px !important;
    }
    
    .beone-form-row {
        grid-template-columns: 1fr !important;
    }
}

/* Header */
.beone-payment-header {
    background: linear-gradient(135deg, #7d7874 0%, #5a5652 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.beone-header-logo {
    margin-bottom: 15px;
}

.beone-header-logo img {
    max-width: 150px;
    height: auto;
    display: block;
    margin: 0 auto;
    /* Filter entfernt - Logo ist bereits hell genug */
}

.beone-payment-header h1 {
    font-size: 26px;
    margin-bottom: 8px;
    font-weight: 600;
    color: white;
}

.beone-payment-header h2 {
    font-size: 24px;
    margin-bottom: 8px;
    font-weight: 600;
}

.beone-header-subtitle {
    font-size: 16px;
    opacity: 0.95;
    margin: 0 0 15px 0;
    font-weight: 300;
    color: white;
    line-height: 1.4;
}

.beone-price-display {
    font-size: 18px;
    opacity: 0.95;
}

.beone-price-display strong {
    font-size: 24px;
    font-weight: 700;
}

/* Form */
.beone-form {
    padding: 35px;
    /* Prevent overflow */
    overflow-x: hidden;
    box-sizing: border-box;
}

@media (min-width: 601px) and (max-width: 760px) {
    .beone-form {
        padding: 30px;
    }
}

@media (max-width: 600px) {
    .beone-form {
        padding: 15px;
        max-width: 100%;
    }
}

/* Einleitungstext und Preisanzeige */
.beone-intro-section {
    padding: 0 0 25px 0;
    margin-bottom: 25px;
    border-bottom: 2px solid #f0f0f0;
}

.beone-intro-text {
    font-size: 16px;
    color: #666;
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.5;
}

.beone-payment-wrapper .beone-price-display-box {
    background: #f8f9fa !important;
    border: 2px solid #e9ecef !important;
    border-radius: 12px !important;
    padding: 20px !important;
    text-align: center !important;
    display: block !important;
    margin: 0 auto !important;
}

.beone-payment-wrapper .beone-service-title {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin: 0 0 10px 0 !important;
    display: block !important;
}

.beone-payment-wrapper .beone-price-amount {
    margin: 0 !important;
    display: block !important;
}

.beone-payment-wrapper .beone-price-value {
    font-size: 32px !important;
    font-weight: 700 !important;
    color: #7d7874 !important;
    display: inline-block !important;
}

@media (max-width: 600px) {
    .beone-intro-section {
        padding: 0 0 20px 0;
        margin-bottom: 20px;
    }
    
    .beone-intro-text {
        font-size: 14px;
    }
    
    .beone-payment-wrapper .beone-price-display-box {
        padding: 15px !important;
    }
    
    .beone-payment-wrapper .beone-service-title {
        font-size: 16px !important;
    }
    
    .beone-payment-wrapper .beone-price-value {
        font-size: 28px !important;
    }
}

.beone-form-section {
    margin-bottom: 40px;
}

.beone-form-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

/* Rechtliche Einwilligungen Sektion */
.beone-legal-section {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 25px !important;
    margin: 25px 0 !important;  /* Geändert: horizontale Margins entfernt */
    box-sizing: border-box;
}

@media (max-width: 600px) {
    .beone-legal-section {
        margin: 15px 0 !important;  /* Auch hier horizontale Margins entfernt */
        padding: 15px !important;
    }
}

.beone-legal-section h3 {
    font-size: 17px;
    margin-bottom: 15px;
    color: #495057;
    border-bottom: none;
    padding-bottom: 0;
}

.beone-legal-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #f5c6cb;
    display: flex;
    align-items: center;
    gap: 10px;
}

.beone-legal-error .error-icon {
    font-size: 20px;
}

.beone-legal-section .beone-checkbox-group {
    margin-bottom: 12px;
}

.beone-legal-section.has-error {
    border-color: #dc3545;
    background: #fff5f5;
}

.beone-legal-section.has-error .beone-checkbox-group label {
    color: #dc3545;
}

/* Form Elements */
.beone-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.beone-form-group {
    margin-bottom: 20px;
}

.beone-form-group-small {
    max-width: 150px;
}

.beone-form-group-large {
    flex: 1;
}

.beone-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.beone-form-group input[type="text"],
.beone-form-group input[type="email"],
.beone-form-group input[type="tel"],
.beone-form-group input[type="date"],
.beone-form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s ease;
    background: white;
    box-sizing: border-box;
}

.beone-form-group input:focus {
    outline: none;
    border-color: #7d7874;
    box-shadow: 0 0 0 3px rgba(125, 120, 116, 0.1);
}

/* Special layout for PLZ and Ort */
.beone-form-row .beone-form-group-small {
    max-width: 150px;
}

.beone-form-row .beone-form-group-large {
    flex: 1;
}

/* Payment Methods - Direct Layout */
.payment-method-direct {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    background: #fff;
}

.payment-method-direct .payment-method-content {
    display: block !important;
    padding: 20px;
}

/* Submit Button innerhalb der Kreditkarten-Box */
.payment-method-direct .beone-submit-button {
    margin-top: 20px;
    width: 100%;
}

.payment-method-direct .beone-security-info {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.payment-method-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    gap: 10px;
}



.payment-title {
    flex: 1;
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.payment-logos {
    display: flex;
    align-items: center;
    gap: 10px;
}

.payment-logos img {
    height: 24px;
    width: auto;
}

.payment-method-content {
    padding: 20px;
    display: block !important;
}

/* Stripe Card Element */
.beone-card-element,
#card-element {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    min-height: 44px;
    display: block;
}

/* Stripe Element Styles */
.StripeElement {
    padding: 12px;
    min-height: 44px;
}

.beone-card-element.StripeElement--focus {
    border-color: #7d7874;
    box-shadow: 0 0 0 3px rgba(125, 120, 116, 0.1);
}

.beone-card-element.StripeElement--invalid {
    border-color: #fa755a;
}


/* PayPal Section */
#paypal-button-container {
    min-height: 100px;
    display: block;
}

.payment-method-info {
    margin-top: 12px;
    font-size: 14px;
    color: #666;
    text-align: center;
}

/* Divider */
.divider-with-text {
    text-align: center;
    margin: 30px 0;
    position: relative;
}

.divider-with-text:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e0e0e0;
}

.divider-with-text span {
    position: relative;
    padding: 0 20px;
    background: white;
    color: #999;
    font-size: 14px;
}

/* Weitere Zahlungsmöglichkeiten Box */
.payment-alternatives-box {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    background: #f8f9fa;
}

.beone-stripe-checkout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.beone-stripe-checkout-btn:hover {
    border-color: #7d7874;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}



.btn-content {
    flex: 1;
    text-align: left;
    margin: 0 15px;
}

.btn-content strong {
    display: block;
    font-size: 16px;
    color: #333;
    margin-bottom: 8px;
}

.payment-icons-inline {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 8px;
}

.payment-icons-inline img {
    height: 20px;
    width: auto;
    opacity: 0.8;
}

.btn-arrow {
    font-size: 20px;
    color: #666;
}

.payment-info-text {
    margin-top: 12px;
    font-size: 12px;
    color: #999;
    text-align: center;
}

/* Powered by Stripe */
.powered-by-stripe {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.powered-by-stripe span {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.powered-by-stripe img {
    height: 20px;
    opacity: 0.7;
}

/* Checkboxes */
.beone-checkbox-group {
    margin-bottom: 15px;
}

.beone-checkbox-group label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
}

.beone-checkbox-group input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 2px;
}

.beone-checkbox-group a {
    color: #7d7874;
    text-decoration: underline;
}

/* Submit Button */
.beone-submit-button {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #7d7874 0%, #5a5652 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.beone-submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.beone-submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Security Info */
.beone-security-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    font-size: 13px;
    color: #666;
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    .beone-security-info {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

/* PayPal Button Container - Schwarzen Rand bei Fehler entfernen */
#paypal-button-container {
    border: none !important;
    outline: none !important;
}

#paypal-button-container > * {
    border: none !important;
    outline: none !important;
}

#paypal-button-container iframe {
    border: none !important;
    outline: none !important;
}

/* PayPal Error State Override */
.paypal-buttons-context-iframe {
    border: none !important;
}

.paypal-buttons-component {
    border: none !important;
}

/* Loading Overlay */
.beone-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.beone-spinner {
    text-align: center;
    color: white;
}

.spinner-circle {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* PayPal spezifische iframe Styles */
.component-frame,
.paypal-buttons-iframe,
.prerender-frame {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Stelle sicher, dass der PayPal Container keinen Rand hat */
#paypal-payment-section .payment-method-content {
    border: none !important;
}

.paypal-powered-by {
    border: none !important;
}

/* Messages */
.beone-message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 14px;
}

.beone-message.error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.beone-message.success {
    background: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

/* Error states */
.beone-form-group input.error {
    border-color: #fa755a !important;
    background-color: #fff5f5;
}

.beone-field-error,
#card-errors {
    color: #fa755a;
    font-size: 13px;
    margin-top: 5px;
    font-weight: 500;
}

/* Error Fields */
.beone-field-error {
    color: #c33;
    font-size: 13px;
    margin-top: 5px;
}

/* Responsive */
@media (max-width: 640px) {
    .beone-form-row {
        grid-template-columns: 1fr;
    }
    
    .payment-icons-inline {
        flex-wrap: wrap;
    }
    
    .beone-payment-container {
        border-radius: 0;
        box-shadow: none;
        width: 100%;
        max-width: 100%;
    }
    
    .beone-form {
        padding: 15px;
    }
    
    /* Ensure all inner elements respect viewport width */
    .beone-payment-wrapper,
    .beone-payment-container,
    .beone-form,
    .beone-form-section,
    .beone-legal-section,
    .payment-method-direct,
    .payment-alternatives-box {
        max-width: 100%;
        width: 100%;
        box-sizing: border-box !important;
    }
    
    /* Adjust button and input widths */
    .beone-submit-button,
    .beone-stripe-checkout-btn,
    .beone-form-group input[type="text"],
    .beone-form-group input[type="email"],
    .beone-form-group input[type="tel"],
    .beone-form-group input[type="date"],
    .beone-form-group select {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box !important;
    }
}