/* Form Validation Styles */

/* Shake animation for errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

/* Pulse border animation */
@keyframes pulseBorder {
    0%, 100% { border-color: #ef4444; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    50% { border-color: #dc2626; box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

.animate-pulse-border {
    animation: pulseBorder 1s ease-in-out;
}

/* Slide in animation for notifications */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

/* Slide out animation */
@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.animate-slide-out {
    animation: slideOut 0.3s ease-in;
}

/* Error state for inputs */
input.border-red-500,
select.border-red-500,
textarea.border-red-500 {
    border-color: #ef4444 !important;
    border-width: 2px !important;
}

/* Success state for inputs */
input.border-green-500,
select.border-green-500,
textarea.border-green-500 {
    border-color: #10b981 !important;
    border-width: 2px !important;
}

/* Error message styling */
[id^="error-message-"]:not(.hidden) {
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

[id^="error-message-"]:before {
    content: "⚠️";
    font-size: 1rem;
}

/* Character counter warning */
.text-red-500 {
    font-weight: 600;
}

/* Field focus enhancement */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    ring: 2px;
    ring-color: #3b82f6;
}

/* Required field indicator */
.field-required:after {
    content: " *";
    color: #ef4444;
    font-weight: bold;
}

/* Validation notification */
.validation-notification {
    max-width: 28rem;
    backdrop-filter: blur(8px);
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Loading state for submit button */
button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

button[type="submit"].loading {
    position: relative;
    color: transparent;
}

button[type="submit"].loading:after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* Success checkmark for valid fields */
input.border-green-500:after,
select.border-green-500:after {
    content: "✓";
    position: absolute;
    right: 1rem;
    color: #10b981;
    font-weight: bold;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .validation-notification {
        left: 1rem;
        right: 1rem;
        max-width: calc(100% - 2rem);
    }
}

/* Tooltip for field requirements */
.field-tooltip {
    position: relative;
    display: inline-block;
}

.field-tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #1f2937;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
}

.field-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Enhanced select dropdown */
select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Progress indicator */
.form-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #e5e7eb;
    z-index: 100;
}

.form-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: width 0.3s ease;
}

/* Field group styling */
.field-group {
    position: relative;
    margin-bottom: 1.25rem;
}

.field-group.has-error {
    animation: shake 0.5s ease-in-out;
}
