/* Scoped to Plugin Container to avoid Theme Conflicts */
.kw-app-container {
    /* Brand Colors Updated */
    --kw-primary-blue: #005fa8;
    --kw-primary-blue-soft: #e0f0ff;
    --kw-primary-yellow: #fff200;
    --kw-primary-yellow-dim: #f5eb00;

    /* Modern UI Colors */
    --kw-text-dark: #1e293b;
    --kw-text-light: #64748b;
    --kw-bg-body: #f1f5f9;
    --kw-glass-bg: rgba(255, 255, 255, 0.75);
    --kw-glass-border: rgba(255, 255, 255, 0.5);
    --kw-glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

    --kw-radius-lg: 24px;
    --kw-radius-md: 16px;
    --kw-radius-sm: 12px;

    --kw-font-main: 'Outfit', sans-serif;

    /* Base Container Styles (Simulating Body) */
    font-family: var(--kw-font-main);
    background-color: var(--kw-bg-body);
    color: var(--kw-text-dark);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 100vw;
    /* FIX: Prevent horizontal scroll */
    /* Ensure it takes enough space */
    min-height: 85vh;
    padding: 20px 0;
    /* Some padding for mobile context in WP */
}

/* Reset for internal elements */
.kw-app-container * {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
}

/* AMBIENT BACKGROUND BLOBS */
.kw-app-container .ambient-bg {
    position: fixed;
    /* FIX: Fixed to viewport */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    /* Behind funnel wrapper but inside container */
    pointer-events: none;
    /* FIX: Don't block clicks */
}

.kw-app-container .blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.6;
    animation: kwMoveBlob 20s infinite alternate;
}

.kw-app-container .blob-1 {
    top: -10%;
    left: -10%;
    width: 50%;
    height: 50%;
    background: #c2e9fb;
    animation-duration: 25s;
}

.kw-app-container .blob-2 {
    bottom: -10%;
    right: -10%;
    width: 60%;
    height: 60%;
    background: #fff9c4;
    animation-duration: 30s;
}

.kw-app-container .blob-3 {
    top: 40%;
    left: 40%;
    width: 40%;
    height: 40%;
    background: #e0f2fe;
    animation-duration: 22s;
}

@keyframes kwMoveBlob {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(30px, 50px) scale(1.1);
    }
}

/* APP WRAPPER (Mobile First) */
.kw-app-container .kw-funnel-wrapper {
    width: 100%;
    height: 100%;
    /* Fix: Allow shrinking */
    max-width: 600px;
    box-sizing: border-box;
    /* FIX: Ensure padding doesn't add to width */
    /* App View */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    /* Above blobs */

    /* Glass Effect */
    background: var(--kw-glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    border-radius: var(--kw-radius-lg);
    /* Always radius for container look */

    /* Desktop adjustments */
    @media (min-width: 600px) {
        height: auto;
        /* Remove max-height and let content dictate height */
        min-height: 500px;
        transition: height 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        border: 1px solid var(--kw-glass-border);
        box-shadow: var(--kw-glass-shadow);

        /* FIX: Content area should just flow */
        overflow: visible;
    }
}

/* If on mobile, it should fill the effective height or look good */
@media (max-width: 600px) {
    .kw-app-container {
        padding: 0;
        min-height: 100vh;
        /* Full screen on mobile */
    }

    .kw-app-container .kw-funnel-wrapper {
        border-radius: 0;
        height: 100vh;
        /* Full height */
    }
}


/* HEADER */
.kw-app-container .funnel-header {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    flex-shrink: 0;
}

.kw-app-container .brand-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--kw-primary-blue);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.kw-app-container .progress-bar-wrapper {
    width: 100px;
    height: 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.kw-app-container .progress-bar {
    height: 100%;
    background: var(--kw-primary-blue);
    width: 0%;
    transition: width 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 10px;
}

/* CONTENT AREA */
.kw-app-container .funnel-content {
    flex: 1;
    position: relative;
    /* On desktop, we want overflow visible so it grows */
    overflow: hidden;
    /* Need to ensure height */
    min-height: 400px;
}

@media (min-width: 600px) {
    .kw-app-container .funnel-content {
        overflow: visible;
        height: auto;
    }
}

.kw-app-container #kwFunnelForm {
    width: 100%;
    height: 100%;
}

