/**
 * ORION ENHANCED FEATURES - Styles
 * Features: Form Validation Errors, Inline Messages, Password Toggle
 * Version: 3.0 — Professional Grade
 */

/* ==========================================
   FEATURE 1: FORM VALIDATION ERRORS
   ========================================== */

/* --- Invalid Field Border --- */
.field-error {
    border: 2px solid #e53e3e !important;
    background: rgba(229, 62, 62, 0.08) !important;
    animation: fieldShake 0.4s ease-in-out !important;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.15) !important;
}

.field-error::placeholder {
    color: #fc8181 !important;
    font-weight: 700 !important;
}

.field-error:focus {
    outline: none !important;
    border-color: #e53e3e !important;
    box-shadow: 0 0 0 4px rgba(229, 62, 62, 0.2) !important;
}

/* --- Valid Field Border --- */
.field-valid {
    border: 2px solid #48bb78 !important;
    box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.12) !important;
}

.field-valid:focus {
    outline: none !important;
    border-color: #48bb78 !important;
    box-shadow: 0 0 0 4px rgba(72, 187, 120, 0.2) !important;
}

/* --- Inline Error Message Below Field --- */
.field-error-msg {
    color: #fc8181;
    font-size: 12px;
    font-weight: 700;
    margin-top: -8px;
    margin-bottom: 10px;
    padding: 6px 12px;
    background: rgba(229, 62, 62, 0.08);
    border-left: 3px solid #e53e3e;
    border-radius: 0 8px 8px 0;
    animation: errorSlideIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.3px;
}

.error-icon-inline {
    font-size: 14px;
    flex-shrink: 0;
    color: #e53e3e;
}

/* --- Legacy error icon support --- */
.error-icon {
    position: absolute !important;
    right: 15px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #e53e3e !important;
    font-size: 20px !important;
    pointer-events: none !important;
    z-index: 5 !important;
    animation: errorIconPulse 0.5s ease-in-out !important;
}

/* --- Animations --- */
@keyframes fieldShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-6px); }
    20%, 40%, 60%, 80% { transform: translateX(6px); }
}

@keyframes errorSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-6px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes errorIconPulse {
    0% {
        transform: translateY(-50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translateY(-50%) scale(1.3);
    }
    100% {
        transform: translateY(-50%) scale(1);
        opacity: 1;
    }
}

@keyframes validPulse {
    0% { box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.12); }
    50% { box-shadow: 0 0 0 6px rgba(72, 187, 120, 0.08); }
    100% { box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.12); }
}

/* ==========================================
   FEATURE 2: PASSWORD TOGGLE
   ========================================== */

.password-wrapper {
    position: relative !important;
    display: block !important;
}

.password-wrapper input {
    padding-right: 50px !important;
}

.password-toggle {
    position: absolute !important;
    right: 15px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    cursor: pointer !important;
    font-size: 20px !important;
    color: #a0aec0 !important;
    transition: all 0.3s ease !important;
    user-select: none !important;
    z-index: 10 !important;
    width: 30px !important;
    height: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 5px !important;
    background: rgba(0, 0, 0, 0.2) !important;
}

.password-toggle:hover {
    color: #63b3ed !important;
    background: rgba(99, 179, 237, 0.2) !important;
    transform: translateY(-50%) scale(1.1) !important;
}

.password-toggle:active {
    transform: translateY(-50%) scale(0.95) !important;
}

.password-toggle.visible {
    color: #68d391 !important;
    background: rgba(104, 211, 145, 0.2) !important;
}

/* ==========================================
   FORM ENHANCEMENT — Mandatory Star
   ========================================== */
.mandatory-star {
    color: #e53e3e;
    margin-left: 3px;
    font-weight: 900;
}

/* ==========================================
   RESPONSIVE ADJUSTMENTS
   ========================================== */

@media (max-width: 768px) {
    .error-icon {
        font-size: 16px !important;
        right: 10px !important;
    }

    .password-toggle {
        font-size: 18px !important;
        width: 28px !important;
        height: 28px !important;
    }

    .field-error-msg {
        font-size: 11px;
        padding: 5px 10px;
    }
}

/* ==========================================
   ACCESSIBILITY ENHANCEMENTS
   ========================================== */

.password-toggle:focus {
    outline: 2px solid #63b3ed !important;
    outline-offset: 2px !important;
}

.field-error:focus {
    animation: none !important;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .field-error,
    .error-icon,
    .password-toggle,
    .field-error-msg {
        animation: none !important;
    }
}