/* =========================================================
   PRAVIN INVEST AI — Design System
   Black Luxury + Liquid Glass + AI Financial Terminal
   ========================================================= */

:root{
  --bg: #050505;
  --bg-secondary: #0A0A0A;
  --card: rgba(255,255,255,0.04);
  --glass: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --ink: #FFFFFF;
  --ink-secondary: #8B8B8B;
  --ink-muted: #555555;
  --positive: #4ADE80;
  --negative: #F87171;
  --warning: #FBBF24;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --ease-out-3: cubic-bezier(0.16, 1, 0.3, 1);
  --sidebar-w: 264px;
}

*{ box-sizing: border-box; }

html{ background: var(--bg); color-scheme: dark; scroll-behavior: smooth; }
body{ background: radial-gradient(circle at 15% 0%, rgba(255,255,255,0.035), transparent 45%), var(--bg); min-height: 100vh; }

::selection{ background: rgba(255,255,255,0.18); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar{ width: 10px; height: 10px; }
::-webkit-scrollbar-track{ background: transparent; }
::-webkit-scrollbar-thumb{ background: rgba(255,255,255,0.12); border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover{ background: rgba(255,255,255,0.2); }

/* Focus states — always visible, never suppressed */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible{
  outline: 2px solid rgba(255,255,255,0.55);
  outline-offset: 2px;
  border-radius: 6px;
}

/* =========================================================
   Text utilities
   ========================================================= */
.text-positive{ color: var(--positive); }
.text-negative{ color: var(--negative); }
.text-warning{ color: var(--warning); }
.text-muted{ color: var(--ink-muted); }
.text-secondary{ color: var(--ink-secondary); }
.num{ font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.font-mono-num{ font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }

/* =========================================================
   Glass system
   ========================================================= */
.glass-panel{
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.04);
}

.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  position: relative;
  transition: transform .45s var(--ease-out-3), border-color .35s ease, box-shadow .45s ease;
}
.card-glass{
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

/* Liquid hover — a soft radial highlight that tracks the cursor.
   --lx / --ly are set in app.js on pointermove. */
.liquid-hover{
  position: relative;
  overflow: hidden;
  --lx: 50%; --ly: 50%;
}
.liquid-hover::before{
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(320px circle at var(--lx) var(--ly), rgba(255,255,255,0.07), transparent 60%);
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
  z-index: 1;
}
.liquid-hover:hover::before{ opacity: 1; }
.liquid-hover > *{ position: relative; z-index: 2; }

.card.liquid-hover:hover, .card-glass.liquid-hover:hover{
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: 0 26px 70px rgba(0,0,0,0.42);
}

/* =========================================================
   Buttons
   ========================================================= */
.btn{
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-weight: 600; font-size: .875rem; line-height: 1;
  padding: .75rem 1.25rem; border-radius: 99px;
  border: 1px solid var(--border);
  transition: transform .25s var(--ease-out-3), background-color .25s ease, border-color .25s ease, box-shadow .25s ease;
  cursor: pointer;
  white-space: nowrap;
}
.btn svg{ width: 16px; height: 16px; transition: transform .25s var(--ease-out-3); }
.btn-primary{ background: #fff; color: #0A0A0A; border-color: #fff; }
.btn-primary:hover{ background: #eaeaea; transform: translateY(-1px); box-shadow: 0 10px 30px rgba(255,255,255,0.12); }
.btn-ghost{ background: var(--card); color: var(--ink); }
.btn-ghost:hover{ background: var(--glass); border-color: var(--border-strong); transform: translateY(-1px); }
.btn-ghost.is-active{ background: #fff; color: #0A0A0A; border-color: #fff; }
.btn-ghost:hover svg{ transform: translateX(2px); }
.btn:active{ transform: translateY(0) scale(.98); }
.btn-sm{ padding: .5rem .9rem; font-size: .8rem; }
.btn-icon{ width: 40px; height: 40px; padding: 0; border-radius: 12px; }

/* =========================================================
   Badges
   ========================================================= */
.badge{
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 600; letter-spacing: .01em;
  padding: .3rem .6rem; border-radius: 99px; border: 1px solid transparent;
  white-space: nowrap;
}
.badge-positive{ color: var(--positive); background: rgba(74,222,128,0.1); border-color: rgba(74,222,128,0.22); }
.badge-negative{ color: var(--negative); background: rgba(248,113,113,0.1); border-color: rgba(248,113,113,0.22); }
.badge-warning{ color: var(--warning); background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.22); }
.badge-neutral{ color: var(--ink-secondary); background: rgba(255,255,255,0.05); border-color: var(--border); }

.dot{ width: 6px; height: 6px; border-radius: 99px; display: inline-block; }
.dot-positive{ background: var(--positive); box-shadow: 0 0 0 3px rgba(74,222,128,0.15); }
.dot-negative{ background: var(--negative); box-shadow: 0 0 0 3px rgba(248,113,113,0.15); }
.dot-warning{ background: var(--warning); box-shadow: 0 0 0 3px rgba(251,191,36,0.15); }
.dot-pulse{ animation: pv-pulse 2.2s ease-in-out infinite; }
@keyframes pv-pulse{ 0%,100%{ opacity: 1; } 50%{ opacity: .35; } }

/* =========================================================
   Layout shell
   ========================================================= */
.pv-app{ display: flex; min-height: 100vh; }

.pv-sidebar{
  width: var(--sidebar-w); flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; padding: 18px;
  z-index: 40;
}
.pv-sidebar-inner{
  height: 100%; border-radius: var(--radius-lg);
  display: flex; flex-direction: column; padding: 20px 14px;
}
.pv-sidebar-head{ display: flex; align-items: center; justify-content: space-between; padding: 6px 10px 22px; }
.pv-logo{ display: flex; align-items: center; gap: 10px; }
.pv-logo-mark{
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(155deg, #fff, #9a9a9a);
  color: #0A0A0A; font-weight: 800; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
}
.pv-logo-text{ font-size: .78rem; font-weight: 700; letter-spacing: .08em; line-height: 1.35; }
.pv-logo-text em{ font-style: normal; color: var(--ink-secondary); font-weight: 600; letter-spacing: .1em; font-size: .72em; }

.pv-nav{ display: flex; flex-direction: column; gap: 2px; padding: 4px; flex: 1; }
.pv-nav-item{
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px;
  color: var(--ink-secondary); font-size: .875rem; font-weight: 500;
  transition: color .25s ease, background-color .3s ease;
}
.pv-nav-item:hover{ color: var(--ink); background: rgba(255,255,255,0.04); }
.pv-nav-icon{ width: 18px; height: 18px; flex-shrink: 0; transition: transform .3s var(--ease-out-3); }
.pv-nav-item:hover .pv-nav-icon{ transform: translateX(1px); }
.pv-nav-indicator{
  position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 0; border-radius: 99px; background: #fff;
  transition: height .3s var(--ease-out-3);
}
.pv-nav-item.is-active{ color: var(--ink); background: rgba(255,255,255,0.06); }
.pv-nav-item.is-active .pv-nav-indicator{ height: 18px; }

.pv-sidebar-foot{ display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); margin-top: 8px; }
.pv-user-card{ display: flex; align-items: center; gap: 10px; flex: 1; padding: 8px; border-radius: 12px; transition: background-color .25s ease; min-width: 0; }
.pv-user-card:hover{ background: rgba(255,255,255,0.04); }
.pv-avatar{ width: 34px; height: 34px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.pv-user-meta{ min-width: 0; display: flex; flex-direction: column; }
.pv-user-name{ font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-user-plan{ font-size: .7rem; color: var(--ink-muted); }
.pv-logout{ width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--ink-secondary); transition: color .25s ease, background-color .25s ease; flex-shrink: 0; }
.pv-logout svg{ width: 17px; height: 17px; }
.pv-logout:hover{ color: var(--ink); background: rgba(255,255,255,0.05); }

.pv-main{ flex: 1; min-width: 0; padding: 28px 32px 60px; }

/* Mobile top bar + drawer */
.pv-mobile-topbar{
  display: none;
  position: sticky; top: 0; z-index: 50;
  align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: rgba(5,5,5,0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}
.pv-mobile-logo{ font-size: .78rem; font-weight: 700; letter-spacing: .06em; }
.pv-mobile-logo span{ color: var(--ink-secondary); display: block; font-size: .62rem; letter-spacing: .1em; }
.pv-icon-btn{ width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--ink); background: var(--card); border: 1px solid var(--border); transition: background-color .25s ease; }
.pv-icon-btn svg{ width: 19px; height: 19px; }
.pv-icon-btn:hover{ background: var(--glass); }

.pv-drawer-backdrop{ position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(3px); z-index: 45; opacity: 0; transition: opacity .3s ease; }
.pv-drawer-backdrop.is-visible{ opacity: 1; }

@media (max-width: 1023px){
  .pv-mobile-topbar{ display: flex; }
  .pv-sidebar{
    position: fixed; top: 0; left: 0; height: 100dvh;
    transform: translateX(-100%);
    transition: transform .4s var(--ease-out-3);
    z-index: 50; padding: 12px;
  }
  .pv-sidebar.is-open{ transform: translateX(0); }
  .pv-main{ padding: 20px 16px 48px; }
}

/* =========================================================
   Header block (page greeting + search/notif/profile)
   ========================================================= */
.pv-page-header{ display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; justify-content: space-between; margin-bottom: 26px; }
.pv-greeting{ font-size: clamp(1.4rem, 2vw, 1.85rem); font-weight: 700; letter-spacing: -0.01em; }
.pv-subtitle{ color: var(--ink-secondary); font-size: .92rem; margin-top: 4px; }

.pv-header-actions{ display: flex; align-items: center; gap: 10px; }
.pv-search{
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 99px;
  padding: 9px 16px; min-width: 220px; color: var(--ink-secondary);
  transition: border-color .25s ease, background-color .25s ease;
}
.pv-search:focus-within{ border-color: var(--border-strong); background: var(--glass); }
.pv-search input{ background: transparent; border: none; outline: none; color: var(--ink); font-size: .85rem; width: 100%; }
.pv-search input::placeholder{ color: var(--ink-muted); }
.pv-search svg{ width: 16px; height: 16px; flex-shrink: 0; }

.pv-notif-btn{ position: relative; }
.pv-notif-dot{ position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 99px; background: var(--negative); box-shadow: 0 0 0 2px var(--bg); }

/* =========================================================
   Stat cards
   ========================================================= */
.stat-card{ padding: 22px; }
.stat-label{ font-size: .78rem; color: var(--ink-secondary); font-weight: 500; }
.stat-value{ font-size: 1.65rem; font-weight: 700; margin-top: 10px; letter-spacing: -0.01em; }
.stat-sub{ font-size: .8rem; margin-top: 6px; display: flex; align-items: center; gap: 6px; }

/* =========================================================
   Section titles
   ========================================================= */
.pv-section-title{ font-size: 1.02rem; font-weight: 700; }
.pv-section-sub{ font-size: .8rem; color: var(--ink-secondary); margin-top: 2px; }

/* =========================================================
   Time filter pills (chart range selectors)
   ========================================================= */
.pv-range-group{ display: inline-flex; background: var(--card); border: 1px solid var(--border); border-radius: 99px; padding: 3px; gap: 2px; }
.pv-range-btn{ font-size: .76rem; font-weight: 600; padding: 6px 12px; border-radius: 99px; color: var(--ink-secondary); transition: color .25s ease, background-color .3s ease; }
.pv-range-btn:hover{ color: var(--ink); }
.pv-range-btn.is-active{ color: #0A0A0A; background: #fff; }

/* =========================================================
   AI insight / analysis panels
   ========================================================= */
.pv-ai-card{ padding: 24px; position: relative; overflow: hidden; }
.pv-ai-card::after{
  content: ""; position: absolute; top: -40%; right: -20%; width: 60%; height: 160%;
  background: radial-gradient(circle, rgba(255,255,255,0.05), transparent 65%);
  pointer-events: none;
}
.pv-ai-tag{ display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700; letter-spacing: .04em; color: var(--ink-secondary); }
.pv-ai-tag svg{ width: 13px; height: 13px; }

/* =========================================================
   AI score ring
   ========================================================= */
.pv-score-ring{ position: relative; width: 128px; height: 128px; flex-shrink: 0; }
.pv-score-ring svg{ transform: rotate(-90deg); width: 100%; height: 100%; }
.pv-score-ring circle{ fill: none; stroke-width: 8; }
.pv-score-ring .track{ stroke: rgba(255,255,255,0.06); }
.pv-score-ring .fill{ stroke: #fff; stroke-linecap: round; transition: stroke-dashoffset 1.1s var(--ease-out-3); }
.pv-score-ring-label{ position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pv-score-ring-num{ font-size: 1.6rem; font-weight: 800; line-height: 1; }
.pv-score-ring-max{ font-size: .68rem; color: var(--ink-muted); margin-top: 2px; }

/* Sub-score bars */
.pv-subscore-row{ display: flex; align-items: center; gap: 12px; font-size: .8rem; }
.pv-subscore-row .label{ width: 92px; color: var(--ink-secondary); flex-shrink: 0; }
.pv-subscore-track{ flex: 1; height: 6px; border-radius: 99px; background: rgba(255,255,255,0.06); overflow: hidden; }
.pv-subscore-fill{ height: 100%; border-radius: 99px; background: #fff; width: 0; transition: width 1s var(--ease-out-3); }
.pv-subscore-row .val{ width: 30px; text-align: right; font-weight: 600; flex-shrink: 0; }

/* =========================================================
   Tables → responsive cards on mobile
   ========================================================= */
.pv-table-wrap{ overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pv-table{ width: 100%; border-collapse: separate; border-spacing: 0; min-width: 640px; }
.pv-table th{ text-align: left; font-size: .72rem; font-weight: 600; color: var(--ink-secondary); text-transform: none; padding: 0 16px 12px; letter-spacing: .01em; }
.pv-table td{ padding: 14px 16px; border-top: 1px solid var(--border); font-size: .86rem; }
.pv-table tr td:first-child, .pv-table th:first-child{ padding-left: 20px; }
.pv-table tr td:last-child, .pv-table th:last-child{ padding-right: 20px; }
.pv-table tbody tr{ transition: background-color .25s ease; }
.pv-table tbody tr:hover{ background: rgba(255,255,255,0.025); }

@media (max-width: 767px){
  .pv-table-wrap.pv-table-stack table,
  .pv-table-wrap.pv-table-stack thead,
  .pv-table-wrap.pv-table-stack tbody,
  .pv-table-wrap.pv-table-stack th,
  .pv-table-wrap.pv-table-stack td,
  .pv-table-wrap.pv-table-stack tr{ display: block; min-width: 0; }
  .pv-table-wrap.pv-table-stack thead{ display: none; }
  .pv-table-wrap.pv-table-stack tr{ border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 12px; padding: 14px 16px; background: var(--card); }
  .pv-table-wrap.pv-table-stack td{ border-top: none; padding: 6px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .pv-table-wrap.pv-table-stack td::before{ content: attr(data-label); color: var(--ink-secondary); font-size: .74rem; font-weight: 500; }
}

/* =========================================================
   Forms
   ========================================================= */
.pv-field{ display: flex; flex-direction: column; gap: 6px; }
.pv-label{ font-size: .8rem; font-weight: 500; color: var(--ink-secondary); }
.pv-input, .pv-select{
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; color: var(--ink); font-size: .88rem; outline: none;
  transition: border-color .25s ease, background-color .25s ease;
  width: 100%;
}
.pv-input::placeholder{ color: var(--ink-muted); }
.pv-input:focus, .pv-select:focus{ border-color: var(--border-strong); background: var(--glass); }
.pv-checkbox-row{ display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--ink-secondary); }
.pv-checkbox-row input{ accent-color: #fff; width: 15px; height: 15px; }

/* =========================================================
   Modal
   ========================================================= */
.pv-modal-backdrop{ position: fixed; inset: 0; background: rgba(0,0,0,0.66); backdrop-filter: blur(4px); z-index: 70; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; }
.pv-modal{ width: 100%; max-width: 480px; border-radius: var(--radius-lg); padding: 26px; opacity: 0; transform: translateY(16px) scale(.97); }

/* =========================================================
   Dropdown (search results / global search)
   ========================================================= */
.pv-dropdown{ position: absolute; top: calc(100% + 10px); left: 0; right: 0; border-radius: var(--radius-md); padding: 8px; z-index: 60; transform-origin: top; opacity: 0; }
.pv-dropdown-item{ display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; transition: background-color .2s ease; }
.pv-dropdown-item:hover, .pv-dropdown-item:focus-visible{ background: rgba(255,255,255,0.06); }

/* =========================================================
   Skeleton loaders
   ========================================================= */
.pv-skel{ position: relative; overflow: hidden; background: rgba(255,255,255,0.045); border-radius: 10px; }
.pv-skel::after{
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  animation: pv-shimmer 1.8s ease-in-out infinite;
}
@keyframes pv-shimmer{ 100%{ transform: translateX(100%); } }

/* =========================================================
   Empty / error states
   ========================================================= */
.pv-empty{ text-align: center; padding: 56px 24px; }
.pv-empty-icon{ width: 52px; height: 52px; margin: 0 auto 18px; color: var(--ink-muted); }
.pv-empty-title{ font-weight: 700; font-size: .98rem; }
.pv-empty-sub{ color: var(--ink-secondary); font-size: .85rem; margin-top: 6px; max-width: 340px; margin-inline: auto; }

/* =========================================================
   Sparkline containers
   ========================================================= */
.pv-spark{ width: 100%; height: 36px; }

/* =========================================================
   Chat (AI assistant)
   ========================================================= */
.pv-chat-scroll{ overflow-y: auto; }
.pv-msg{ max-width: 78%; padding: 13px 16px; border-radius: 16px; font-size: .875rem; line-height: 1.55; }
.pv-msg-ai{ background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.pv-msg-user{ background: #fff; color: #0A0A0A; border-bottom-right-radius: 4px; margin-left: auto; }
.pv-typing{ display: inline-flex; gap: 4px; padding: 4px 0; }
.pv-typing span{ width: 6px; height: 6px; border-radius: 99px; background: var(--ink-secondary); animation: pv-typing 1.1s ease-in-out infinite; }
.pv-typing span:nth-child(2){ animation-delay: .15s; }
.pv-typing span:nth-child(3){ animation-delay: .3s; }
@keyframes pv-typing{ 0%,60%,100%{ transform: translateY(0); opacity: .4; } 30%{ transform: translateY(-4px); opacity: 1; } }

/* =========================================================
   Custom cursor (desktop only)
   ========================================================= */
.pv-cursor{
  position: fixed; top: 0; left: 0; width: 22px; height: 22px; border-radius: 99px;
  border: 1px solid rgba(255,255,255,0.5); pointer-events: none; z-index: 9999;
  transform: translate(-50%, -50%); transition: width .25s var(--ease-out-3), height .25s var(--ease-out-3), background-color .25s ease, border-color .25s ease;
  mix-blend-mode: difference;
  display: none;
}
@media (hover: hover) and (pointer: fine){ .pv-cursor.is-active{ display: block; } }
.pv-cursor.is-hover{ width: 40px; height: 40px; background: rgba(255,255,255,0.12); }

/* =========================================================
   Login page
   ========================================================= */
.pv-auth-wrap{ min-height: 100dvh; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; padding: 24px; }
.pv-orb{ position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; pointer-events: none; }
.pv-orb-1{ width: 620px; height: 620px; background: radial-gradient(circle, rgba(255,255,255,0.10), transparent 70%); top: -180px; left: -160px; }
.pv-orb-2{ width: 520px; height: 520px; background: radial-gradient(circle, rgba(255,255,255,0.06), transparent 70%); bottom: -200px; right: -140px; }
.pv-auth-card{ position: relative; z-index: 2; width: 100%; max-width: 400px; padding: 36px 32px; border-radius: 24px; }

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

/* Utility */
.no-scrollbar::-webkit-scrollbar{ display: none; }
.no-scrollbar{ -ms-overflow-style: none; scrollbar-width: none; }
