/* ==========================================================================
   HisaZangu — Theme Foundation
   Dark premium financial theme with navy-black backgrounds & gold accents
   ========================================================================== */

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

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
  /* ---- Backgrounds ---- */
  --bg-primary:       #0B0F1A;
  --bg-card:          #111827;
  --bg-card-rgb:      17, 24, 39;
  --bg-hover:         #1A2236;
  --bg-elevated:      #1E2A3E;
  --bg-input:         #0F1729;
  --bg-overlay:       rgba(11, 15, 26, 0.85);

  /* ---- Accent / Brand ---- */
  --gold:             #F59E0B;
  --gold-hover:       #D97706;
  --gold-light:       #FBBF24;
  --gold-rgb:         245, 158, 11;
  --blue:             #3B82F6;
  --blue-hover:       #2563EB;
  --blue-light:       #60A5FA;
  --blue-rgb:         59, 130, 246;

  /* ---- Semantic ---- */
  --green:            #10B981;
  --green-light:      #34D399;
  --green-dark:       #059669;
  --green-rgb:        16, 185, 129;
  --red:              #EF4444;
  --red-light:        #F87171;
  --red-dark:         #DC2626;
  --red-rgb:          239, 68, 68;

  /* ---- Text ---- */
  --text-primary:     #F9FAFB;
  --text-secondary:   #9CA3AF;
  --text-tertiary:    #6B7280;
  --text-muted:       #6B7280;

  /* ---- Borders ---- */
  --border-default:   rgba(255, 255, 255, 0.06);
  --border-hover:     rgba(255, 255, 255, 0.12);
  --border-active:    rgba(245, 158, 11, 0.4);
  --border-radius-sm: 6px;
  --border-radius:    10px;
  --border-radius-lg: 16px;
  --border-radius-xl: 24px;
  --border-radius-full: 9999px;

  /* ---- Shadows ---- */
  --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow:       0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg:    0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-xl:    0 20px 50px rgba(0, 0, 0, 0.6);
  --shadow-gold:  0 4px 20px rgba(245, 158, 11, 0.25);
  --shadow-glow:  0 0 30px rgba(245, 158, 11, 0.15);

  /* ---- Glassmorphism ---- */
  --glass-bg:         rgba(17, 24, 39, 0.6);
  --glass-border:     rgba(255, 255, 255, 0.08);
  --glass-blur:       16px;

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

  --text-xs:   0.75rem;    /* 12px */
  --text-sm:   0.875rem;   /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg:   1.125rem;   /* 18px */
  --text-xl:   1.25rem;    /* 20px */
  --text-2xl:  1.5rem;     /* 24px */
  --text-3xl:  1.875rem;   /* 30px */
  --text-4xl:  2.25rem;    /* 36px */
  --text-5xl:  3rem;       /* 48px */
  --text-6xl:  3.75rem;    /* 60px */

  --leading-tight:  1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;

  /* ---- Spacing ---- */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* ---- Transitions ---- */
  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:  cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast:   150ms;
  --duration:        250ms;
  --duration-slow:   400ms;

  /* ---- Z-Index layers ---- */
  --z-dropdown:  100;
  --z-sticky:    200;
  --z-fixed:     300;
  --z-overlay:   400;
  --z-modal:     500;
  --z-toast:     600;
  --z-tooltip:   700;

  /* ---- Container ---- */
  --container-max: 1280px;
  --container-padding: var(--space-6);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-size: 16px;
  tab-size: 4;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Selection */
::selection {
  background: rgba(245, 158, 11, 0.3);
  color: var(--text-primary);
}

::-moz-selection {
  background: rgba(245, 158, 11, 0.3);
  color: var(--text-primary);
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* --------------------------------------------------------------------------
   Scrollbar Styling
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: var(--border-radius-full);
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-hover) var(--bg-primary);
}

/* --------------------------------------------------------------------------
   Base Elements
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

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

a {
  color: var(--blue);
  text-decoration: none;
  transition: color var(--duration) var(--ease-out);
}

a:hover {
  color: var(--blue-light);
}

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

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Financial number styling */
.tabular-nums,
.financial-number,
[data-financial] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  letter-spacing: 0.01em;
}

/* --------------------------------------------------------------------------
   Utility: Container
   -------------------------------------------------------------------------- */