/* STEPS TRANSITIONS */
.kw-app-container .funnel-step {
    position: absolute;
    inset: 0;
    padding: 20px 24px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(40px) scale(0.98);
    transition: all 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);

    /* FIX: Don't scroll the step itself */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}



@media (min-width: 600px) {

    /* Desktop: Active step takes space (relative), others are absolute/hidden */
    .kw-app-container .funnel-step {
        position: absolute;
        /* Default state for idle steps */
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.4s ease;
        transform: none;
        /* Simplify desktop transition to crossfade */
    }

    .kw-app-container .funnel-step.active {
        position: relative;
        /* Takes physical space */
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: none;
        height: auto;
    }

    .kw-app-container .funnel-step.prev {
        /* Previous step stays absolute 0,0 to fade out underneath/over */
        position: absolute;
        top: 0;
        left: 0;
        opacity: 0;
        transform: none;
    }
}

/* Mobile Transitions (Keep Slide/Scale) */
@media (max-width: 599px) {
    .kw-app-container .funnel-step.active {
        opacity: 1;
        visibility: visible;
        transform: translateX(0) scale(1);
        z-index: 2;
    }

    .kw-app-container .funnel-step.prev {
        transform: translateX(-40px) scale(0.98);
        opacity: 0;
    }
}

/* Internal Layout for Steps */
.kw-app-container .step-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

/* TYPOGRAPHY */
.kw-app-container h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--kw-text-dark);
    margin-bottom: 12px;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.kw-app-container h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--kw-text-dark);
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

.kw-app-container .subtitle {
    font-size: 1.05rem;
    color: var(--kw-text-light);
    line-height: 1.5;
    margin-bottom: 32px;
}

.kw-app-container .step-badge {
    display: inline-block;
    padding: 6px 12px;
    background: var(--kw-primary-blue-soft);
    color: var(--kw-primary-blue);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* PATH SELECTION CARDS */
.kw-app-container .options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kw-app-container .option-card {
    position: relative;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    display: block;
    /* Ensure it behaves like a block label */
}

.kw-app-container .option-card input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.kw-app-container .card-inner {
    display: flex;
    align-items: center;
    background: #fff;
    padding: 16px;
    border-radius: var(--kw-radius-md);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.kw-app-container .icon-circle {
    width: 48px;
    height: 48px;
    background: var(--kw-primary-blue-soft);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 16px;
    color: var(--kw-primary-blue);
    font-size: 1.2rem;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.kw-app-container .text-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.kw-app-container .text-content .title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--kw-text-dark);
}

.kw-app-container .text-content .desc {
    font-size: 0.85rem;
    color: var(--kw-text-light);
}

.kw-app-container .arrow-icon {
    color: #ccc;
    font-size: 0.9rem;
    transition: transform 0.2s;
}

/* State: Checked / Hover */
.kw-app-container .option-card input:checked+.card-inner {
    border-color: var(--kw-primary-blue);
    background: #fdfdfd;
    box-shadow: 0 4px 15px rgba(0, 95, 168, 0.1);
}

.kw-app-container .option-card input:checked+.card-inner .icon-circle {
    background: var(--kw-primary-blue);
    color: #fff;
    transform: scale(1.05);
}

/* INPUTS */
.kw-app-container .scroll-container {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 90px;
    /* Space for action dock */
    /* Hide scrollbar */
    scrollbar-width: none;
}

@media (min-width: 600px) {
    .kw-app-container .scroll-container {
        overflow: visible;
        /* No scroll on desktop */
        height: auto;
        padding-bottom: 100px;
        /* Ensure space for dock at bottom */
    }
}

.kw-app-container .scroll-container::-webkit-scrollbar {
    display: none;
}

.kw-app-container .input-modern-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
}

