/**
 * Kneshecke Multi-Step Form Styles
 * Material Design 3 Implementation (Visual Refinement)
 */

:root {
    /* --- MD3 Color Tokens (Teal/Mint Theme) --- */
    --md-sys-color-primary: #006a6a;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #6ff7f6;
    --md-sys-color-on-primary-container: #002020;
    --md-sys-color-secondary: #4a6363;
    --md-sys-color-on-secondary: #ffffff;
    --md-sys-color-secondary-container: #cce8e7;
    --md-sys-color-on-secondary-container: #051f1f;
    --md-sys-color-tertiary: #4b607c;
    --md-sys-color-on-tertiary: #ffffff;
    --md-sys-color-tertiary-container: #d3e4ff;
    --md-sys-color-on-tertiary-container: #041c35;
    --md-sys-color-error: #ba1a1a;
    --md-sys-color-on-error: #ffffff;
    --md-sys-color-background: #fafdfc;
    --md-sys-color-on-background: #191c1c;
    --md-sys-color-surface: #fafdfc;
    --md-sys-color-on-surface: #191c1c;
    --md-sys-color-surface-variant: #dacac4;
    /* Warm grey/beige */
    --md-sys-color-on-surface-variant: #49454f;
    --md-sys-color-outline: #6f7979;

    /* --- Elevation & Shape --- */
    --md-sys-elevation-1: 0px 1px 2px rgba(0, 0, 0, 0.3), 0px 1px 3px 1px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-2: 0px 1px 2px rgba(0, 0, 0, 0.3), 0px 2px 6px 2px rgba(0, 0, 0, 0.15);
    --md-sys-shape-corner-extra-large: 28px;
    --md-sys-shape-corner-full: 9999px;
    --md-sys-shape-corner-medium: 12px;

    /* --- Typography --- */
    --md-sys-typescale-body-large: 400 16px/24px 'Roboto', sans-serif;
    --md-sys-typescale-body-medium: 400 14px/20px 'Roboto', sans-serif;
    --md-sys-typescale-label-large: 500 14px/20px 'Roboto', sans-serif;
    --md-sys-typescale-headline-small: 400 24px/32px 'Roboto', sans-serif;

    /* --- Motion --- */
    --md-sys-motion-duration-medium: 300ms;
    --md-sys-motion-easing-standard: cubic-bezier(0.2, 0.0, 0, 1.0);
}

/* --- Light Mode Theme Override --- */
.kneshecke-theme-light {
    --md-sys-color-primary: #006a6a;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #6ff7f6;
    --md-sys-color-on-primary-container: #002020;
    --md-sys-color-secondary: #4a6363;
    --md-sys-color-on-secondary: #ffffff;
    --md-sys-color-secondary-container: #cce8e7;
    --md-sys-color-on-secondary-container: #051f1f;
    --md-sys-color-surface: #ffffff;
    --md-sys-color-on-surface: #191c1c;
    --md-sys-color-surface-variant: #e0e3e3;
    --md-sys-color-on-surface-variant: #49454f;
    --md-sys-color-outline: #6f7979;
}

@media (prefers-color-scheme: dark) {
    :root {
        --md-sys-color-primary: #4cdada;
        --md-sys-color-on-primary: #003737;
        --md-sys-color-primary-container: #004f4f;
        --md-sys-color-on-primary-container: #6ff7f6;
        --md-sys-color-secondary: #b0cccb;
        --md-sys-color-on-secondary: #1b3434;
        --md-sys-color-secondary-container: #324b4b;
        --md-sys-color-on-secondary-container: #cce8e7;
        --md-sys-color-surface: #191c1c;
        --md-sys-color-on-surface: #e0e3e3;
        --md-sys-color-surface-variant: #3f4948;
        --md-sys-color-on-surface-variant: #bfc9c8;
        --md-sys-color-outline: #889392;
    }
}

/* --- Container (Card Layout) --- */
.kneshecke-multistep-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    font-family: var(--md-sys-typescale-body-large);
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);

    /* Card Style */
    width: 90vw !important;
    /* FORCE Viewport Width */
    max-width: 800px;
    min-height: 500px;
    margin: 0 auto;
    padding: 40px;
    border-radius: var(--md-sys-shape-corner-extra-large);
    box-shadow: var(--md-sys-elevation-2);
    box-sizing: border-box;
    overflow: hidden;
}

/* ... existing ... */

.kneshecke-prev {
    color: var(--md-sys-color-primary);
    border: 2px solid var(--md-sys-color-primary);
    /* Outlined strong */
}

