/* public/css/style.css */
:root {
  --bg-color: #0f172a;
  --panel-bg: rgba(30, 41, 59, 0.7);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius: 12px;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.25);
}

[dir="rtl"] {
  --font-family: 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background: var(--bg-color);
  background-image: radial-gradient(circle at top right, #1e3a8a, transparent 40%),
                    radial-gradient(circle at bottom left, #064e3b, transparent 40%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

/* Hub Styles */
.hub-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 80px 20px;
}

.hub-header {
  text-align: center;
  margin-bottom: 60px;
}

.hub-header h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 12px;
  background: linear-gradient(to right, #60a5fa, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hub-header p {
  color: var(--text-secondary);
  font-size: 1.2rem;
}

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

.dashboard-card {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-decoration: none;
  color: var(--text-primary);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.dashboard-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 25px 30px -5px rgba(0, 0, 0, 0.6);
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(255, 255, 255, 0.25);
}

.dashboard-card .icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}

.dashboard-card h3 {
  font-size: 1.35rem;
  margin-bottom: 10px;
  font-weight: 600;
}

.dashboard-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Dashboard Styles */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--panel-border);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.topbar h1 {
  font-size: 1.35rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar .back-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
  background: rgba(255,255,255,0.05);
  padding: 6px 12px;
  border-radius: 6px;
}

.topbar .back-link:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.1);
}

.main-content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

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

.stat-card {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-color);
}

.stat-card:nth-child(2)::before { background: var(--success); }
.stat-card:nth-child(3)::before { background: var(--warning); }
.stat-card:nth-child(4)::before { background: #8b5cf6; }

.stat-title {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  font-weight: 600;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
}

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

.chart-card {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.chart-card h3 {
  font-size: 1.15rem;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 16px;
  font-weight: 600;
}

.chart-container {
  flex: 1;
  position: relative;
  min-height: 320px;
}

/* Loading Overlay */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(5px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: opacity 0.4s ease;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
  margin-bottom: 20px;
}

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

.hidden {
  opacity: 0;
  pointer-events: none;
}
