/* ============================================================
   SmartInvest AI - Global Styles
   ============================================================ */

:root {
  --primary: #ffc107;
  --dark-bg: #0a0e1a;
  --card-bg: rgba(255,255,255,0.04);
  --border-color: rgba(255,255,255,0.1);
  --green: #4caf50;
  --red: #f44336;
  --text-muted: #888;
}

* { box-sizing: border-box; }

body {
  background-color: var(--dark-bg);
  color: #e0e0e0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
}

/* ---- Gradient Text ---- */
.text-gradient {
  background: linear-gradient(135deg, #ffc107, #ff5722);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---- Navbar ---- */
.navbar-brand { font-size: 1.2rem; }

.ticker-scroll {
  white-space: nowrap;
  overflow: hidden;
}

.ticker-item {
  font-size: 0.8rem;
  color: #aaa;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
}

.ticker-item .price { font-weight: bold; color: #fff; }
.ticker-item.up .price { color: #4caf50; }
.ticker-item.down .price { color: #f44336; }

/* ---- Avatar ---- */
.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.85rem;
}

/* ---- Cards ---- */
.card {
  background: var(--card-bg);
  border-color: var(--border-color) !important;
  border-radius: 12px;
}

.card-header {
  border-radius: 12px 12px 0 0 !important;
}

/* ---- Tables ---- */
.table-dark {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255,255,255,0.02);
  --bs-table-hover-bg: rgba(255,255,255,0.05);
}

.table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  font-weight: 600;
  border-color: rgba(255,255,255,0.1) !important;
}

.table td {
  border-color: rgba(255,255,255,0.05) !important;
  vertical-align: middle;
}

/* ---- Buttons ---- */
.btn-xs {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.btn-warning { color: #000 !important; }
.btn-warning:hover { background: #e0a800; border-color: #d39e00; }

/* ---- Forms ---- */
.form-control:focus, .form-select:focus {
  border-color: #ffc107 !important;
  box-shadow: 0 0 0 0.2rem rgba(255,193,7,0.15) !important;
}

.form-control::placeholder { color: #555; }

/* ---- Badges ---- */
.badge { font-weight: 500; letter-spacing: 0.3px; }

/* ---- Progress Bars ---- */
.progress {
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
}

/* ---- Charts ---- */
canvas { max-width: 100%; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

/* ---- Signal Colors ---- */
.signal-strong-buy  { color: #00c853; font-weight: bold; }
.signal-buy         { color: #4caf50; }
.signal-hold        { color: #ffc107; }
.signal-sell        { color: #f44336; }
.signal-strong-sell { color: #b71c1c; font-weight: bold; }

/* ---- Market ticker animation ---- */
@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ---- Hover effects ---- */
.hover-card:hover {
  transform: translateY(-2px);
  transition: transform 0.2s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

a.hover-bg-dark:hover { background: rgba(255,255,255,0.05) !important; }

/* ---- Auth pages ---- */
.auth-body {
  min-height: 100vh;
  background: linear-gradient(135deg, #0a0e1a 0%, #0d1b2a 50%, #1a0a2e 100%);
}

/* ============================================================
   SMART LOADER SYSTEM
   ============================================================ */

/* ── Top Progress Bar ── */
#si-progress {
  position: fixed; top: 0; left: 0; z-index: 99999;
  height: 3px; width: 0%;
  background: linear-gradient(90deg, #ffc107, #ff5722, #f44336, #ffc107);
  background-size: 200% 100%;
  animation: progressShimmer 1.2s linear infinite;
  transition: width 0.3s ease, opacity 0.4s ease;
  box-shadow: 0 0 10px rgba(255,193,7,.8), 0 0 20px rgba(255,87,34,.4);
}
#si-progress.done { width: 100% !important; opacity: 0; }

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

/* ── Full-screen AI Loader Overlay ── */
#si-loader {
  position: fixed; inset: 0; z-index: 99998;
  background: #0a0e1a;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#si-loader.hidden {
  opacity: 0; visibility: hidden; pointer-events: none;
}

/* Logo pulse */
.si-logo-ring {
  position: relative; width: 96px; height: 96px; margin-bottom: 28px;
}
.si-logo-ring .ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid transparent;
  animation: ringRotate 1.8s linear infinite;
}
.si-logo-ring .ring-1 {
  border-top-color: #ffc107; border-right-color: #ffc10740;
  animation-duration: 1.4s;
}
.si-logo-ring .ring-2 {
  inset: 10px;
  border-top-color: #ff5722; border-left-color: #ff572230;
  animation-duration: 2s; animation-direction: reverse;
}
.si-logo-ring .ring-3 {
  inset: 22px;
  border-top-color: #2196f3; border-bottom-color: #2196f330;
  animation-duration: 2.6s;
}
.si-logo-icon {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  animation: logoPulse 2s ease-in-out infinite;
}
@keyframes ringRotate {
  to { transform: rotate(360deg); }
}
@keyframes logoPulse {
  0%,100% { transform: scale(1);   filter: drop-shadow(0 0 6px rgba(255,193,7,.6)); }
  50%      { transform: scale(1.1); filter: drop-shadow(0 0 14px rgba(255,193,7,.9)); }
}

/* Brand text */
.si-brand { font-size: 1.5rem; font-weight: 800; letter-spacing: .02em; margin-bottom: 6px; }
.si-brand span { background: linear-gradient(135deg,#ffc107,#ff5722); -webkit-background-clip:text; -webkit-text-fill-color:transparent; }
.si-brand em    { color: #e0e0e0; font-style: normal; }

/* Status message */
.si-status {
  font-size: .82rem; color: #888;
  min-height: 1.2rem; text-align: center;
  transition: opacity .3s ease;
  margin-bottom: 22px;
}

/* Dot pulse row */
.si-dots { display: flex; gap: 8px; margin-bottom: 28px; }
.si-dots span {
  width: 8px; height: 8px; border-radius: 50%; background: #ffc107;
  animation: dotBounce 1.4s ease-in-out infinite;
  opacity: .3;
}
.si-dots span:nth-child(1) { animation-delay: 0s; }
.si-dots span:nth-child(2) { animation-delay: .2s; }
.si-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dotBounce {
  0%,80%,100% { transform: scale(.6); opacity:.3; }
  40%          { transform: scale(1);  opacity:1;  }
}

/* Mini track bar inside loader */
.si-track {
  width: 220px; height: 4px; background: rgba(255,255,255,.08);
  border-radius: 4px; overflow: hidden;
}
.si-track-fill {
  height: 100%; border-radius: 4px; width: 0%;
  background: linear-gradient(90deg,#ffc107,#ff5722);
  transition: width .25s ease;
  box-shadow: 0 0 8px rgba(255,193,7,.5);
}

/* AI modules indicator */
.si-modules {
  display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; justify-content: center;
}
.si-module {
  font-size: .65rem; color: #555; border: 1px solid #1e2a3a;
  border-radius: 6px; padding: 3px 8px; display: flex; align-items: center; gap: 4px;
  transition: color .3s, border-color .3s;
}
.si-module.active { color: #4caf50; border-color: rgba(76,175,80,.3); }
.si-module.active::before { content: '●'; font-size: .55rem; color: #4caf50; }
.si-module:not(.active)::before { content: '○'; font-size: .55rem; }

/* ── AJAX Mini Spinner ── */
#si-ajax-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 99997;
  height: 2px; background: transparent; pointer-events: none;
}
#si-ajax-bar.active {
  background: linear-gradient(90deg, transparent, #2196f3, #ffc107, #2196f3, transparent);
  background-size: 400% 100%;
  animation: ajaxSweep 1.2s linear infinite;
}
@keyframes ajaxSweep {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ── Skeleton Loaders ── */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.08) 50%, rgba(255,255,255,.04) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes skeletonShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text  { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 22px; margin-bottom: 12px; width: 60%; }
.skeleton-card  { height: 180px; }
.skeleton-row   { height: 38px; margin-bottom: 6px; }

/* ── Page transition (slide-in) ── */
.page-content { animation: pageSlideIn .35s cubic-bezier(.4,0,.2,1); }
@keyframes pageSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Loading spinner (legacy) ── */
.spinner-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .ticker-scroll { display: none !important; }
  h1, h2 { font-size: 1.5rem; }
  .card-body { padding: 0.75rem; }
}

/* ---- Landing Page ---- */
.hero-section {
  min-height: 90vh;
  background: linear-gradient(135deg, #0a0e1a 0%, #0d1b2a 60%, #1a0a2e 100%);
  display: flex; align-items: center;
  position: relative; overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255,193,7,0.05) 0%, transparent 60%),
              radial-gradient(circle at 70% 50%, rgba(33,150,243,0.05) 0%, transparent 60%);
}

.stat-box {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-box:hover {
  background: rgba(255,193,7,0.1);
  border-color: rgba(255,193,7,0.3);
  transform: translateY(-4px);
}

.feature-icon {
  width: 60px; height: 60px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 1rem;
}

/* ---- Notification dot ---- */
.notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #f44336;
  display: inline-block;
}

/* ---- Table row market status ---- */
tr.market-open { border-left: 3px solid #4caf50; }
tr.market-closed { border-left: 3px solid #666; }

/* ---- P&L coloring ---- */
.pnl-positive { color: #4caf50 !important; }
.pnl-negative { color: #f44336 !important; }

/* ---- Info tooltips ---- */
.tooltip-inner {
  background: #1a1a2e;
  border: 1px solid rgba(255,193,7,0.3);
  max-width: 300px;
  font-size: 0.8rem;
}
