/**
 * NEEDIBI SERVE - UNIFIED ALERT & ERROR STYLING
 * Used across all views for consistent error/warning/success/info messages
 * Uses Tailwind color system with fallback support
 */

/* ===== TAILWIND-BASED ALERT SYSTEM ===== */

/* Error/Danger Alerts - RED */
.alert-error,
.alert-danger,
.bg-red-50,
.alert[class*="error"],
.alert[class*="danger"],
[class*="error-box"],
[class*="error-message"] {
    background: linear-gradient(135deg, rgba(254, 242, 242, 1), rgba(254, 232, 232, 1));
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #dc2626;
    border-radius: 0.5rem;
    padding: 12px 16px;
    font-weight: 500;
    line-height: 1.5;
}

.dark .alert-error,
.dark .alert-danger,
.dark [class*="error-message"] {
    background: rgba(127, 29, 29, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

/* Warning/Caution Alerts - YELLOW */
.alert-warn,
.alert-warning,
.alert-caution,
.alert[class*="warn"] {
    background: linear-gradient(135deg, rgba(254, 252, 232, 1), rgba(254, 248, 215, 1));
    border: 1px solid rgba(217, 119, 6, 0.3);
    color: #b45309;
    border-radius: 0.5rem;
    padding: 12px 16px;
    font-weight: 500;
}

.dark .alert-warn,
.dark .alert-warning {
    background: rgba(120, 53, 15, 0.15);
    border-color: rgba(217, 119, 6, 0.4);
    color: #fdba74;
}

/* Success Alerts - GREEN */
.alert-success,
.alert-ok,
.alert[class*="success"] {
    background: linear-gradient(135deg, rgba(240, 253, 244, 1), rgba(220, 252, 231, 1));
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #16a34a;
    border-radius: 0.5rem;
    padding: 12px 16px;
    font-weight: 500;
}

.dark .alert-success {
    background: rgba(20, 83, 45, 0.15);
    border-color: rgba(34, 197, 94, 0.4);
    color: #86efac;
}

/* Info/Blue Alerts */
.alert-info,
.alert[class*="info"],
.alert[class*="notice"] {
    background: linear-gradient(135deg, rgba(240, 248, 255, 1), rgba(225, 242, 251, 1));
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #1e40af;
    border-radius: 0.5rem;
    padding: 12px 16px;
    font-weight: 500;
}

.dark .alert-info {
    background: rgba(30, 58, 138, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: #93c5fd;
}

/* ===== ERROR MESSAGE FIELD STYLING ===== */

/* Error text for form fields */
.error-text,
.field-error,
[class*="error-msg"],
p[class*="error"] {
    color: #dc2626;
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

.dark .error-text,
.dark .field-error {
    color: #fca5a5;
}

/* Form field with error state */
.form-input.error,
.form-input.is-invalid,
input.error,
textarea.error,
select.error {
    border-color: #dc2626 !important;
    background-color: rgba(239, 68, 68, 0.05);
}

.form-input.error:focus,
input.error:focus,
textarea.error:focus,
select.error:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ===== TOAST/NOTIFICATION STYLING ===== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease-out;
    font-weight: 500;
}

.toast.error {
    background: #dc2626;
    color: #ffffff;
    border: 1px solid #991b1b;
}

.toast.success {
    background: #16a34a;
    color: #ffffff;
    border: 1px solid #15803d;
}

.toast.warning {
    background: #d97706;
    color: #ffffff;
    border: 1px solid #b45309;
}

.toast.info {
    background: #2563eb;
    color: #ffffff;
    border: 1px solid #1e40af;
}

.dark .toast.error {
    background: rgba(127, 29, 29, 0.8);
    color: #fca5a5;
}

.dark .toast.success {
    background: rgba(20, 83, 45, 0.8);
    color: #86efac;
}

@keyframes slideInRight {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== INLINE BANNER STYLING ===== */

.inline-banner {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid;
}

.inline-banner.error-banner,
.inline-banner.danger-banner {
    background: linear-gradient(135deg, rgba(254, 242, 242, 1), rgba(254, 232, 232, 1));
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.3);
}

.dark .inline-banner.error-banner {
    background: rgba(127, 29, 29, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.inline-banner.success-banner {
    background: linear-gradient(135deg, rgba(240, 253, 244, 1), rgba(220, 252, 231, 1));
    color: #16a34a;
    border-color: rgba(34, 197, 94, 0.3);
}

.dark .inline-banner.success-banner {
    background: rgba(20, 83, 45, 0.15);
    border-color: rgba(34, 197, 94, 0.4);
    color: #86efac;
}

.inline-banner.warning-banner {
    background: linear-gradient(135deg, rgba(254, 252, 232, 1), rgba(254, 248, 215, 1));
    color: #b45309;
    border-color: rgba(217, 119, 6, 0.3);
}

.dark .inline-banner.warning-banner {
    background: rgba(120, 53, 15, 0.15);
    border-color: rgba(217, 119, 6, 0.4);
    color: #fdba74;
}

.inline-banner.info-banner {
    background: linear-gradient(135deg, rgba(240, 248, 255, 1), rgba(225, 242, 251, 1));
    color: #1e40af;
    border-color: rgba(59, 130, 246, 0.3);
}

.dark .inline-banner.info-banner {
    background: rgba(30, 58, 138, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: #93c5fd;
}

/* ===== UTILITY CLASSES ===== */

.alert-hidden,
.alert.hidden,
.alert[style*="display: none"] {
    display: none !important;
}

.alert-visible {
    display: block !important;
}

/* Icon styling within alerts */
.alert i,
.alert-icon,
.toast i {
    font-size: 1.125rem;
    flex-shrink: 0;
}

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

@media (max-width: 640px) {
    .toast-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .toast {
        padding: 10px 12px;
        font-size: 14px;
    }

    .alert,
    .inline-banner {
        padding: 10px 12px;
        font-size: 13px;
    }
}
