MorphGuard / static /css /smart_validator.css
juanquy's picture
Initial clean commit of modular MorphGuard
2978bba
Raw
History Blame Contribute Delete
9.44 kB
/**
* MorphGuard Smart Validator Styles
*
* Styling for the AI-assisted form validation system,
* with theme compatibility and responsive design.
*/
/* Container for feedback elements */
.smart-feedback {
margin-top: 0.5rem;
transition: all 0.3s ease;
}
/* Error message styling */
.smart-error-message {
color: var(--error, #ef4444);
font-size: 0.875rem;
line-height: 1.25rem;
padding: 0.25rem 0;
animation: smartFadeIn 0.3s ease-in-out;
display: flex;
align-items: center;
}
.smart-error-message::before {
content: "";
display: inline-block;
width: 16px;
height: 16px;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E");
background-repeat: no-repeat;
background-size: contain;
margin-right: 0.5rem;
flex-shrink: 0;
}
/* Error state for inputs */
.smart-error {
border-color: var(--error, #ef4444) !important;
box-shadow: 0 0 0 1px var(--error, #ef4444) !important;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 0.75rem center;
background-size: 1.25rem 1.25rem;
padding-right: 2.5rem !important;
transition: all 0.2s ease;
}
/* Valid state for inputs */
.smart-valid {
border-color: var(--success, #10b981) !important;
box-shadow: 0 0 0 1px var(--success, #10b981) !important;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'%3E%3C/path%3E%3Cpolyline points='22 4 12 14.01 9 11.01'%3E%3C/polyline%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 0.75rem center;
background-size: 1.25rem 1.25rem;
padding-right: 2.5rem !important;
transition: all 0.2s ease;
}
/* Select elements need special handling for background positioning */
select.smart-error,
select.smart-valid {
background-position: right 2rem center;
}
/* Error and valid states for file inputs (which can't have backgrounds) */
input[type="file"].smart-error {
border: 1px solid var(--error, #ef4444);
background-image: none;
padding-right: inherit !important;
}
input[type="file"].smart-valid {
border: 1px solid var(--success, #10b981);
background-image: none;
padding-right: inherit !important;
}
/* Custom file input label for validation states */
.smart-file-label.error {
color: var(--error, #ef4444);
}
.smart-file-label.valid {
color: var(--success, #10b981);
}
/* Suggestions styling */
.smart-suggestions-list {
margin-top: 0.5rem;
border: 1px solid var(--border-color, #e5e7eb);
border-radius: 0.375rem;
background-color: var(--bg-secondary, #f9fafb);
padding: 0.5rem;
animation: smartFadeIn 0.3s ease-in-out;
}
.smart-suggestion-item {
padding: 0.5rem;
margin-bottom: 0.25rem;
border-radius: 0.25rem;
cursor: pointer;
color: var(--accent-primary, #3b82f6);
transition: all 0.2s ease;
display: flex;
align-items: center;
}
.smart-suggestion-item:last-child {
margin-bottom: 0;
}
.smart-suggestion-item:hover {
background-color: rgba(var(--accent-primary-rgb, 59, 130, 246), 0.1);
}
.smart-suggestion-item::before {
content: "";
display: inline-block;
width: 16px;
height: 16px;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z'%3E%3C/path%3E%3C/svg%3E");
background-repeat: no-repeat;
background-size: contain;
margin-right: 0.5rem;
flex-shrink: 0;
}
/* AI suggestion highlight */
.smart-suggestion-highlight {
font-weight: var(--font-weight-semibold, 600);
color: var(--accent-primary, #3b82f6);
}
/* Helper for hiding elements */
.hidden {
display: none !important;
}
/* Animation for feedback elements */
@keyframes smartFadeIn {
0% { opacity: 0; transform: translateY(-5px); }
100% { opacity: 1; transform: translateY(0); }
}
/* Focus styles */
.smart-error:focus {
box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
}
.smart-valid:focus {
box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25) !important;
}
/* Processing state */
.smart-processing {
position: relative;
pointer-events: none;
}
.smart-processing::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: linear-gradient(90deg,
rgba(var(--accent-primary-rgb, 59, 130, 246), 0.1),
rgba(var(--accent-primary-rgb, 59, 130, 246), 0.2),
rgba(var(--accent-primary-rgb, 59, 130, 246), 0.1)
);
background-size: 200% 100%;
animation: smartProcessing 1.5s infinite;
border-radius: inherit;
}
@keyframes smartProcessing {
0% { background-position: 100% 0; }
100% { background-position: -100% 0; }
}
/* Theme-specific styles */
/* Cyberpunk theme */
.theme-cyberpunk .smart-error-message::before {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff00ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E");
}
.theme-cyberpunk .smart-error {
border-color: #ff00ff !important;
box-shadow: 0 0 0 1px #ff00ff !important;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff00ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E");
}
.theme-cyberpunk .smart-suggestion-item::before {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff00ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z'%3E%3C/path%3E%3C/svg%3E");
}
/* Matrix theme */
.theme-matrix .smart-error-message::before {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300ff00' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E");
}
.theme-matrix .smart-error {
border-color: #00ff00 !important;
box-shadow: 0 0 0 1px #00ff00 !important;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300ff00' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E");
}
.theme-matrix .smart-suggestion-item::before {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300ff00' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z'%3E%3C/path%3E%3C/svg%3E");
}
/* Midnight theme */
.theme-midnight .smart-suggestion-item:hover {
background-color: rgba(59, 130, 246, 0.2);
}
/* Responsive adjustments */
@media (max-width: 640px) {
.smart-error-message {
font-size: 0.75rem;
}
.smart-suggestions-list {
padding: 0.25rem;
}
.smart-suggestion-item {
padding: 0.375rem;
}
}
/* High-contrast accessibility enhancements */
@media (prefers-contrast: more) {
.smart-error {
border-width: 2px !important;
}
.smart-valid {
border-width: 2px !important;
}
.smart-error-message {
font-weight: bold;
}
.smart-suggestion-item {
border: 1px solid currentColor;
}
}
/* Reduced motion settings */
@media (prefers-reduced-motion: reduce) {
.smart-error,
.smart-valid,
.smart-suggestion-item {
transition: none !important;
}
.smart-error-message,
.smart-suggestions-list {
animation: none !important;
}
}