/* ==================== Variables ==================== */
:root {
  --primary-color: #667eea;
  --success-color: #48bb78;
  --danger-color: #f56565;
  --warning-color: #ed8936;
  --info-color: #4299e1;
  --purple-color: #9f7aea;

  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-hover: #334155;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border-color: #334155;
  --border-radius: 16px;
  --border-radius-sm: 8px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== Reset & Base ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, var(--bg-primary) 0%, #1a2332 100%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  direction: rtl;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==================== Header ==================== */
.header {
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo i {
  font-size: 42px;
  color: var(--primary-color);
  animation: pulse 2s infinite;
  filter: drop-shadow(0 0 10px rgba(102, 126, 234, 0.5));
}

.logo-text h1 {
  font-size: 32px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary-color), var(--info-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 2px;
  line-height: 1;
}

.tagline {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  margin: 0;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 16px;
}

.uptime-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(72, 187, 120, 0.15);
  border: 1px solid rgba(72, 187, 120, 0.4);
  border-radius: var(--border-radius-sm);
  font-weight: 600;
}

.uptime-badge i {
  color: var(--success-color);
  font-size: 18px;
}

.uptime-badge span {
  font-size: 16px;
  color: var(--success-color);
}

.uptime-badge small {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(72, 187, 120, 0.1);
  border: 1px solid rgba(72, 187, 120, 0.3);
  border-radius: var(--border-radius-sm);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  position: relative;
}

.status-dot.operational {
  background: var(--success-color);
}

.status-dot.degraded {
  background: var(--warning-color);
}

.status-dot.down {
  background: var(--danger-color);
}

.status-dot.pulse::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: inherit;
  opacity: 0.4;
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ==================== Main Content ==================== */
.main-content {
  padding: 40px 0;
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
}

.section-title i {
  color: var(--primary-color);
}

/* ==================== Stats Grid ==================== */
.stats-section {
  margin-bottom: 48px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  display: flex;
  gap: 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--card-color));
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--card-color);
}

.stat-card:hover::before {
  background: linear-gradient(90deg, var(--card-color), transparent);
}

.stat-card.primary { --card-color: var(--primary-color); }
.stat-card.success { --card-color: var(--success-color); }
.stat-card.info { --card-color: var(--info-color); }
.stat-card.warning { --card-color: var(--warning-color); }
.stat-card.danger { --card-color: var(--danger-color); }
.stat-card.purple { --card-color: var(--purple-color); }

.stat-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--card-color), rgba(255, 255, 255, 0.1));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.stat-content {
  flex: 1;
}

.stat-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 8px;
  font-family: 'Cairo', monospace;
}

.stat-value small {
  font-size: 18px;
  color: var(--text-secondary);
  margin-right: 4px;
}

.stat-change {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-change.positive {
  color: var(--success-color);
}

.stat-change.negative {
  color: var(--danger-color);
}

.stat-meta {
  font-size: 13px;
  color: var(--text-muted);
}

/* ==================== Services Grid ==================== */
.services-section {
  margin-bottom: 48px;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  transition: var(--transition);
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--success-color);
}

.service-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.service-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary-color), var(--info-color));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
  flex-shrink: 0;
}

.service-info {
  flex: 1;
}

.service-info h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.service-info p {
  font-size: 14px;
  color: var(--text-secondary);
}

.service-status {
  flex-shrink: 0;
}

.status-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.operational {
  background: rgba(72, 187, 120, 0.2);
  color: var(--success-color);
  border: 1px solid rgba(72, 187, 120, 0.3);
}

.status-badge.degraded {
  background: rgba(237, 137, 54, 0.2);
  color: var(--warning-color);
  border: 1px solid rgba(237, 137, 54, 0.3);
}

.status-badge.down {
  background: rgba(245, 101, 101, 0.2);
  color: var(--danger-color);
  border: 1px solid rgba(245, 101, 101, 0.3);
}

.service-metrics {
  display: flex;
  gap: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.metric-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ==================== Charts ==================== */
.charts-section {
  margin-bottom: 48px;
}

.chart-container {
  display: grid;
  gap: 24px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
}

.chart-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

/* ==================== Campaigns ==================== */
.campaigns-section {
  margin-bottom: 48px;
}

.campaigns-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.campaign-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  transition: var(--transition);
}

.campaign-item:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
}

.campaign-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.campaign-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.campaign-status-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.campaign-status-badge.active {
  background: rgba(72, 187, 120, 0.2);
  color: var(--success-color);
}

.campaign-status-badge.scheduled {
  background: rgba(66, 153, 225, 0.2);
  color: var(--info-color);
}

.campaign-progress {
  margin-bottom: 12px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--success-color));
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-text {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.campaign-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.campaign-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.campaign-stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.campaign-stat-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 16px;
}

/* ==================== Trust Section ==================== */
.trust-section {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(66, 153, 225, 0.03));
  padding: 80px 0;
  margin-top: 60px;
  border-top: 1px solid var(--border-color);
}

.section-title.centered {
  text-align: center;
  justify-content: center;
}

.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 32px;
  margin-bottom: 60px;
}

.trust-item {
  text-align: center;
  padding: 32px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  transition: var(--transition);
}

.trust-item:hover {
  transform: translateY(-8px);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-xl);
}

.trust-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--primary-color), var(--info-color));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: white;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.trust-item h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.trust-item p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==================== CTA Section ==================== */
.cta-section {
  text-align: center;
  padding: 60px 40px;
  background: linear-gradient(135deg, var(--primary-color), var(--info-color));
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-xl);
  position: relative;
  overflow: hidden;
}

.cta-section::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1), transparent 70%);
  animation: rotate 20s linear infinite;
}

.cta-section h3 {
  font-size: 32px;
  font-weight: 900;
  color: white;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.cta-section p {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 32px;
  position: relative;
  z-index: 1;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 48px;
  background: white;
  color: var(--primary-color);
  font-size: 18px;
  font-weight: 700;
  border-radius: 50px;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
}

.cta-button:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  background: rgba(255, 255, 255, 0.95);
}

.cta-button i {
  font-size: 20px;
}

/* ==================== Footer ==================== */
.footer {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-color);
  padding: 48px 0 24px;
  margin-top: 0;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-color);
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.footer-logo i {
  font-size: 32px;
  color: var(--primary-color);
}

.footer-logo span {
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary-color), var(--info-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-tagline {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

.footer-center p {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.footer-social {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
}

.footer-social a {
  width: 40px;
  height: 40px;
  background: rgba(102, 126, 234, 0.1);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 18px;
  transition: var(--transition);
}

.footer-social a:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-4px);
}

.footer-bottom {
  text-align: center;
  padding-top: 24px;
}

.footer-bottom p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

#updateIcon {
  animation: rotate 2s linear infinite;
}

#connectionStatus {
  font-size: 8px;
  color: var(--success-color);
}

#connectionStatus.disconnected {
  color: var(--danger-color);
}

/* ==================== Animations ==================== */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes pulse-ring {
  0% {
    transform: scale(1);
    opacity: 0.4;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.counter {
  animation: fadeIn 0.5s ease;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .services-grid {
    grid-template-columns: 1fr;
  }

  .footer .container {
    flex-direction: column;
    text-align: center;
  }
}

/* ==================== Utility Classes ==================== */
.text-success {
  color: var(--success-color);
}

.text-danger {
  color: var(--danger-color);
}

.text-warning {
  color: var(--warning-color);
}

.text-info {
  color: var(--info-color);
}
