/**
 * Discovery and Sign up Phase (DSP) Plugin - Frontend Styles
 * Version: 1.5.15
 */

/* == 1. Step Container Visibility & Submit Button Fix == */

/* Hide all step containers by default. */
.dsp-multistep-form-wrapper .dsp-step-container {
    display: none;
    padding: 20px 0;
}

.dsp-multistep-form-wrapper {
    background-color: #E8E7D9;
    padding: 2rem;
    border-radius: 25px;
}
@media screen and (min-width: 970px) {
    .dsp-multistep-form-wrapper {
        padding: 3rem
    }
}
/* Show the active step. */
.dsp-multistep-form-wrapper .dsp-step-container.active {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/*
 * CRITICAL FIX: Ensure the default CF7 Submit button is hidden by default 
 * (before JS runs or on non-final steps). 
 */
.dsp-multistep-form-wrapper .wpcf7-submit {
    display: none !important;
}

/* * CRITICAL FIX: Class added by JS on the final step to force visibility.
 */
.dsp-multistep-form-wrapper .wpcf7-submit.dsp-submit-visible {
    display: block !important; /* Force visibility */
    margin-left: 15px; 
    /* Basic styling to match Next button */
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 22px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 600;
    background-color: #02AFB6 !important;
    color: #ffffff !important;
}

.dsp-multistep-form-wrapper .wpcf7-submit.dsp-submit-visible:hover {
    background-color: #2563eb;
}

/* == 1b. Validation Styling (Red Border and Inline Error) == */

/* Force a red border on invalid fields (in case theme overrides it) */
.dsp-multistep-form-wrapper .wpcf7-not-valid,
.dsp-dragdrop-field-wrapper.wpcf7-not-valid .dsp-dropzone { /* Apply red border to dropzone too */
    border-color: #ff4545 !important; 
    box-shadow: 0 0 0 1px #ff4545;
}

/* Styling for the custom inline error message added by JS */
.dsp-inline-error,
.dsp-error-message { /* dsp-error-message is for general drag/drop errors */
    display: block; /* Ensure it takes up its own line */
    color: #ff4545; /* Bright red text */
    font-size: 13px;
    margin-top: 5px; /* Spacing below the input */
    font-weight: 500;
}


/* == 2. Progress Bar Styling (Simple Rectangle) == */

.dsp-progress-bar-wrapper {
    margin: 20px auto 10px auto;
    width: 100%; 
    position: relative;
}

/* Container for the background of the progress bar */
.dsp-progress-line-container {
    height: 50px;
    background-color: #009095;
    border-radius: 30px;
    border: 1px solid #009095;
    overflow: hidden;
    margin-bottom: 5px;
}

/* The dynamic fill line */
.dsp-progress-fill {
    height: 100%;
    background-color: #02AFB6;
    width: 0%;
    transition: width 0.4s ease-in-out;
}

.dsp-step-container label, .dsp-step-container p.checkbox-label, [data-class="wpcf7cf_group"] {
    font-size: 16px; 
    font-weight: 700;
}

@media screen and (min-width: 768px) {
.dsp-step-container label, .dsp-step-container p.checkbox-label, [data-class="wpcf7cf_group"] {
        font-size: 20px; 
    }
}

[data-class="wpcf7cf_group"] {
    margin-top: 20px;
}

.dsp-step-container .two-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media screen and (min-width: 768px) {
    .dsp-step-container .two-col {
        flex-direction: row;
    }
}

.dsp-step-container p.checkbox-label {
    margin-bottom: .5rem;
}

.dsp-step-container label input, input.wpcf7-form-control.wpcf7-text, textarea.wpcf7-form-control.wpcf7-textarea {
    font-size: 1.25rem; 
    padding: .5rem 1.5rem;
    margin-bottom: 0;
    border-width: 1px;
    background-color: white !important;
    opacity: 1;
    border-radius: 15px;
}

.wpcf7-form-control {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px 30px;
}

.wpcf7-form-control.declaration {
    flex-direction: column
}

.wpcf7-form-control-wrap .wpcf7-list-item  {
    display: flex;
    flex-direction: row;
    gap: 10px 30px;
}

@media screen and (min-width: 970px) {
    .wpcf7-form-control-wrap .wpcf7-list-item  {
        flex-basis: 48%;
    }
    .wpcf7-form-control-wrap.declaration .wpcf7-list-item  {
        flex-basis: 100%;
    }
}

.wpcf7-form-control-wrap .wpcf7-list-item  {
    display: flex;
    flex-direction: row;
    gap: 10px 30px;
    margin: 0;
}

.wpcf7-form-control-wrap .wpcf7-list-item label {
    display: flex;
    font-weight: 700;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.wpcf7-form-control-wrap .wpcf7-list-item label input {
    width: 30px;
    height: 30px;
    margin: 0;
    min-width: 30px;
}

.wpcf7-form-control-wrap.declaration .wpcf7-list-item label input {
    order: 0;
}

.wpcf7-form-control-wrap .wpcf7-list-item label .dec {
    order: 1;
}

/* Percentage display element */
.dsp-progress-percent {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
    margin-top: 5px;
}

/* == 3. Step Title (H3) Styling == */

.dsp-step-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #222;
    text-align: center;
    margin-top: 15px;
    margin-bottom: 0;
    padding-bottom: 10px;
}

@media screen and (min-width: 768px) {
    .dsp-step-title {
        font-size: 3rem;
    }
}

/* == 4. Navigation Buttons == */

.dsp-navigation-buttons {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    justify-content: space-between;
}

.dsp-prev-btn, .dsp-next-btn {
    padding: 15px 30px;
    border: none;
    font-size: 22px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 600;
    font-family: var(--wp--preset--font-family--avenir-next);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background-color: #02AFB6;
    color: #000;
    border-radius: 30px;
    width: 220px;
}

.dsp-prev-btn:hover, .dsp-next-btn:hover {
    background-color: #009095;
}

/* == 5. Outro Step Styling & Transition Hooks (Maintained for current PHP structure) == */

/* Outro wrapper is hidden by default */
.dsp-outro-wrapper {
    padding: 40px;
    text-align: center;
    display: none; 
}

.dsp-outro-wrapper h3 {
    font-size: 2.5rem;
    margin-top: 0;
    margin-bottom: 15px;
}
.dsp-outro-wrapper p {
    font-size: 1.1rem;
    color: #222;
}

/* ============================================== */
/* === FORM SUBMISSION / OUTRO TRANSITION CSS === */
/* ============================================== */

/* 1. HIDE THE MAIN FORM WRAPPER (This is correct) */
form.wpcf7-form.sent .dsp-multistep-form-wrapper {
    display: none !important;
    visibility: hidden !important;
}

/* 2. SHOW THE OUTRO SLIDE (FIXED SELECTOR) */
/* The outro wrapper is a direct child of the form, just like the multi-step wrapper. */
form.wpcf7-form.sent .dsp-outro-wrapper {
    display: block !important;
}


/* ============================================== */
/* === 6. DRAG AND DROP STYLES === */
/* ============================================== */

.dsp-dragdrop-field-wrapper {
    margin: 15px 0;
}

/* The Dropzone Area */
.dsp-dropzone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    background-color: #f9fafb;
    transition: background-color 0.2s, border-color 0.2s;
    position: relative;
    overflow: hidden;
}