.kneshecke-prev:disabled,
.kneshecke-prev[disabled] {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    pointer-events: none;
    background-color: transparent !important;
    border-color: var(--md-sys-color-outline) !important;
    color: var(--md-sys-color-outline) !important;
}

.kneshecke-prev:not(:disabled):hover {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-color: transparent;
}

/* --- Progress Bar (Segmented) --- */
.kneshecke-progress-bar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.kneshecke-progress-text {
    font: var(--md-sys-typescale-label-large);
    color: var(--md-sys-color-primary);
    font-weight: 700;
}

.kneshecke-progress-segments {
    display: flex;
    gap: 8px;
    width: 100%;
}

.kneshecke-segment {
    flex-grow: 1;
    height: 6px;
    background-color: var(--md-sys-color-surface-variant);
    border-radius: var(--md-sys-shape-corner-full);
    transition: background-color var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard);
}

.kneshecke-segment.active,
.kneshecke-segment.completed {
    background-color: var(--md-sys-color-primary);
}

/* --- Steps --- */
.kneshecke-step {
    transition: opacity var(--md-sys-motion-duration-medium) ease-in-out;
}

.kneshecke-step.hidden,
.kneshecke-step-skipped {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.kneshecke-step.active {
    display: block;
    opacity: 1;
    animation: fadeIn var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard);
}

/* Typography Update */
.kneshecke-card-content h3 {
    font: var(--md-sys-typescale-headline-small);
    font-weight: 700;
    /* Bolder */
    font-size: 28px;
    /* Larger */
    line-height: normal;
    color: var(--md-sys-color-on-surface);
    margin: 0 0 16px 0;
}

.step-title {
    font: var(--md-sys-typescale-headline-small);
    color: var(--md-sys-color-on-surface);
    margin-bottom: 24px;
    font-weight: 700;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* --- Navigation --- */
.kneshecke-form-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
    gap: 16px;
}

.kneshecke-btn {
    appearance: none;
    border: none;
    background: transparent;
    font: var(--md-sys-typescale-label-large);
    padding: 12px 32px;
    /* Larger padding */
    border-radius: var(--md-sys-shape-corner-full);
    /* Pills */
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.kneshecke-btn:focus-visible {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: 2px;
}

.kneshecke-next {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    box-shadow: var(--md-sys-elevation-1);
}

.kneshecke-next:hover {
    box-shadow: var(--md-sys-elevation-2);
    /* Slight lighten/darken interaction state */
    background-color: #005a52;
    /* Hardcoded darken for now */
}

.kneshecke-prev {
    color: var(--md-sys-color-primary);
    border: 2px solid var(--md-sys-color-primary);
    /* Outlined strong */
}

.kneshecke-prev:hover {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-color: transparent;
}

.kneshecke-hidden {
    display: none !important;
}

/* --- CF7 Overrides / Material Inputs --- */
.wpcf7-form-control-wrap {
    display: block;
    margin-bottom: 24px;
    position: relative;
}

/* Labels */
label {
    font: var(--md-sys-typescale-label-large);
    color: var(--md-sys-color-on-surface);
    margin-bottom: 8px;
    display: block;
    font-weight: 600;
}

/* Inputs */
.wpcf7-text,
.wpcf7-email,
.wpcf7-tel,
.wpcf7-date,
.wpcf7-number,
.wpcf7-textarea,
.wpcf7-select {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-medium);
    background-color: var(--md-sys-color-surface);
    font: var(--md-sys-typescale-body-large);
    color: var(--md-sys-color-on-surface);
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.wpcf7-text:focus,
.wpcf7-email:focus,
.wpcf7-tel:focus,
.wpcf7-textarea:focus {
    border-color: var(--md-sys-color-primary);
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: -1px;
}

/* Validation Errors */
.wpcf7-not-valid-tip,
.frontend-valid-tip {
    font: var(--md-sys-typescale-body-medium);
    color: var(--md-sys-color-error);
    margin-top: 4px;
    position: absolute;
    top: 100%;
    left: 0;
}

.wpcf7-not-valid,
.invalid-field {
    border-color: var(--md-sys-color-error) !important;
}

/* --- Breathing Space for Last Step --- */
.kneshecke-step-final {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Accessibility Utilities */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border-width: 0;
}

/* --- CF7 Internal Utilities --- */
.kneshecke-multistep-container>.hidden-fields-container,
.kneshecke-multistep-container>.screen-reader-response {
    display: none !important;
}