/* ═══════════════════════════════════════════════════════
   🎨 ELDEEB COIN — Design System
   Premium Dark Dashboard Theme
   ═══════════════════════════════════════════════════════ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Fira+Code:wght@400;500;600;700&family=Tajawal:wght@300;400;500;700;800;900&display=swap');

/* ── CSS Custom Properties ── */
:root {
  /* Backgrounds */
  --bg-primary: #060b14;
  --bg-secondary: #0c1322;
  --bg-tertiary: #111d33;
  --bg-card: rgba(12, 19, 34, 0.85);
  --bg-glass: rgba(17, 29, 51, 0.6);
  --bg-glass-hover: rgba(17, 29, 51, 0.8);
  --bg-sidebar: linear-gradient(180deg, #070d18 0%, #0a1628 50%, #061020 100%);

  /* Accent Colors */
  --accent: #10b981;
  --accent-light: #34d399;
  --accent-dark: #059669;
  --accent-glow: rgba(16, 185, 129, 0.4);
  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.3);
  --amber: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.3);
  --red: #ef4444;
  --red-glow: rgba(239, 68, 68, 0.3);
  --purple: #8b5cf6;
  --purple-glow: rgba(139, 92, 246, 0.3);
  --blue: #3b82f6;

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #34d399;

  /* Borders */
  --border: rgba(148, 163, 184, 0.08);
  --border-accent: rgba(16, 185, 129, 0.25);
  --border-hover: rgba(16, 185, 129, 0.5);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);

  /* Spacing */
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Tajawal', 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Animated background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(16, 185, 129, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 80%, rgba(6, 182, 212, 0.03) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 50% 50%, rgba(139, 92, 246, 0.02) 0%, transparent 60%);
  z-index: 0;
  pointer-events: none;
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb {
  background: rgba(16, 185, 129, 0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(16, 185, 129, 0.5); }

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Tajawal', 'Inter', sans-serif;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

p { line-height: 1.7; color: var(--text-secondary); }

a {
  color: var(--accent-light);
  text-decoration: none;
  transition: var(--transition-fast);
}
a:hover { color: var(--accent); }

.mono { font-family: 'Fira Code', monospace; }

/* ── Layout ── */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  overflow: hidden;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
  flex-shrink: 0;
}

.sidebar-logo img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
  object-fit: cover;
}

.sidebar-brand {
  flex: 1;
  min-width: 0;
}

.sidebar-brand h3 {
  font-size: 1.05rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-light), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.sidebar-brand span {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.nav-section-label {
  padding: 16px 20px 6px;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  margin: 2px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 3px;
  height: 100%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  opacity: 0;
  transition: var(--transition);
}

.nav-item:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(16, 185, 129, 0.08);
  color: var(--accent-light);
  font-weight: 600;
}

.nav-item.active::before {
  opacity: 1;
}

.nav-item .nav-icon {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-right: auto;
  margin-left: 0;
  background: var(--accent);
  color: #fff;
  font-size: 0.6rem;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
  font-family: 'Fira Code', monospace;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-info .user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-info .user-role {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-logout {
  background: none;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.75rem;
  transition: var(--transition);
  font-family: inherit;
}
.btn-logout:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--red);
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-right: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.top-header {
  height: var(--header-height);
  background: rgba(6, 11, 20, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-title .title-icon { font-size: 1.3rem; }

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

.header-time {
  font-family: 'Fira Code', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-glass);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: statusPulse 2s ease-in-out infinite;
}
.status-dot.online { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.status-dot.offline { background: var(--red); box-shadow: 0 0 8px var(--red-glow); }

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.btn-mobile-menu {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.2rem;
}

/* ── Content Area ── */
.content-area {
  flex: 1;
  padding: 24px;
}

/* ── Section ── */
.section {
  display: none;
  animation: fadeIn 0.4s ease;
}
.section.active { display: block; }

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

/* ── Section Header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title .sec-icon {
  font-size: 1.4rem;
}

.section-actions {
  display: flex;
  gap: 8px;
}

/* ── Login Overlay ── */
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-overlay.hidden { display: none; }

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(16, 185, 129, 0.08);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--cyan), var(--accent));
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.login-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  box-shadow: 0 0 40px var(--accent-glow);
}

.login-logo img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-lg);
  object-fit: cover;
}

.login-card h2 {
  font-size: 1.5rem;
  margin-bottom: 6px;
  background: linear-gradient(135deg, var(--accent-light), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-card p {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 0.85rem;
}

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  margin-bottom: 16px;
  display: none;
}

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  min-width: 280px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.4s ease, toastOut 0.4s ease 3.6s forwards;
  pointer-events: auto;
  backdrop-filter: blur(20px);
}

.toast.success { border-color: rgba(16, 185, 129, 0.4); }
.toast.error { border-color: rgba(239, 68, 68, 0.4); }
.toast.warning { border-color: rgba(245, 158, 11, 0.4); }
.toast.info { border-color: rgba(6, 182, 212, 0.4); }

.toast-icon { font-size: 1.2rem; flex-shrink: 0; }
.toast-text { font-size: 0.85rem; color: var(--text-primary); flex: 1; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-10px); }
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-right: 0; }
  .btn-mobile-menu { display: block; }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99;
    display: none;
  }
  .sidebar-overlay.active { display: block; }
}

@media (max-width: 640px) {
  .content-area { padding: 16px; }
  html { font-size: 13px; }
  .top-header { padding: 0 16px; }
  .header-time { display: none; }
}
