/**
 * FluentForm Custom Validation - Styles CSS
 *
 * Styles pour les messages d'erreur et les �tats de validation
 */

/* ========================================
   Form Fields - Default Styling
   ======================================== */

/**
 * Default border and background for all form controls
 * Light gray border with white background for clean appearance
 */
.ff-el-form-control {
    border: 1px solid #CCCCCC !important;
    background-color: #FFFFFF;
}

/* ========================================
   Messages d'erreur
   ======================================== */

/* Message d'erreur en rouge avec style FluentForm */
.fluentform .error.text-danger,
.fluentform .error {
    color: #dc3545 !important;
    font-size: 14px;
    margin-top: 5px;
    display: block;
    font-weight: 500;
    line-height: 1.4;
}

/* Animation d'apparition des erreurs */
.error.text-danger {
    animation: ffcvSlideDown 0.3s ease-in-out;
}

@keyframes ffcvSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Messages de succès
   ======================================== */

/* Message de succès en vert avec style FluentForm */
.fluentform .ff-el-success-message {
    color: #28a745 !important;
    font-size: 14px;
    margin-top: 5px;
    display: block;
    font-weight: 500;
    line-height: 1.4;
    width: 100%;
    animation: ffcvSlideDown 0.3s ease-in-out;
}

/* ========================================
   Champs valides
   ======================================== */

/* Bordure verte pour les champs validés */
.ff-el-is-valid.ff-el-form-control,
input.ff-el-is-valid {
    border: 2px solid #28a745 !important;
}

/* ========================================
   Champs en erreur
   ======================================== */

/* Bordure rouge pour les champs en erreur */
.ff-el-is-error .ff-el-form-control,
.ff-el-is-error input,
.ff-el-is-error textarea,
.ff-el-is-error select {
    border: 2px solid #dc3545 !important;
    background-color: #fff5f5 !important;
}

/* Focus sur champ en erreur */
.ff-el-is-error .ff-el-form-control:focus,
.ff-el-is-error input:focus,
.ff-el-is-error textarea:focus,
.ff-el-is-error select:focus {
    border-color: #dc3545 !important;
}

/* Checkboxes et radio labels en rouge lors d'erreur (mais pas les labels normaux) */
.ff-el-is-error .ff-el-form-check-label,
.ff-el-is-error .ff-el-form-check-label a {
    color: #dc3545 !important;
}

/* Les labels normaux (titres des champs) restent dans leur couleur par d�faut */

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

@media (max-width: 768px) {
    .fluentform .error.text-danger,
    .fluentform .error {
        font-size: 12px;
    }

    .fluentform .ff-el-success-message {
        font-size: 12px;
    }
}

/* ========================================
   Accessibilit�
   ======================================== */

/* Focus visible pour accessibilité clavier */
.ff-el-form-control:focus,
.fluentform input:focus,
.fluentform textarea:focus,
.fluentform select:focus {
    outline: none;
}

/* Focus state - green border */
.ff-el-is-focused .ff-el-form-control,
.ff-el-is-focused input,
.ff-el-is-focused textarea,
.ff-el-is-focused select {
    border-color: #35b18c !important;
    transition: border-color 0.2s ease;
}

/* Message d'erreur accessible aux lecteurs d'�cran */
.error[role="alert"] {
    /* D�j� visible, pas besoin de styles suppl�mentaires */
}

/* ========================================
   Button List Styles (Radio/Checkbox as Buttons)
   ======================================== */

/**
 * Base button list item styling
 * Applies to radio/checkbox inputs styled as buttons
 */
