/* WE Tracker - styles */
* {
  font-family: 'Cairo', 'Tahoma', sans-serif;
  /* Force Latin (English) digits everywhere, even inside Arabic text */
  -moz-font-feature-settings: "lnum";
  -webkit-font-feature-settings: "lnum";
  font-feature-settings: "lnum";
  font-variant-numeric: lining-nums;
}

html, body {
  /* Render any locale-aware numerals as Latin (0-9) */
  -webkit-locale: "en";
}

body {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  min-height: 100vh;
}

.font-cairo {
  font-family: 'Cairo', 'Tahoma', sans-serif;
}

/* Loading */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 1rem;
  color: #64748b;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e2e8f0;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Progress bar gradient utility */
.progress-bar {
  height: 14px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
}
.progress-fill.warn {
  background: linear-gradient(90deg, #f59e0b, #f97316);
}
.progress-fill.danger {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* Color themes for subscribers */
.theme-primary {
  --c1: #6366f1;
  --c2: #8b5cf6;
}
.theme-secondary {
  --c1: #10b981;
  --c2: #06b6d4;
}
.theme-tertiary {
  --c1: #f59e0b;
  --c2: #ef4444;
}
.theme-pink {
  --c1: #ec4899;
  --c2: #f43f5e;
}
.theme-blue {
  --c1: #3b82f6;
  --c2: #0ea5e9;
}

.sub-card {
  background: white;
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  border-top: 4px solid var(--c1, #6366f1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.sub-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
}

.sub-card .progress-fill {
  background: linear-gradient(90deg, var(--c1), var(--c2));
}

/* Disconnected badge */
.disconnected-badge {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: white;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  animation: pulse 1.6s ease-in-out infinite;
}

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

.disconnect-notice {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border: 2px dashed #f97316;
  color: #9a3412;
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: 0.75rem;
  font-weight: 600;
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
  font-size: 0.95rem;
}
.btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
}
.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.btn-danger {
  background: #ef4444;
  color: white;
}
.btn-danger:hover {
  background: #dc2626;
}
.btn-ghost {
  background: white;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.btn-ghost:hover {
  background: #f8fafc;
}

/* Inputs */
.input,
.select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  background: white;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus,
.select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Header card */
.hero-card {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  color: white;
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.25);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}
.modal {
  background: white;
  border-radius: 1rem;
  width: 100%;
  max-width: 520px;
  padding: 1.5rem;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
  animation: toast-in 0.25s ease;
}
.toast.error {
  background: #dc2626;
}
.toast.success {
  background: #16a34a;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Table */
.log-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 0.75rem;
  overflow: hidden;
}
.log-table th,
.log-table td {
  padding: 0.75rem;
  text-align: right;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9rem;
}
.log-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
}
.log-table tbody tr:hover {
  background: #f8fafc;
}

/* Last Update Badge — clearer & larger so users know when data was refreshed */
.last-update-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.2rem;
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  border: 1.5px solid #c7d2fe;
  color: #4338ca;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.12);
  letter-spacing: 0.2px;
}
.last-update-badge i {
  color: #6366f1;
  font-size: 1.05rem;
}
.last-update-badge strong {
  color: #312e81;
  font-weight: 800;
  font-size: 1rem;
}
@media (max-width: 480px) {
  .last-update-badge {
    font-size: 0.85rem;
    padding: 0.6rem 1rem;
  }
  .last-update-badge strong {
    font-size: 0.9rem;
  }
}
