/**
 * MuCASH Production Custom Styles
 * High Performance Black, Red, Blue Trading Terminal Architecture
 * Pure Indian Financial Markets (NSE, BSE, F&O, MCX)
 */

@import url('mucash.css');

:root {
  --bg-dark: #07070a;
  --surface-dark: #0f131d;
  --surface-dark-2: #151b28;
  --surface-dark-3: #1b2334;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(59, 130, 246, 0.35);
  
  --brand-violet: #3b82f6; /* Transformed to Trading Electric Blue */
  --brand-violet-hover: #2563eb;
  --brand-violet-glow: rgba(59, 130, 246, 0.25);
  
  --up-green: #38bdf8;
  --up-green-bright: #60a5fa;
  --down-red: #ef4444;
  --down-red-bright: #f87171;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --text-zinc-200: #e2e8f0;
  --text-zinc-300: #cbd5e1;
  --text-zinc-400: #94a3b8;
  --text-zinc-500: #64748b;
}

html.light {
  --bg-dark: #f8fafc;
  --surface-dark: #ffffff;
  --surface-dark-2: #f1f5f9;
  --surface-dark-3: #e2e8f0;
  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-medium: rgba(15, 23, 42, 0.15);
  --border-strong: rgba(37, 99, 235, 0.4);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --text-zinc-200: #1e293b;
  --text-zinc-300: #334155;
  --text-zinc-400: #475569;
  --text-zinc-500: #64748b;
  --brand-violet: #2563eb;
  --brand-violet-hover: #1d4ed8;
  --brand-violet-glow: rgba(37, 99, 235, 0.15);
  --up-green: #0284c7;
  --down-red: #dc2626;
}

/* Global Reset & Base */
body {
  background-color: var(--bg-dark) !important;
  color: var(--text-main) !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

/* Container */
.ty-wrap, .mc-wrap {
  width: 100%;
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* Header & Navigation Bar (Always Visible) */
.ty-header {
  height: 60px;
}
.mc-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface-dark);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  height: auto;
}

.ty-header .ty-wrap, .mc-header .mc-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 16px;
}

.ty-brand, .mc-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main) !important;
  text-decoration: none !important;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.ty-nav, .mc-nav {
  display: flex !important;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.ty-nav::-webkit-scrollbar, .mc-nav::-webkit-scrollbar {
  display: none;
}

.nav-link, .mc-nav-link {
  color: var(--text-muted) !important;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none !important;
  padding: 6px 11px;
  border-radius: 8px;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.nav-link:hover, .mc-nav-link:hover {
  color: var(--text-main) !important;
  background: var(--surface-dark-2) !important;
}

.nav-link.active, .mc-nav-link.active {
  color: #ffffff !important;
  background: #3b82f6 !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* Button & Controls */
.btn-broker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa !important;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-broker:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: #3b82f6;
  color: #fff !important;
}

.btn-broker.connected {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399 !important;
}

/* Real-Time Ticker Bar */
.ticker-bar {
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  padding: 6px 0;
  overflow-x: auto;
  white-space: nowrap;
}

.mc-ticker-bar {
  overflow: hidden !important;
  width: 100% !important;
}

.mc-ticker-wrap {
  overflow: hidden !important;
  width: 100% !important;
  display: flex !important;
}

.mc-ticker-track {
  display: inline-flex !important;
  align-items: center !important;
  white-space: nowrap !important;
  width: max-content !important;
  animation: mcTickerMarquee 42s linear infinite !important;
  will-change: transform;
}

.mc-ticker-track:hover {
  animation-play-state: paused !important;
}

.ticker-item, .mc-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 22px;
  font-weight: 500;
}

/* Fixed Card Hierarchy - Never Overlay */
.card, .mc-card {
  position: relative !important;
  isolation: isolate;
  background-color: var(--surface-dark) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 16px;
  box-sizing: border-box;
}

.card:hover, .mc-card:hover {
  border-color: var(--border-medium) !important;
}

/* Layout Utilities */
.flex { display: flex !important; }
.inline-flex { display: inline-flex !important; }
.flex-col { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.items-center { align-items: center !important; }
.items-start { align-items: flex-start !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }
.gap-1 { gap: 4px !important; }
.gap-1\.5 { gap: 6px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.gap-4 { gap: 16px !important; }
.gap-5 { gap: 20px !important; }
.gap-6 { gap: 24px !important; }
.gap-8 { gap: 32px !important; }

/* Grid System */
.grid { display: grid !important; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }

@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .sm\:flex-row { flex-direction: row !important; }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .md\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
  .md\:flex-row { flex-direction: row !important; }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
  .lg\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
  .lg\:col-span-2 { grid-column: span 2 / span 2 !important; }
}

/* Spacing & Padding */
.space-y-1 > :not([hidden]) ~ :not([hidden]) { margin-top: 4px !important; }
.space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: 8px !important; }
.space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: 12px !important; }
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 16px !important; }
.space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 24px !important; }
.space-y-8 > :not([hidden]) ~ :not([hidden]) { margin-top: 32px !important; }

