/* ============================================================
   TAFZEEL BUSINESS HUB — DESIGN SYSTEM
   Premium Executive Client Portal
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

:root {
  /* ── Brand Colors ── */
  --primary: #0B2E83;
  --primary-light: #1648B8;
  --primary-hover: #091F5C;
  --primary-subtle: #EEF2FF;
  --primary-muted: rgba(11, 46, 131, 0.08);

  --secondary: #0D9F6E;
  --secondary-light: #10BA80;
  --secondary-subtle: #ECFDF5;
  --secondary-muted: rgba(13, 159, 110, 0.10);

  --warning: #F59E0B;
  --warning-light: #FCD34D;
  --warning-subtle: #FFFBEB;
  --warning-muted: rgba(245, 158, 11, 0.10);

  --danger: #DC2626;
  --danger-light: #EF4444;
  --danger-subtle: #FEF2F2;
  --danger-muted: rgba(220, 38, 38, 0.10);

  /* ── Neutrals ── */
  --bg: #F7F8FC;
  --bg-alt: #F0F2F8;
  --surface: #FFFFFF;
  --surface-elevated: #FAFBFF;
  --border: #E8EBF4;
  --border-strong: #D1D7EF;
  --border-subtle: rgba(232, 235, 244, 0.6);

  /* ── Text ── */
  --text-primary: #0D1B3E;
  --text-secondary: #6B7399;
  --text-tertiary: #9BA3C4;
  --text-disabled: #C4C9E0;
  --text-inverse: #FFFFFF;

  /* ── Sidebar ── */
  --sidebar-bg: #0B2E83;
  --sidebar-width: 264px;
  --sidebar-collapsed-width: 64px;
  --sidebar-text: rgba(255, 255, 255, 0.75);
  --sidebar-text-active: #FFFFFF;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: rgba(255, 255, 255, 0.15);
  --sidebar-border: rgba(255, 255, 255, 0.10);

  /* ── Topbar ── */
  --topbar-height: 64px;
  --topbar-bg: rgba(247, 248, 252, 0.92);

  /* ── Spacing Scale ── */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 28px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* ── Border Radius ── */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* ── Shadows ── */
  --shadow-xs: 0 1px 2px rgba(11, 46, 131, 0.06);
  --shadow-sm: 0 2px 6px rgba(11, 46, 131, 0.08);
  --shadow-md: 0 4px 16px rgba(11, 46, 131, 0.10);
  --shadow-lg: 0 8px 28px rgba(11, 46, 131, 0.12);
  --shadow-xl: 0 16px 48px rgba(11, 46, 131, 0.16);
  --shadow-hover: 0 6px 24px rgba(11, 46, 131, 0.14);
  --shadow-glow-green: 0 0 20px rgba(13, 159, 110, 0.20);
  --shadow-glow-red: 0 0 20px rgba(220, 38, 38, 0.15);

  /* ── Typography ── */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* ── Transitions ── */
  --transition-fast: 0.12s ease;
  --transition-base: 0.20s ease;
  --transition-slow: 0.35s ease;
  --transition-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-sidebar: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  font-feature-settings: 'cv11', 'ss01';
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: var(--font);
  cursor: pointer;
  border: none;
  background: none;
}

input,
select {
  font-family: var(--font);
}

svg {
  display: block;
  flex-shrink: 0;
}

img {
  display: block;
  max-width: 100%;
}

ul,
ol {
  list-style: none;
}

/* ── Numeric figures — tabular for KPIs & tables ── */
.kpi-value,
.metric-strip-value,
.ring-value,
.hero-stat-value,
.countdown,
.donut-legend-count {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* ── Typography Scale ── */
.text-xs {
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.text-sm {
  font-size: 12px;
  line-height: 1.5;
}

.text-base {
  font-size: 14px;
  line-height: 1.5;
}

.text-md {
  font-size: 15px;
  line-height: 1.5;
}

.text-lg {
  font-size: 16px;
  line-height: 1.4;
}

.text-xl {
  font-size: 18px;
  line-height: 1.4;
}

.text-2xl {
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: -0.3px;
}

.text-3xl {
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.text-4xl {
  font-size: 36px;
  line-height: 1.1;
  letter-spacing: -0.8px;
}

.font-normal    { font-weight: 400; }
.font-medium    { font-weight: 500; }
.font-semibold  { font-weight: 600; }
.font-bold      { font-weight: 700; }
.font-extrabold { font-weight: 800; }

/* ── Color Utilities ── */
.text-primary-color   { color: var(--primary); }
.text-secondary-color { color: var(--secondary); }
.text-warning-color   { color: var(--warning); }
.text-danger-color    { color: var(--danger); }
.text-muted           { color: var(--text-secondary); }
.text-subtle          { color: var(--text-tertiary); }
.text-white           { color: white; }

/* ── Scrollbar ── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ── Focus ring ── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ══════════════════════════════════════════════════════════
   KEYFRAME ANIMATION LIBRARY
   ══════════════════════════════════════════════════════════ */

/* Entrance animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

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

@keyframes scaleInSpring {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}

/* Page transition */
@keyframes pageReveal {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Status / state animations */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* Badge pulse — for critical status dots */
@keyframes badgePulse {
  0%   { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); }
  70%  { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Warning badge pulse */
@keyframes warnPulse {
  0%   { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5); }
  70%  { box-shadow: 0 0 0 5px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Live indicator */
@keyframes livePing {
  0%   { transform: scale(1);   opacity: 1; }
  75%  { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Breathe — gentle scale on static elements to suggest life */
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.015); }
}

/* Skeleton shimmer */
@keyframes skeletonShimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

/* Progress fill */
@keyframes progressFill {
  from { width: 0%; }
}

/* Ring fill */
@keyframes ringFill {
  from { stroke-dashoffset: 314; }
}

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

/* Shimmer sweep (for progress bars) */
@keyframes shimmer {
  to { left: 200%; }
}

/* Stagger helper */
@keyframes staggerFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Animation Utility Classes ── */
.animate-fade-in    { animation: fadeIn 0.4s ease forwards; }
.animate-scale-in   { animation: scaleIn 0.3s var(--transition-spring) forwards; }
.animate-slide-left { animation: slideInLeft 0.3s ease forwards; }
.animate-slide-up   { animation: slideInUp 0.35s ease forwards; }
.animate-page       { animation: pageReveal 0.45s ease forwards; }

/* ── Staggered animation delays ── */
.delay-1  { animation-delay: 0.05s; }
.delay-2  { animation-delay: 0.10s; }
.delay-3  { animation-delay: 0.15s; }
.delay-4  { animation-delay: 0.20s; }
.delay-5  { animation-delay: 0.25s; }
.delay-6  { animation-delay: 0.30s; }
.delay-7  { animation-delay: 0.35s; }
.delay-8  { animation-delay: 0.40s; }

/* ── Skeleton Loading ── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--border) 25%,
    var(--bg-alt) 50%,
    var(--border) 75%
  );
  background-size: 400px 100%;
  animation: skeletonShimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
  color: transparent !important;
  user-select: none;
  pointer-events: none;
}

.skeleton * { visibility: hidden; }

/* ── Live Status Indicator ── */
.live-dot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 8px;
  height: 8px;
}

.live-dot::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--secondary);
  animation: livePing 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.live-dot::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--secondary);
  position: relative;
  z-index: 1;
}

.live-dot.danger::before { background: var(--danger); }
.live-dot.danger::after  { background: var(--danger); }

.live-dot.warning::before { background: var(--warning); animation-name: warnPulse; }
.live-dot.warning::after  { background: var(--warning); }
