/* ========================================
   n8n Popup Styles
   ======================================== */

/* ========================================
   Widget Frontend Styles (immer aktiv)
   ======================================== */
.n8n-form-wrapper {
    min-height: 400px;
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    position: relative;
}

.n8n-form-wrapper .e-form__indicators {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    margin-bottom: 20px;
}

.n8n-form-wrapper .e-form__indicators__indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.n8n-form-wrapper .e-form__indicators__indicator__separator {
    width: 30px;
    height: 2px;
    min-width: 20px;
    background: #ddd;
}

.n8n-form-wrapper .form-group {
    margin-bottom: 15px;
}

.n8n-form-wrapper input[type="text"],
.n8n-form-wrapper input[type="email"],
.n8n-form-wrapper input[type="tel"],
.n8n-form-wrapper textarea,
.n8n-form-wrapper select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    box-sizing: border-box;
}

.n8n-form-wrapper label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.n8n-form-wrapper .form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.n8n-form-wrapper button {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.n8n-form-wrapper #next-step-btn {
    background: var(--n8n-primary, #0e3877);
    color: white;
}

.n8n-form-wrapper #next-step-btn:hover {
    background: var(--n8n-primary-hover, #0a2d5c);
}

.n8n-form-wrapper #prev-step-btn {
    background: #6c757d;
    color: white;
}

.n8n-form-wrapper #prev-step-btn:hover {
    background: #5a6268;
}

/* Loading State */
.n8n-form-wrapper .n8n-loading {
    text-align: center;
    color: #666;
    padding: 40px 20px;
}

/* ========================================
   Widget im Elementor Editor (zusätzliche Styles)
   ======================================== */
.elementor-editor-active .n8n-form-wrapper {
    min-height: 300px;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    position: relative;
}

.elementor-editor-active .n8n-form-wrapper .e-form__indicators {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 5px !important;
    margin-bottom: 20px;
}

.elementor-editor-active .n8n-form-wrapper .e-form__indicators__indicator {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

.elementor-editor-active .n8n-form-wrapper .e-form__indicators__indicator__separator {
    width: 30px !important;
    height: 2px !important;
    min-width: 20px !important;
}

.elementor-editor-active .n8n-form-wrapper .form-group {
    margin-bottom: 15px;
}

.elementor-editor-active .n8n-form-wrapper input[type="text"],
.elementor-editor-active .n8n-form-wrapper input[type="email"],
.elementor-editor-active .n8n-form-wrapper input[type="tel"],
.elementor-editor-active .n8n-form-wrapper textarea,
.elementor-editor-active .n8n-form-wrapper select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

.elementor-editor-active .n8n-form-wrapper label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.elementor-editor-active .n8n-form-wrapper .form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.elementor-editor-active .n8n-form-wrapper button {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.elementor-editor-active .n8n-form-wrapper #next-step-btn {
    background: #0e3877;
    color: white;
}

.elementor-editor-active .n8n-form-wrapper #prev-step-btn {
    background: #6c757d;
    color: white;
}

/* CTA Button */
.n8n-cta-button {
    display: inline-block;
    padding: 12px 24px;
    background: var(--n8n-primary, #0e3877);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.n8n-cta-button:hover {
    background: var(--n8n-primary-hover, #0a2d5c);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 56, 119, 0.3);
}

.n8n-cta-button:active {
    transform: translateY(0);
}

/* Popup Overlay */
.n8n-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99999;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Popup Container */
.n8n-popup-container {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    position: relative;
    margin: 20px auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* Close Button */
.n8n-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s;
}

.n8n-popup-close:hover {
    background: #f0f0f0;
    color: #333;
}

/* Form Container im Popup */
.n8n-popup-container .n8n-form-wrapper {
    padding: 20px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .n8n-popup-overlay {
        padding: 10px;
    }

    .n8n-popup-container {
        margin: 10px auto;
        max-height: calc(100vh - 20px);
    }

    .n8n-popup-container .n8n-form-wrapper {
        padding: 15px;
    }
}

/* Animation */
.n8n-popup-overlay {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.n8n-popup-container {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ========================================
   Slider Styles
   ======================================== */
.slider-wrapper {
    padding: 10px 0;
    position: relative;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.slider-header .slider-label {
    font-weight: 600;
    color: #333;
}

.slider-input {
    width: 50px;
    padding: 3px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 12px;
}

.slider-range {
    width: 100%;
    height: 6px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    position: relative;
}

.slider-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--n8n-primary, #0e3877);
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
    z-index: 2;
}

.slider-range::-webkit-slider-thumb:hover {
    background: var(--n8n-primary-hover, #0a2d5c);
}

.slider-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--n8n-primary, #0e3877);
    cursor: pointer;
    border: none;
    transition: background 0.2s;
    position: relative;
    z-index: 2;
}

.slider-range::-moz-range-thumb:hover {
    background: var(--n8n-primary-hover, #0a2d5c);
}

/* Sprechblase über dem Slider-Thumb */
.slider-value-bubble {
    position: absolute;
    background: var(--n8n-primary, #0e3877);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    top: -32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    pointer-events: none;
    white-space: nowrap;
}

.slider-value-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--n8n-primary, #0e3877) transparent transparent transparent;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

/* ========================================
   Button Group Styles
   ======================================== */
.button-group-wrapper {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.button-group-item {
    cursor: pointer;
    display: inline-block;
}

.button-group-item input[type="radio"] {
    display: none;
}

.button-group-button {
    display: inline-block;
    padding: 10px 16px;
    border: 2px solid var(--n8n-primary, #0e3877);
    border-radius: 4px;
    background: white;
    color: var(--n8n-primary, #0e3877);
    font-weight: 500;
    transition: all 0.2s;
    user-select: none;
}

.button-group-item:hover .button-group-button {
    background: var(--n8n-primary, #0e3877);
    color: white;
    border-color: var(--n8n-primary, #0e3877);
}

.button-group-item.checked .button-group-button {
    background: var(--n8n-primary, #0e3877);
    border-color: var(--n8n-primary, #0e3877);
    color: white;
}

/* ========================================
   Toggle Switch Styles
   ======================================== */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ddd;
    transition: 0.3s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--n8n-primary, #0e3877);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-labels {
    display: flex;
    gap: 10px;
    font-size: 14px;
    color: #666;
}

.toggle-label-on {
    color: var(--n8n-primary, #0e3877);
    font-weight: 600;
}

/* ========================================
   Conditional Fields
   ======================================== */
.form-group.conditional-hidden {
    display: none;
}

/* ========================================
   Checkbox Group Styles (2 Spalten)
   ======================================== */
.checkbox-group-wrapper {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 2px solid var(--n8n-primary, #0e3877);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.checkbox-item:hover {
    background: #f5f5f5;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    cursor: pointer;
    margin: 0;
    accent-color: var(--n8n-primary, #0e3877);
}

.checkbox-item input[type="checkbox"]:checked {
    accent-color: white;
}

.checkbox-item.checked {
    background: var(--n8n-primary, #0e3877) !important;
    border-color: var(--n8n-primary, #0e3877);
}

.checkbox-item.checked .checkbox-label {
    color: white !important;
}

.checkbox-label {
    font-size: 14px;
    color: #333;
    flex: 1;
    line-height: 1.2;
}

/* Mobile: 1 Spalte */
@media (max-width: 600px) {
    .checkbox-group-wrapper {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Textarea Styles
   ======================================== */
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    box-sizing: border-box;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--n8n-primary, #0e3877);
    box-shadow: 0 0 0 2px rgba(14, 56, 119, 0.1);
}