.dsp-dropzone:hover,
.dsp-dropzone.is-dragover {
    background-color: #f3f4f6;
    border-color: #222222;
}

.dsp-dropzone-text {
    margin: 0;
    color: #6b7280;
    font-weight: 500;
}

/* The hidden file input should cover the dropzone for click events */
.dsp-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* File List Preview */
.dsp-file-list {
    margin-top: 10px;
    border-top: 1px solid #e5e7eb;
    padding-top: 10px;
}

.dsp-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    margin-bottom: 5px;
    border-radius: 4px;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
}

.dsp-file-name {
    font-weight: 600;
    color: #1f2937;
    flex-grow: 1;
    margin-right: 10px;
    word-break: break-word;
}

.dsp-file-status {
    font-size: 0.85rem;
    font-style: italic;
    margin-right: 10px;
}

/* Status Colors */
.dsp-file-item.dsp-file-loading .dsp-file-status {
    color: #f59e0b; /* Yellow/Orange */
}

.dsp-file-item.dsp-file-success {
    border-left: 4px solid #10b981; /* Green */
}
.dsp-file-item.dsp-file-success .dsp-file-status {
    color: #10b981;
}

.dsp-file-item.dsp-file-error {
    border-left: 4px solid #ef4444; /* Red */
    background-color: #fee2e2;
}
.dsp-file-item.dsp-file-error .dsp-file-status {
    color: #ef4444;
}

.dsp-remove-file {
    background: #e5e7eb;
    color: #4b5563;
    border: none;
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

.dsp-remove-file:hover {
    background: #d1d5db;
}

/* Container for the entire field */
.dsp-signature-field-wrapper {
    /* Required for flex layout */
    display: flex; 
    flex-direction: column;
    
    /* Set a visible boundary and size */
    width: 100%; 
    min-height: 200px; /* Minimum height for the drawing area + button */
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    overflow: hidden; 
}

/* --- Critical Change: Drawing Area Container --- */
.dsp-signature-drawing-area {
    /* Takes up all available vertical space */
    flex-grow: 1; 
    /* Required to anchor the absolutely positioned canvas */
    position: relative; 
}

/* --- Critical Change: Canvas Positioning --- */
.dsp-signature-canvas {
    /* Canvas covers the entire drawing area of its parent (dsp-signature-drawing-area) */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    /* Ensures drawing events are captured by the canvas itself */
    cursor: crosshair;
    touch-action: none; 
}

/* Clear button is now below the canvas area and accessible */
.dsp-clear-signature-btn {
    /* Ensures button is part of the flex column but doesn't take up excessive space */
    flex-shrink: 0; 
    
    /* Style the clear button */
    background: #f0f0f0;
    border: none;
    color: #333;
    padding: 8px 15px;
    cursor: pointer;
    text-align: center;
    border-top: 1px solid #ccc;
    width: 100%;
    box-sizing: border-box;
}

/* Validation styling */
.dsp-signature-field-wrapper.wpcf7-not-valid {
    border-color: #ff0000;
}