.p-2 { padding: 8px !important; }
.p-3 { padding: 12px !important; }
.p-4 { padding: 16px !important; }
.p-5 { padding: 20px !important; }
.p-6 { padding: 24px !important; }
.p-8 { padding: 32px !important; }

.py-1 { padding-top: 4px !important; padding-bottom: 4px !important; }
.py-1\.5 { padding-top: 6px !important; padding-bottom: 6px !important; }
.py-2 { padding-top: 8px !important; padding-bottom: 8px !important; }
.py-2\.5 { padding-top: 10px !important; padding-bottom: 10px !important; }
.py-3 { padding-top: 12px !important; padding-bottom: 12px !important; }
.py-4 { padding-top: 16px !important; padding-bottom: 16px !important; }
.py-6 { padding-top: 24px !important; padding-bottom: 24px !important; }
.py-8 { padding-top: 32px !important; padding-bottom: 32px !important; }

.px-2 { padding-left: 8px !important; padding-right: 8px !important; }
.px-2\.5 { padding-left: 10px !important; padding-right: 10px !important; }
.px-3 { padding-left: 12px !important; padding-right: 12px !important; }
.px-4 { padding-left: 16px !important; padding-right: 16px !important; }
.px-5 { padding-left: 20px !important; padding-right: 20px !important; }
.px-6 { padding-left: 24px !important; padding-right: 24px !important; }

/* Colors & Highlights */
.bg-surface { background-color: var(--surface-dark) !important; }
.bg-surface-2 { background-color: var(--surface-dark-2) !important; }
.bg-surface-3 { background-color: var(--surface-dark-3) !important; }

.text-white { color: var(--text-main) !important; }
.text-zinc-200 { color: var(--text-zinc-200) !important; }
.text-zinc-300 { color: var(--text-zinc-300) !important; }
.text-zinc-400 { color: var(--text-zinc-400) !important; }
.text-zinc-500 { color: var(--text-zinc-500) !important; }

.text-emerald-400, .c-up { color: #38bdf8 !important; } /* Blue/cyan bull indicator */
.text-rose-400, .c-dn { color: #ef4444 !important; } /* Red bear indicator */
.text-blue-400 { color: #60a5fa !important; }
.text-amber-400 { color: #fbbf24 !important; }

html.light .c-up,
html.light .text-emerald-400 {
  color: #0284c7 !important;
}
html.light .c-dn,
html.light .text-rose-400 {
  color: #dc2626 !important;
}
html.light .text-blue-400 {
  color: #1d4ed8 !important;
}
html.light .text-amber-400 {
  color: #b45309 !important;
}

.bg-violet-600, .bg-blue-600 { background-color: #3b82f6 !important; }
.bg-violet-600:hover, .bg-blue-600:hover { background-color: #2563eb !important; }

/* Border Radius */
.rounded-lg { border-radius: 8px !important; }
.rounded-xl { border-radius: 12px !important; }
.rounded-2xl { border-radius: 16px !important; }
.rounded-3xl { border-radius: 24px !important; }
.rounded-full { border-radius: 9999px !important; }

.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important; }
.font-sans { font-family: system-ui, -apple-system, sans-serif !important; }

/* Table Reset */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 10px 14px;
}

tbody tr:hover {
  background: var(--surface-dark-2) !important;
}

.hidden { display: none !important; }
