/**
 * ╔════════════════════════════════════════════════════════════════╗
 * ║     OFFLINE MODE UI STYLES — أنماط واجهة الوضع الأوفلاين      ║
 * ║            Professional status indicators & notifications       ║
 * ╚════════════════════════════════════════════════════════════════╝
 */

/* ════════════════════════════════════════════════════════════════
   CONNECTION STATUS INDICATOR — مؤشر حالة الاتصال
════════════════════════════════════════════════════════════════ */

.connection-status-badge {
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.connection-status-badge.online {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22c55e;
}

.connection-status-badge.offline {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.connection-status-badge.syncing {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.05));
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #3b82f6;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.online {
  background: #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

.status-dot.offline {
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
  animation: pulse-dot-danger 1.5s ease-in-out infinite;
}

.status-dot.syncing {
  background: #3b82f6;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
  animation: spin 2s linear infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes pulse-dot-danger {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ════════════════════════════════════════════════════════════════
   OFFLINE MODE BANNER — شريط الوضع الأوفلاين
════════════════════════════════════════════════════════════════ */

#offline-mode-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
  border-bottom: 2px solid rgba(239, 68, 68, 0.3);
  padding: 12px 20px;
  text-align: center;
  font-size: 14px;
  color: #ef4444;
  font-weight: 600;
  z-index: 9997;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

#offline-mode-banner.visible {
  transform: translateY(0);
}

#offline-mode-banner.syncing {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05));
  border-bottom-color: rgba(59, 130, 246, 0.3);
  color: #3b82f6;
}

#offline-mode-banner.connected {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05));
  border-bottom-color: rgba(34, 197, 94, 0.3);
  color: #22c55e;
}

.offline-banner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.offline-banner-icon {
  font-size: 18px;
  animation: bounce 1s ease-in-out infinite;
}

#offline-mode-banner.syncing .offline-banner-icon {
  animation: spin 2s linear infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ════════════════════════════════════════════════════════════════
   OFFLINE NOTIFICATIONS — إشعارات الوضع الأوفلاين
════════════════════════════════════════════════════════════════ */

#offline-notifications {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 9999;
  max-width: 400px;
}

.offline-notification {
  background: white;
  border-left: 4px solid #ef4444;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
  opacity: 0;
}

.offline-notification.removing {
  animation: slideOut 0.3s ease;
  opacity: 0;
}

.offline-notification.success {
  border-left-color: #22c55e;
  background: rgba(34, 197, 94, 0.05);
}

.offline-notification.success .offline-notif-icon {
  color: #22c55e;
}

.offline-notification.warning {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}

.offline-notification.warning .offline-notif-icon {
  color: #f59e0b;
}

.offline-notification.error {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.offline-notification.error .offline-notif-icon {
  color: #ef4444;
}

.offline-notification.info {
  border-left-color: #3b82f6;
  background: rgba(59, 130, 246, 0.05);
}

.offline-notification.info .offline-notif-icon {
  color: #3b82f6;
}

.offline-notif-icon {
  font-size: 18px;
  font-weight: bold;
  flex-shrink: 0;
}

.offline-notif-text {
  font-size: 13px;
  font-weight: 500;
  color: #1f2937;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* ════════════════════════════════════════════════════════════════
   SYNCING STATE — حالة المزامنة
════════════════════════════════════════════════════════════════ */

.syncing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(2px);
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
}

.syncing-overlay.active {
  display: flex;
}

.syncing-content {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
  animation: fadeIn 0.3s ease;
}

.syncing-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 3px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.syncing-content h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 8px;
}

.syncing-content p {
  font-size: 13px;
  color: #6b7280;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ════════════════════════════════════════════════════════════════
   OFFLINE-AWARE BUTTONS
════════════════════════════════════════════════════════════════ */

button:disabled.offline-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button:disabled.offline-disabled::after {
  content: ' (Offline)';
  font-size: 0.85em;
}

/* ════════════════════════════════════════════════════════════════
   CACHED DATA INDICATOR — مؤشر البيانات المخزنة
════════════════════════════════════════════════════════════════ */

.cached-data-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.cached-data-badge::before {
  content: '📦';
  font-size: 10px;
}

/* ════════════════════════════════════════════════════════════════
   DARK MODE SUPPORT
════════════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
  .offline-notification {
    background: #1f2937;
    color: #f3f4f6;
  }

  .offline-notif-text {
    color: #f3f4f6;
  }

  .syncing-content {
    background: #1f2937;
    color: #f3f4f6;
  }

  .syncing-content h3 {
    color: #f3f4f6;
  }

  .syncing-content p {
    color: #9ca3af;
  }
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — متجاوب
════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  #offline-notifications {
    left: 10px;
    right: 10px;
    max-width: none;
  }

  .offline-notification {
    margin-bottom: 8px;
  }

  #offline-mode-banner {
    padding: 10px 15px;
    font-size: 13px;
  }

  .connection-status-badge {
    top: 10px;
    left: 10px;
    padding: 6px 10px;
    font-size: 12px;
  }
}