@media (max-width: 480px) {
    .kw-app-container .input-modern-group {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
}

.kw-app-container .modern-input {
    position: relative;
    margin-bottom: 20px;
}

.kw-app-container .full-margin {
    margin-top: 20px;
}

.kw-app-container .modern-input input,
.kw-app-container .modern-input textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 12px 12px;
    box-sizing: border-box;
    border: 2px solid rgba(220, 220, 220, 1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    color: var(--kw-text-dark);
    outline: none;
    /* remove iOS styles */
}

.kw-app-container .modern-input textarea {
    padding-top: 24px;
    resize: none;
}

.kw-app-container .modern-input label {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #555;
    /* FIX: Darker for better visibility */
    pointer-events: none;
    transition: 0.3s ease all;
    background: transparent;
    padding: 0 4px;
}

/* Float Label Logic */
.kw-app-container .modern-input input:focus,
.kw-app-container .modern-input input:not(:placeholder-shown),
.kw-app-container .modern-input textarea:focus,
.kw-app-container .modern-input textarea:not(:placeholder-shown) {
    border-color: var(--kw-primary-blue);
    box-shadow: 0 0 0 3px var(--kw-primary-blue-soft);
}

.kw-app-container .modern-input input:focus+label,
.kw-app-container .modern-input input:not(:placeholder-shown)+label,
.kw-app-container .modern-input textarea:focus+label,
.kw-app-container .modern-input textarea:not(:placeholder-shown)+label {
    top: 8px;
    font-size: 0.75rem;
    color: var(--kw-primary-blue);
    font-weight: 600;
}

/* TOGGLE / CHOICE BLOCKS */
.kw-app-container .choice-block {
    background: #fff;
    border-radius: var(--kw-radius-md);
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.kw-app-container .choice-label {
    font-weight: 600;
    margin-bottom: 12px;
    display: block;
}

.kw-app-container .toggle-switch {
    display: inline-flex;
    background: #f1f5f9;
    border-radius: 30px;
    padding: 4px;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.kw-app-container .toggle-switch input {
    display: none;
}

.kw-app-container .toggle-switch label {
    padding: 10px 24px;
    z-index: 1;
    cursor: pointer;
    font-weight: 500;
    color: var(--kw-text-light);
    transition: color 0.3s;
    text-align: center;
    min-width: 80px;
    user-select: none;
}

.kw-app-container .toggle-switch .slider {
    position: absolute;
    top: 4px;
    left: 4px;
    height: calc(100% - 8px);
    width: 50%;
    border-radius: 25px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.kw-app-container .toggle-switch input:first-of-type:checked~.slider {
    transform: translateX(0);
    width: calc(50% - 4px);
}

.kw-app-container .toggle-switch input:first-of-type:checked+label {
    color: var(--kw-text-dark);
}

.kw-app-container .toggle-switch input:last-of-type:checked~.slider {
    transform: translateX(100%);
    width: calc(50% - 4px);
    margin-left: 2px;
}

.kw-app-container .toggle-switch input:last-of-type:checked+label {
    color: var(--kw-primary-blue);
}

/* ACTION DOCK */
.kw-app-container .action-dock {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 24px;
    background: linear-gradient(to top, #fff 80%, rgba(255, 255, 255, 0));
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.kw-app-container .action-dock.center {
    justify-content: center;
}

.kw-app-container button {
    border: none;
    font-family: var(--kw-font-main);
    cursor: pointer;
    transition: transform 0.2s;
}

.kw-app-container button:active {
    transform: scale(0.96);
}

.kw-app-container .btn-primary {
    background: var(--kw-primary-blue);
    color: #fff;
    padding: 16px 32px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 95, 168, 0.3);
    flex: 1;
    max-width: 200px;
    margin-left: auto;
}

.kw-app-container .btn-back {
    background: #f1f5f9;
    color: var(--kw-text-light);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-right: 16px;
}

.kw-app-container .btn-primary:hover {
    background: #004e8a;
}

/* SUCCESS */
.kw-app-container .success-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    padding-bottom: 20px;
}

.kw-app-container .success-ring {
    width: 100px;
    height: 100px;
    background: var(--kw-primary-blue-soft);
    color: var(--kw-primary-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin-bottom: 30px;
    animation: kwPopIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes kwPopIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.kw-app-container .btn-ghost {
    color: var(--kw-primary-blue);
    text-decoration: none;
    font-weight: 600;
    margin-top: 20px;
}

/* ANIMATIONS */
.kw-app-container .animate-up {
    animation: kwFadeInUp 0.6s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes kwFadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kw-app-container .delay-1 {
    animation-delay: 0.1s;
}

.kw-app-container .delay-2 {
    animation-delay: 0.2s;
}

.kw-app-container .hidden-field {
    animation: kwExpandField 0.3s ease;
    transform-origin: top;
}

@keyframes kwExpandField {
    from {
        opacity: 0;
        transform: scaleY(0.9);
        max-height: 0;
    }

    to {
        opacity: 1;
        transform: scaleY(1);
        max-height: 200px;
    }
}

/* CHIPS */
.kw-app-container .chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.kw-app-container .chip {
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.kw-app-container .chip input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.kw-app-container .chip-label {
    display: block;
    padding: 10px 18px;
    background: #fff;
    border: 1px solid #dcdfe4;
    border-radius: 50px;
    font-size: 0.9rem;
    color: var(--kw-text-light);
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.kw-app-container .chip input:checked+.chip-label {
    background: var(--kw-primary-blue);
    color: #fff;
    border-color: var(--kw-primary-blue);
    box-shadow: 0 4px 10px rgba(0, 95, 168, 0.2);
    transform: translateY(-1px);
}

/* FILE UPLOAD */
.kw-app-container .file-upload-group {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
}

.kw-app-container .file-upload-box {
    position: relative;
    border: 2px dashed #dcdfe4;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.2s;
    cursor: pointer;
}

.kw-app-container .file-upload-box:hover {
    border-color: var(--kw-primary-blue);
    background: rgba(255, 255, 255, 0.8);
}

.kw-app-container .file-upload-box input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.kw-app-container .file-content i {
    font-size: 1.5rem;
    color: var(--kw-text-light);
    margin-bottom: 8px;
    display: block;
}

.kw-app-container .file-content span {
    font-size: 0.9rem;
    color: var(--kw-text-dark);
    font-weight: 500;
}

.kw-app-container .file-content small {
    display: block;
    font-size: 0.75rem;
    color: #999;
    margin-top: 4px;
}

/* SIMPLE CHECKBOX */
.kw-app-container .checkbox-simple {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--kw-text-dark);
    line-height: 1.4;
    user-select: none;
}

.kw-app-container .checkbox-simple input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--kw-primary-blue);
    flex-shrink: 0;
    margin-top: 2px;
    cursor: pointer;
}

/* BIRTHDAY DROPDOWN GROUP */
.kw-app-container .birthday-select-group {
    margin-bottom: 20px;
}

.kw-app-container .birthday-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--kw-text-dark);
    font-size: 0.95rem;
}

.kw-app-container .birthday-selects {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px;
    width: 100%;
}

.kw-app-container .birthday-selects select {
    flex: 1 1 0;
    min-width: 0;
    padding: 12px;
    border: 2px solid rgba(220, 220, 220, 1);
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    color: var(--kw-text-dark);
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23555' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    box-sizing: border-box;
}

.kw-app-container .birthday-selects select:focus {
    border-color: var(--kw-primary-blue);
    box-shadow: 0 0 0 3px var(--kw-primary-blue-soft);
}

.kw-app-container .birthday-selects select:invalid,
.kw-app-container .birthday-selects select option[value=""] {
    color: #555;
}

/* Specific widths for better proportions */
.kw-app-container .birthday-selects select:nth-child(1) {
    flex: 0.7 1 0; /* Tag - smaller */
}

.kw-app-container .birthday-selects select:nth-child(2) {
    flex: 1.3 1 0; /* Monat - larger for month names */
}

.kw-app-container .birthday-selects select:nth-child(3) {
    flex: 0.9 1 0; /* Jahr */
}

@media (max-width: 400px) {
    .kw-app-container .birthday-selects {
        flex-direction: column !important;
    }

    .kw-app-container .birthday-selects select {
        flex: 1 1 auto;
        width: 100%;
    }
}