.container-hisa {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

/* --------------------------------------------------------------------------
   Utility: Glassmorphism
   -------------------------------------------------------------------------- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
}

.glass-strong {
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-subtle {
  background: rgba(17, 24, 39, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* --------------------------------------------------------------------------
   Utility: Text Colors
   -------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------
   Utility: Font Weights
   -------------------------------------------------------------------------- */
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fw-900 { font-weight: 900; }

.text-gold      { color: var(--gold); }
.text-green     { color: var(--green); }
.text-red       { color: var(--red); }
.text-blue      { color: var(--blue); }
.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Utility: Background helpers
   -------------------------------------------------------------------------- */
.bg-primary   { background-color: var(--bg-primary); }
.bg-card      { background-color: var(--bg-card); }
.bg-hover     { background-color: var(--bg-hover); }
.bg-elevated  { background-color: var(--bg-elevated); }

/* --------------------------------------------------------------------------
   Keyframe Animations
   -------------------------------------------------------------------------- */

/* Fade in from below */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide in from right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide in from left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade in */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Scale up */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Pulse glow for gold CTA */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow:
      0 0 8px rgba(245, 158, 11, 0.3),
      0 0 20px rgba(245, 158, 11, 0.1);
  }
  50% {
    box-shadow:
      0 0 16px rgba(245, 158, 11, 0.5),
      0 0 40px rgba(245, 158, 11, 0.2);
  }
}

/* Ticker horizontal scroll */
@keyframes ticker-scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* Gentle float */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* Shimmer loading */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

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

/* Dot pulse (loading) */
@keyframes dot-pulse {
  0%, 80%, 100% {
    opacity: 0;
    transform: scale(0.6);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Count up number */
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   Animation Utility Classes
   -------------------------------------------------------------------------- */
.animate-fade-in-up {
  animation: fadeInUp 0.6s var(--ease-out) both;
}

.animate-slide-in-right {
  animation: slideInRight 0.5s var(--ease-out) both;
}

.animate-slide-in-left {
  animation: slideInLeft 0.5s var(--ease-out) both;
}

.animate-fade-in {
  animation: fadeIn 0.4s var(--ease-out) both;
}

.animate-scale-in {
  animation: scaleIn 0.4s var(--ease-spring) both;
}

.animate-float {
  animation: float 4s ease-in-out infinite;
}

.animate-pulse-glow {
  animation: pulse-glow 2.5s ease-in-out infinite;
}

/* Stagger delays for lists / grids */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }

/* --------------------------------------------------------------------------
   Shimmer Loading Placeholder
   -------------------------------------------------------------------------- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-hover) 25%,
    rgba(255, 255, 255, 0.06) 50%,
    var(--bg-hover) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--border-radius-sm);
}

/* --------------------------------------------------------------------------
   Responsive Typography Scale
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --text-5xl: 2.25rem;
    --text-4xl: 1.875rem;
    --text-3xl: 1.5rem;
    --text-2xl: 1.25rem;
  }

  html {
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  :root {
    --text-5xl: 1.875rem;
    --text-4xl: 1.5rem;
    --text-3xl: 1.25rem;
    --text-2xl: 1.125rem;
    --container-padding: var(--space-4);
  }

  html {
    font-size: 14px;
  }
}

/* --------------------------------------------------------------------------
   Bootstrap 5 Dark Theme Overrides
   Bootstrap loads first with light defaults — override all conflicting vars.
   -------------------------------------------------------------------------- */
:root {
  --bs-body-color:          var(--text-primary);
  --bs-body-bg:             var(--bg-primary);
  --bs-secondary-color:     var(--text-secondary);
  --bs-tertiary-color:      var(--text-tertiary);
  --bs-emphasis-color:      var(--text-primary);
  --bs-border-color:        var(--border-default);

  /* Tables */
  --bs-table-bg:            transparent;
  --bs-table-color:         var(--text-primary);
  --bs-table-striped-bg:    rgba(255, 255, 255, 0.02);
  --bs-table-striped-color: var(--text-primary);
  --bs-table-hover-bg:      var(--bg-hover);
  --bs-table-hover-color:   var(--text-primary);
  --bs-table-active-bg:     var(--bg-hover);
  --bs-table-active-color:  var(--text-primary);
  --bs-table-border-color:  var(--border-default);

  /* Cards */
  --bs-card-bg:             var(--bg-card);
  --bs-card-color:          var(--text-primary);
  --bs-card-border-color:   var(--border-default);
  --bs-card-cap-bg:         var(--bg-hover);

  /* Links */
  --bs-link-color:          var(--blue);
  --bs-link-hover-color:    var(--blue-light);
}

/* Force Bootstrap's .text-muted to use our value */
.text-muted {
  color: var(--text-muted) !important;
}

/* Ensure Bootstrap tables are fully dark */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-primary);
  --bs-table-border-color: var(--border-default);
  color: var(--text-primary);
}

.table > :not(caption) > * > * {
  background-color: transparent;
  color: var(--text-primary);
  border-bottom-color: var(--border-default);
  box-shadow: none;
}

.table thead th {
  color: var(--text-secondary);
  background: var(--bg-hover);
}

/* Bootstrap modal dark overrides */
.modal-content {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.modal-header {
  border-bottom-color: var(--border-default);
}

.modal-footer {
  border-top-color: var(--border-default);
}

.btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* --------------------------------------------------------------------------
   Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
