/* نظام الرسائل والإشعارات الموحد */

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container-unified {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

.toast-unified {
    min-width: 320px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: none;
    overflow: hidden;
    margin-bottom: 10px;
    backdrop-filter: blur(10px);
    animation: slideInUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.toast-unified .toast-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.toast-unified .toast-body {
    padding: 12px 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* أنواع التوست المختلفة */
.toast-unified.success {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.toast-unified.success .toast-header {
    background: rgba(102, 126, 234, 0.95);
    color: white;
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.toast-unified.error {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
}

.toast-unified.error .toast-header {
    background: rgba(255, 107, 107, 0.95);
    color: white;
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.toast-unified.warning {
    background: linear-gradient(135deg, #feca57 0%, #ff9ff3 100%);
    color: #333;
}

.toast-unified.warning .toast-header {
    background: rgba(254, 202, 87, 0.95);
    color: #333;
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

.toast-unified.info {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
}

.toast-unified.info .toast-header {
    background: rgba(116, 185, 255, 0.95);
    color: white;
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

/* أيقونات التوست */
.toast-icon {
    font-size: 1.1rem;
    margin-right: 8px;
    opacity: 0.9;
}

/* زر الإغلاق */
.toast-unified .btn-close {
    filter: invert(1);
    opacity: 0.8;
    font-size: 0.8rem;
}

.toast-unified.warning .btn-close,
.toast-unified.warning .toast-icon {
    filter: none;
}

/* ===== INLINE ALERTS ===== */
.alert-unified {
    border-radius: 10px;
    border: none;
    padding: 16px 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    animation: slideDown 0.3s ease-out;
}

.alert-unified::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: currentColor;
}

.alert-unified.success {
    background: linear-gradient(135deg, #d4edda 0%, #c8e6c9 100%);
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-unified.error,
.alert-unified.danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-unified.warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-unified.info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* قائمة الأخطاء */
.alert-unified ul {
    list-style-type: none;
    padding-left: 0;
    margin-bottom: 0;
    margin-top: 10px;
}

.alert-unified li {
    padding: 4px 0;
    position: relative;
    padding-left: 20px;
    font-size: 0.9rem;
}

.alert-unified li:before {
    content: "•";
    color: currentColor;
    font-weight: bold;
    position: absolute;
    left: 0;
    opacity: 0.7;
}

/* ===== FIELD VALIDATION ===== */
.form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
    background-image: none;
}

.form-select.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
    background-image: none;
}

.invalid-feedback {
    display: block !important;
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    padding-left: 0.5rem;
    font-weight: 500;
    position: relative;
}

.invalid-feedback:before {
    content: "⚠";
    margin-right: 4px;
    font-size: 0.8rem;
    opacity: 0.8;
}

/* ===== LOADING STATES ===== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: inherit;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== ANIMATIONS ===== */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 20%, 40%, 60%, 80%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-3px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(3px);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.shake {
    animation: shake 0.6s ease-in-out;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .toast-container-unified {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toast-unified {
        min-width: auto;
        width: 100%;
    }
    
    .alert-unified {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    .toast-unified .toast-header {
        background: rgba(33, 37, 41, 0.95);
        color: #f8f9fa;
    }
    
    .alert-unified {
        box-shadow: 0 4px 12px rgba(255, 255, 255, 0.08);
    }
    
    .loading-overlay {
        background: rgba(33, 37, 41, 0.9);
    }
}

/* ===== UTILITY CLASSES ===== */
.message-icon {
    margin-right: 8px;
    opacity: 0.9;
}

.close-btn-unified {
    background: none;
    border: none;
    color: currentColor;
    opacity: 0.7;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-btn-unified:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

.message-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.message-content {
    font-size: 0.9rem;
    line-height: 1.4;
    opacity: 0.95;
}
