/* Password toggle styles - Simplified approach */
.loopword-password-wrapper {
    position: relative;
    display: block;
    width: 100%;
}

.loopword-password-wrapper input[type="password"],
.loopword-password-wrapper input[type="text"] {
    padding-right: 40px !important;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
}

.loopword-password-toggle {
    position: absolute;
    top: 0;
    right: 12px;
    bottom: 0;
    width: 20px;
    cursor: pointer;
    user-select: none;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    /* Key fix: Only consider input height, ignore validation message */
    height: 40px; /* Fixed height matching typical input height */
    max-height: 40px;
}

.loopword-password-toggle:hover {
    opacity: 1;
}

.loopword-password-toggle svg {
    width: 18px;
    height: 18px;
    fill: #666;
    transition: fill 0.3s ease;
}

.loopword-password-toggle:hover svg {
    fill: #333;
}

.eye-icon {
    display: none;
}

.eye-slash-icon {
    display: block;
}

.show-password .eye-icon {
    display: block;
}

.show-password .eye-slash-icon {
    display: none;
}

/* Consistent field heights - Reserve space for validation messages */
.elementor-field-group {
    margin-bottom: 10px !important;
}

/* Fix for Elementor message overlap with submit button */
.elementor-message {
    margin-top: 30px !important;
    margin-bottom: 20px !important;
    position: relative;
    z-index: 999;
    clear: both;
}

.elementor-message.elementor-message-danger,
.elementor-message.elementor-message-success {
    margin-top: 30px !important;
    margin-bottom: 20px !important;
}

/* Ensure submit button doesn't overlap messages */
.e-form__buttons {
    margin-top: 20px !important;
    position: relative;
    z-index: 1;
}

/* Additional spacing for form elements before submit */
.elementor-field-type-submit {
    margin-top: 20px !important;
}

.elementor-field-group .elementor-field-label {
    margin-bottom: 5px;
    display: block;
    height: auto;
}

.elementor-field-group .elementor-field,
.elementor-field-group .elementor-select-wrapper,
.elementor-field-group .loopword-password-wrapper {
    margin-bottom: 5px;
    height: auto;
}

/* Validation styles */
.field-validation-error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 5px rgba(231, 76, 60, 0.3) !important;
}

.field-validation-success {
    border-color: #27ae60 !important;
    box-shadow: 0 0 5px rgba(39, 174, 96, 0.3) !important;
}

.validation-message {
    font-size: 12px;
    padding: 5px 8px;
    border-radius: 3px;
    min-height: 18px; /* Consistent height */
    line-height: 1.3;
    margin-top: 5px;
    box-sizing: border-box;
    /* Always take up space, just hide content */
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.validation-message.error,
.validation-message.success {
    visibility: visible;
    opacity: 1;
}

.validation-message.error {
    background-color: #fdf2f2;
    color: #e74c3c;
    border: 1px solid #fadbd8;
}

.validation-message.error.mismatch {
    background-color: #fff5f5;
    color: #c53030;
    border: 1px solid #fed7d7;
    font-weight: 500;
}

.validation-message.success {
    background-color: #f2fdf5;
    color: #27ae60;
    border: 1px solid #d5eedd;
}

/* Password requirements popup - Position relative to wrapper, not input */
.password-requirements {
    position: absolute;
    top: 45px; /* Fixed position below input */
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    margin-top: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    font-size: 13px;
    display: none;
}

.password-requirements.show {
    display: block;
}

.password-requirements h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #333;
    font-weight: bold;
}

.password-requirements ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.password-requirements li {
    margin: 5px 0;
    padding: 3px 0;
    position: relative;
    padding-left: 20px;
}

.password-requirements li:before {
    content: "✗";
    position: absolute;
    left: 0;
    color: #e74c3c;
    font-weight: bold;
}

.password-requirements li.valid:before {
    content: "✓";
    color: #27ae60;
}

.password-requirements li.valid {
    color: #27ae60;
}

/* Form submit button disabled state */
.elementor-button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Ensure proper stacking for password fields */
.loopword-password-wrapper .validation-message {
    position: relative;
    z-index: 1;
}

/* CSS to hide error messages initially when they appear */
.elementor-message-danger.loopword-processing {
    display: none !important;
}
