/**
 * Secure Forms CSS
 * Styling for enhanced form security features
 * Stone OnePoint Solutions Website
 */

/* Form validation styles */
.form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.form-control.is-valid {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

.valid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #28a745;
}

/* Form message styles */
.form-message {
    margin-bottom: 1rem;
    padding: 0.75rem 1.25rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
}

.form-message.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.form-message.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* Loading state styles */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.1em;
}

.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* Form security indicators */
.security-indicator {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 0.875em;
    color: #6c757d;
}

.security-indicator.secure {
    color: #28a745;
}

.security-indicator::before {
    content: "🔒";
    margin-right: 0.25rem;
}

/* Rate limit warning */
.rate-limit-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 0.75rem;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}

/* Form field enhancements */
.form-group {
    position: relative;
    margin-bottom: 1rem;
}

.form-control:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Character counter */
.char-counter {
    font-size: 0.75em;
    color: #6c757d;
    text-align: right;
    margin-top: 0.25rem;
}

.char-counter.warning {
    color: #ffc107;
}

.char-counter.danger {
    color: #dc3545;
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators for keyboard navigation */
.form-control:focus,
.btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-control.is-invalid {
        border-color: #000;
        border-width: 2px;
    }
    
    .form-control.is-valid {
        border-color: #000;
        border-width: 2px;
    }
    
    .invalid-feedback {
        color: #000;
        font-weight: bold;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .spinner-border {
        animation: none;
    }
    
    .form-control {
        transition: none;
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .form-message {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
    
    .invalid-feedback {
        font-size: 0.75rem;
    }
    
    .char-counter {
        font-size: 0.7rem;
    }
}

/* Print styles */
@media print {
    .form-message,
    .invalid-feedback,
    .valid-feedback,
    .security-indicator {
        display: none;
    }
}