/**
 * Form Validation Styles
 * Enhanced Bootstrap validation states for dark theme
 */

/* Invalid field styles */
.is-invalid {
    border-color: #dc3545 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

/* Valid field styles */
.is-valid {
    border-color: #198754 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.is-valid:focus {
    border-color: #198754;
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
}

/* Feedback messages */
.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
    animation: fadeInError 0.2s ease-in;
}

.valid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #198754;
}

/* Input group validation */
.input-group > .form-control.is-invalid,
.input-group > .form-select.is-invalid {
    z-index: 3;
}

.input-group ~ .invalid-feedback {
    display: block;
}

/* Dark theme adjustments */
[data-bs-theme="dark"] .is-invalid {
    background-color: rgba(220, 53, 69, 0.1);
}

[data-bs-theme="dark"] .is-valid {
    background-color: rgba(25, 135, 84, 0.1);
}

/* Toast notification overrides for better visibility */
.toast {
    min-width: 300px;
    max-width: 500px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease-out;
    border: none !important;
}

.toast.bg-danger {
    background-color: #dc3545 !important;
}

.toast.bg-success {
    background-color: #198754 !important;
}

.toast.bg-warning {
    background-color: #fff3cd !important;
    color: #856404 !important;
}

.toast.bg-warning .btn-close {
    filter: none !important;
}

.toast.bg-warning .bi {
    color: #856404 !important;
}

.toast.bg-primary {
    background-color: #C69C3F !important;
}

/* Notification container */
#notification-container {
    max-height: 100vh;
    overflow-y: auto;
}

/* Animation for notifications */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeInError {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form field focus states */
.form-control:focus,
.form-select:focus {
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

/* Disabled state */
.form-control:disabled,
.form-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Required field indicator */
.form-label.required::after {
    content: " *";
    color: #dc3545;
}

/* Field hint text */
.form-text {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* Loading state for forms */
.form-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.form-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2rem;
    height: 2rem;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #C69C3F;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Mobile responsiveness */
@media (max-width: 576px) {
    .toast {
        max-width: calc(100vw - 2rem);
        margin: 0.5rem;
    }
    
    #notification-container {
        left: 0;
        right: 0;
        padding: 0 !important;
    }
}