/**
 * أنماط معالجة الأخطاء
 * Error Handling Styles
 */

/* ========================================
   Error Modal
   ======================================== */

.error-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.error-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.error-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.error-modal-content {
    position: relative;
    max-width: 400px;
    width: 100%;
    background: linear-gradient(135deg, #1e1b4b, #0f172a);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 24px;
    padding: 32px;
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.error-modal.active .error-modal-content {
    transform: scale(1) translateY(0);
}

.error-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.error-icon.error-network {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.error-icon.error-auth {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

.error-icon.error-validation {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.error-title {
    font-size: 20px;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
}

.error-message {
    color: #94a3b8;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.error-details {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 20px;
    text-align: left;
    direction: ltr;
}

.error-details code {
    font-family: monospace;
    font-size: 12px;
    color: #ef4444;
    word-break: break-all;
}

.error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.error-btn-retry,
.error-btn-close {
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.error-btn-retry {
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    color: white;
}

.error-btn-retry:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(139, 92, 246, 0.3);
}

.error-btn-close {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.error-btn-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========================================
   Field Errors
   ======================================== */

.input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

.field-error-message {
    display: block;
    color: #ef4444;
    font-size: 12px;
    margin-top: 6px;
}

.field-error-message i {
    margin-left: 4px;
}

/* ========================================
   Inline Alerts
   ======================================== */

.inline-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 14px;
    animation: slide-in 0.3s ease;
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.inline-alert i:first-child {
    font-size: 18px;
}

.inline-alert span {
    flex: 1;
}

.inline-alert button {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    padding: 4px;
}

.inline-alert button:hover {
    opacity: 1;
}

.inline-alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.inline-alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.inline-alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.inline-alert-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

/* ========================================
   Offline Banner
   ======================================== */

.offline-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    text-align: center;
    z-index: 99999;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.offline-banner.visible {
    transform: translateY(0);
}

.offline-banner i {
    margin-left: 8px;
}
