/*
 Theme Name:   Regulint Theme
 Theme URI:    https://regulint.com
 Description:  Astra Child Theme for Regulint - includes referral system and checkout integration
 Author:       Regulint GmbH
 Author URI:   https://regulint.com
 Template:     astra
 Version:      2.0.4
 License:      Proprietary
 Text Domain:  regulint-theme
*/

/* ==========================================================================
   Referral Discount Styling
   ========================================================================== */

/* Durchgestrichener Originalpreis */
.regulint-price-original {
    text-decoration: line-through;
    color: #888;
    font-size: 0.85em;
    margin-right: 8px;
}

/* Rabattierter Preis */
.regulint-price-discounted {
    color: #22c55e;
    font-weight: bold;
}

/* Rabatt-Badge */
.regulint-discount-badge {
    display: inline-block;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: 600;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Partner-Banner */
.regulint-partner-banner {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.regulint-partner-banner__text {
    font-size: 0.95em;
}

.regulint-partner-banner__discount {
    font-size: 1.2em;
    font-weight: bold;
}

/* AGB/AVV Checkboxen */
.regulint-legal-checkboxes {
    margin: 16px 0;
    font-size: 0.9em;
}

.regulint-legal-checkboxes label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
}

.regulint-legal-checkboxes input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
}

.regulint-legal-checkboxes a {
    color: #3b82f6;
    text-decoration: underline;
}

/* Checkout Button Zustände */
.regulint-checkout-btn {
    transition: all 0.2s ease;
}

.regulint-checkout-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.regulint-checkout-btn--loading {
    position: relative;
    color: transparent !important;
}

.regulint-checkout-btn--loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: regulint-spin 0.8s linear infinite;
}

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

/* Error Message */
.regulint-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 12px 0;
    font-size: 0.9em;
}

/* ==========================================================================
   Quantity Slider
   ========================================================================== */

.regulint-quantity-slider {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.regulint-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 500;
}

.regulint-quantity-value {
    background: #1e293b;
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

.regulint-slider-input {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin-bottom: 16px;
}

.regulint-slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #1e293b;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease;
}

.regulint-slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.regulint-slider-input::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #1e293b;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.regulint-price-breakdown {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e2e8f0;
}

.regulint-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.regulint-price-row:not(:last-child) {
    border-bottom: 1px solid #f1f5f9;
}

.regulint-price-total {
    font-weight: 600;
    font-size: 1.1em;
}

.regulint-price-discount {
    color: #22c55e;
}

.regulint-discount-value {
    font-weight: 600;
}

.regulint-savings {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
    color: #22c55e;
    font-weight: 500;
    text-align: center;
}

/* ==========================================================================
   Checkout Modal
   ========================================================================== */

/* Scaled font sizes for modal - uses --rp-ui-scale from scale.css */
.regulint-modal {
  --modal-font-4xs: calc(10px * var(--rp-ui-scale, 1));
  --modal-font-3xs: calc(11px * var(--rp-ui-scale, 1));
  --modal-font-2xs: calc(12px * var(--rp-ui-scale, 1));
  --modal-font-xs: calc(13px * var(--rp-ui-scale, 1));
  --modal-font-sm: calc(14px * var(--rp-ui-scale, 1));
  --modal-font-base: calc(15px * var(--rp-ui-scale, 1));
  --modal-font-md: calc(16px * var(--rp-ui-scale, 1));
  --modal-font-lg: calc(18px * var(--rp-ui-scale, 1));
  --modal-font-xl: calc(20px * var(--rp-ui-scale, 1));
}

.regulint-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.regulint-modal--open {
    opacity: 1;
    visibility: visible;
}

.regulint-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.regulint-modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 560px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.regulint-modal--open .regulint-modal-content {
    transform: translateY(0);
}

.regulint-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: #f1f5f9;
    border-radius: 50%;
    font-size: var(--modal-font-xl);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.2s ease;
}

.regulint-modal-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.regulint-modal-title {
    font-size: var(--modal-font-xl);
    font-weight: 700;
    margin-bottom: 20px;
    color: #1e293b;
}

/* Order Summary */
.regulint-order-summary {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.regulint-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: var(--modal-font-xs);
}

.regulint-summary-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 8px 0;
}

.regulint-summary-total-row {
    font-size: var(--modal-font-base);
    font-weight: 700;
    color: #1e293b;
}

.regulint-summary-discount {
    color: #22c55e;
}

.regulint-summary-savings {
    color: #22c55e;
}

/* Summary Items */
.regulint-summary-item {
    padding: 8px 0;
}

.regulint-summary-item:not(:last-child) {
    border-bottom: 1px solid #e2e8f0;
}

.regulint-summary-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--modal-font-xs);
    font-weight: 600;
    color: #1e293b;
}

.regulint-summary-item-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    font-size: var(--modal-font-2xs);
    color: #64748b;
}