.fluentform .ff_list_buttons .ff-el-form-check {
    background: #FFFFFF;
    border: none;
    border-radius: 30px;
    color: #7B8380;
    cursor: pointer;
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    margin: 0;
    outline: none;
    padding: 3px 12px;
    position: relative;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

/**
 * Button list label span styling
 * The actual clickable button appearance
 */
.fluentform .ff-el-group.ff_list_buttons .ff-el-form-check label > span {
    background: #FFFFFF;
    border: 1px solid #FFFFFF;
    border-radius: 0;
    color: #606266;
    cursor: pointer;
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    margin: 0;
    outline: none;
    padding: 12px 20px;
    position: relative;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

/**
 * First button in list - rounded left corners
 */
.fluentform .ff-el-group.ff_list_buttons .ff-el-form-check:first-child label > span {
    border-left: 1px solid #FFFFFF;
    border-radius: 4px 0 0 4px;
}

/**
 * Selected state for first button
 * Brand color (#35b18c) applied to left border
 */
.fluentform .ff-el-group.ff_list_buttons .ff-el-form-check.ff_item_selected:first-child label > span {
    border-left-color: #35b18c;
}

/**
 * Selected button state
 * Highlights the selected option with brand color
 */
.fluentform .ff-el-group.ff_list_buttons .ff-el-form-check.ff_item_selected label > span {
    background-color: #35b18c;
    border-color: #35b18c;
    box-shadow: none;
    color: #fff;
}

/**
 * Selected button container styling
 */
.fluentform .ff_list_buttons .ff_item_selected {
    background: #35b18c;
    border: none;
    border-color: #35b18c;
    border-radius: 30px;
    color: #000000;
    cursor: pointer;
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    margin: 0;
    outline: none;
    padding: 3px 12px;
    position: relative;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

/**
 * Hover effect on unselected buttons
 * Changes text color to brand color on hover
 */
.fluentform .ff-el-group.ff_list_buttons .ff-el-form-check label > span:hover {
    color: #35b18c;
}

/**
 * Hover effect on selected buttons
 * Maintains white text color when hovering over selected option
 */
.fluentform .ff-el-group.ff_list_buttons .ff-el-form-check.ff_item_selected label > span:hover {
    color: #FFFFFF;
}

/* ========================================
   Multi-step Form Styles
   ======================================== */

/**
 * Multi-step header spacing
 * Adds bottom margin to separate from form content
 */
.fluentform .ff-step-header {
    margin-bottom: 10px;
}

/**
 * Step counter and title styling
 * Uses brand color (#35b18c) for active/completed steps
 */
.fluentform_wrapper.ffs_custom_wrap .ff-step-titles li:before,
.fluentform_wrapper.ffs_custom_wrap .ff-step-titles li {
    color: #35b18c;
    border: none;
    border-color: #35b18c;
    border-radius: 50%;
}

/**
 * Step number circle display
 * Shows step number in a circular counter
 */
.fluentform .ff-step-titles li:before {
    content: counter(step);
    counter-increment: step;
    display: block;
    font-size: 20px;
    line-height: 50px;
    margin: 0 auto 5px;
    position: relative;
    vertical-align: top;
    width: 50px;
    z-index: 10;
    border-radius: 50%;
}

/**
 * Progress line between steps
 * Connects step circles with a horizontal line
 */
.fluentform .ff-step-titles li:after {
    content: "";
    height: 3px;
    position: absolute;
    top: 25px;
    width: 100%;
    z-index: 1;
}

/**
 * Step titles container layout
 * Creates a horizontal progress indicator
 */
.fluentform .ff-step-titles {
    counter-reset: step;
    display: table;
    margin: 0 0 40px;
    overflow: hidden;
    padding: 0;
    position: relative;
    table-layout: fixed;
    text-align: center;
    width: 100%;
}

/* ========================================
   Saved State Input Styles
   ======================================== */

/**
 * Saved state button styling
 * Button that appears with saved/autofilled inputs
 */
.fluentform .ff-saved-state-input .ff_input-group-text {
    background-color: #35b18c;
    border-color: #35b18c;
    margin-left: -1px;
}

/**
 * Saved state button hover effect
 * Darker shade on hover for better UX
 */
.fluentform .ff-saved-state-input .ff_input-group-text:hover {
    background-color: #299474;
    border-color: #299474;
    opacity: 1;
}

/* ========================================
   Form Customizations
   ======================================== */

/**
 * Submit button wrapper spacing fix
 * Removes bottom margin in table cell layout
 */
.frm-fluent-form .ff-t-cell .ff_submit_btn_wrapper_custom button {
    margin-bottom: 0px;
}

/**
 * Tooltip icon color
 * Matches Elementor global color variable
 */
.fluentform .ff-el-tooltip svg {
    fill: var(--e-global-color-cb9743b);
}

/* ========================================
   Address Autocomplete Suggestions
   ======================================== */

/**
 * Suggestions dropdown container
 * Displays address suggestions from French government API
 */
.ffcv-address-suggestions {
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid #ddd;
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
}

.ffcv-address-suggestions:empty {
    display: none;
}

/**
 * Suggestions list styling
 * Removes default list styling for cleaner appearance
 */
.ffcv-address-suggestions ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    background-color: #fff;
}

/**
 * Individual suggestion item
 * Each address option in the dropdown
 */
.ffcv-address-suggestions .ffcv-suggestion-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
    color: #333;
}

/**
 * Hover effect on suggestions
 * Highlights the suggestion on mouse hover
 */
.ffcv-address-suggestions .ffcv-suggestion-item:hover {
    background-color: #f1f1f1;
}

/**
 * Last suggestion item
 * Removes bottom border from last item
 */
.ffcv-address-suggestions .ffcv-suggestion-item:last-child {
    border-bottom: none;
}

/**
 * Active/selected suggestion
 * Shows which suggestion is currently selected (keyboard navigation)
 */
.ffcv-address-suggestions .ffcv-suggestion-item.active {
    background-color: #e2e2e2;
}

/**
 * Message display in suggestions
 * For "no results" or "error" messages
 */
.ffcv-address-suggestions .ffcv-suggestion-message {
    padding: 8px;
    font-size: 14px;
    color: #666;
}

/* ========================================
   PDL Lookup - Search Button
   ======================================== */

/**
 * Inline layout for PDL field container
 * Uses :has() to apply flexbox only when the search button is present
 */
.fluentform .ff-el-input--content:has(.searchPdl) {
    display: flex;
    align-items: stretch;
    gap: 8px;
    flex-wrap: wrap;
}

/**
 * Error message drops below input+button row
 */
.fluentform .ff-el-input--content:has(.searchPdl) .error {
    width: 100%;
}

/**
 * PDL input takes remaining space
 */
.fluentform .ff-el-input--content:has(.searchPdl) .ff-el-form-control {
    flex: 1;
    min-width: 0;
}

/**
 * Search button styling
 * Brand-colored button matching project design
 * Uses .fluentform prefix for specificity over Elementor theme's [type="button"] rule
 */
.fluentform .searchPdl {
    background-color: #35B08B;
    color: #FFFFFF;
    border: none;
    border-radius: 4px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease;
}

.fluentform .searchPdl:hover {
    background-color: #299474;
}

.fluentform .searchPdl:active {
    background-color: #237f63;
}

/**
 * Disabled/loading state
 */
.fluentform .searchPdl:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/**
 * Responsive - stack vertically on small screens
 */
@media (max-width: 480px) {
    .fluentform .ff-el-input--content:has(.searchPdl) {
        flex-direction: column;
    }

    .fluentform .searchPdl {
        width: 100%;
    }
}

/* ========================================
   PDL 404 Notice — No CAE Error Block
   ======================================== */

/**
 * Hidden by default — JS adds .ffcv-visible on 404
 */
.fluentform .noCaeErrorBlock {
    display: none;
}

/**
 * Alert box styling when visible
 * Informational appearance using neutral gray
 */
.fluentform .ff-el-group.noCaeErrorBlock.ffcv-visible {
    display: block;
    margin-top: 10px;
    color: #333;
    font-size: 16px !important;
    text-align: left;
    line-height: 1 !important;
    animation: ffcvSlideDown 0.5s ease-in-out;
}

.fluentform .noCaeErrorBlock p {
    margin: 0 0 8px 0;
}

.fluentform .noCaeErrorBlock p:last-child {
    margin-bottom: 0;
}

/**
 * Redirect link styled as inline action
 */
.fluentform .noCaeErrorBlock .ffcv-redirect-link {
    display: inline-block;
    margin-top: 8px;
    color: #35B08B;
    font-weight: 600;
    text-decoration: underline;
}

.fluentform .noCaeErrorBlock .ffcv-redirect-link:hover {
    color: #299474;
}