.regulint-summary-item-unit {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Form Styling */
.regulint-checkout-form h3 {
    font-size: var(--modal-font-xs);
    font-weight: 600;
    margin: 20px 0 12px;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.regulint-checkout-form h3:first-of-type {
    margin-top: 0;
}

.regulint-form-group {
    margin-bottom: 16px;
}

.regulint-form-group label {
    display: block;
    font-size: var(--modal-font-2xs);
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

.regulint-form-group input[type="text"],
.regulint-form-group input[type="email"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: var(--modal-font-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.regulint-form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.regulint-form-group input::placeholder {
    color: #9ca3af;
}

.regulint-form-row {
    display: flex;
    gap: 16px;
}

.regulint-form-group-small {
    flex: 0 0 120px;
}

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

/* B2B Optional Fields (Weitere Angaben) */
.regulint-b2b-fields {
    margin-top: var(--rp-spacing-lg, 24px);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.regulint-b2b-toggle {
    font-size: var(--modal-font-sm);
    font-weight: 500;
    color: #475569;
    padding: 12px 16px;
    cursor: pointer;
    background: #f8fafc;
    list-style: none;
}

.regulint-b2b-toggle::-webkit-details-marker {
    display: none;
}

.regulint-b2b-toggle::before {
    content: '+';
    margin-right: 8px;
    font-weight: 600;
}

.regulint-b2b-fields[open] .regulint-b2b-toggle::before {
    content: '−';
}

.regulint-b2b-content {
    padding: 16px;
    border-top: 1px solid #e2e8f0;
}

.regulint-form-hint {
    display: block;
    font-size: var(--modal-font-2xs);
    color: #94a3b8;
    margin-top: 4px;
}

/* Legal Section */
.regulint-legal-section {
    margin: 24px 0;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
}

.regulint-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: var(--modal-font-2xs);
    line-height: 1.5;
}

.regulint-checkbox-label:last-child {
    margin-bottom: 0;
}

.regulint-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: #3b82f6;
}

.regulint-checkbox-label a {
    color: #3b82f6;
    text-decoration: underline;
}

/* Form Error */
.regulint-form-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 10px 14px;
    border-radius: 8px;
    margin: 14px 0;
    font-size: var(--modal-font-2xs);
    line-height: 1.5;
}

/* Submit Button */
.regulint-submit-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: var(--modal-font-base);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.regulint-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(30, 41, 59, 0.3);
}

.regulint-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.regulint-submit-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.regulint-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: regulint-spin 0.8s linear infinite;
}

/* Email Confirmation Step */
.regulint-email-confirm {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 16px;
    padding: 32px 24px;
    margin-bottom: 24px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.regulint-email-confirm__icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.regulint-email-confirm__icon svg {
    width: 28px;
    height: 28px;
    color: white;
}

.regulint-email-confirm__text {
    font-size: var(--modal-font-base);
    color: #64748b;
    margin: 0 0 20px;
    line-height: 1.6;
}

.regulint-email-confirm__email {
    font-size: var(--modal-font-lg);
    font-weight: 600;
    color: #1e293b;
    background: white;
    border: 2px solid #3b82f6;
    border-radius: 10px;
    padding: 12px 20px;
    margin-bottom: 16px;
    word-break: break-all;
}

.regulint-email-confirm__warning {
    font-size: var(--modal-font-xs);
    color: #475569;
    margin: 0;
    padding: 12px 16px;
    background: rgba(148, 163, 184, 0.1);
    border-radius: 8px;
    line-height: 1.5;
}

/* Payment Method Selection */
.regulint-payment-method-selection {
    margin-top: 24px;
    margin-bottom: 16px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.regulint-payment-method-title {
    font-size: var(--modal-font-sm);
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 16px;
}

.regulint-payment-methods {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.regulint-payment-method {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.regulint-payment-method:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.regulint-payment-method--selected {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.04);
}

.regulint-payment-method--selected:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.06);
}

.regulint-payment-method input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.regulint-payment-method__radio {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-top: 2px;
}

.regulint-payment-method--selected .regulint-payment-method__radio {
    border-color: #3b82f6;
    background: #3b82f6;
}

.regulint-payment-method--selected .regulint-payment-method__radio::after {
    content: '';
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
}

.regulint-payment-method__content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.regulint-payment-method__name {
    font-size: var(--modal-font-base);
    font-weight: 600;
    color: #1e293b;
}

.regulint-payment-method__desc {
    font-size: var(--modal-font-xs);
    color: #64748b;
    line-height: 1.4;
}

/* Back Button */
.regulint-back-btn {
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: var(--modal-font-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 12px;
}

.regulint-back-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 640px) {
    .regulint-modal-content {
        padding: 24px 20px;
        border-radius: 12px;
        max-height: 85vh;
        width: 90%;
    }

    .regulint-form-row {
        flex-direction: column;
        gap: 0;
    }

    .regulint-form-group-small,
    .regulint-form-group-large {
        flex: 1;
    }

    .regulint-partner-banner {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .regulint-quantity-slider {
        padding: 16px;
    }
}

/* ==========================================================================
   VIES Auto-Fill Styles
   ========================================================================== */

/* Loading state on VAT ID field */
.regulint-vies-loading {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' stroke='%233b82f6' stroke-width='2' fill='none' stroke-dasharray='31.416' stroke-dashoffset='10'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='1s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px !important;
}

/* Valid VAT ID - green checkmark */
.regulint-vies-valid {
    border-color: #22c55e !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px !important;
}

/* Invalid VAT ID - red X */
.regulint-vies-invalid {
    border-color: #dc2626 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px !important;
}

/* Pending VAT ID validation - orange spinner */
.regulint-vies-pending {
    border-color: #f97316 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' stroke='%23f97316' stroke-width='2' fill='none' stroke-dasharray='31.416' stroke-dashoffset='10'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='1s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px !important;
}

/* Auto-filled field highlight */
.regulint-autofilled {
    background-color: #f0fdf4 !important;
    border-color: #86efac !important;
    animation: regulint-autofill-flash 0.5s ease;
}

@keyframes regulint-autofill-flash {
    0% {
        background-color: #bbf7d0;
    }
    100% {
        background-color: #f0fdf4;
    }
}

/* VIES hint (when company name differs) */
.regulint-vies-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
    padding: 8px 12px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #92400e;
}

.regulint-vies-hint-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.regulint-vies-hint-apply {
    flex-shrink: 0;
    padding: 4px 10px;
    background: #f59e0b;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.regulint-vies-hint-apply:hover {
    background: #d97706;
}