@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body, #root {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #06080d;
  color: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}

button { font-family: inherit; }
input { font-family: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

.app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  background:
    radial-gradient(ellipse 800px 400px at 20% 0%, rgba(91, 240, 194, 0.06), transparent 60%),
    radial-gradient(ellipse 600px 400px at 100% 100%, rgba(167, 139, 250, 0.05), transparent 60%),
    #06080d;
  position: relative;
}

.app-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.scroll-area {
  flex: 1;
  overflow-y: auto;
}

.px-card:hover {
  border-color: rgba(255,255,255,0.1) !important;
}

@keyframes pip-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes activity-slide-in {
  from { opacity: 0; transform: translateY(-10px) scaleY(0.92); }
  to   { opacity: 1; transform: translateY(0)     scaleY(1);    }
}

.page-fade {
  animation: fade-in .25s ease-out;
}

input::placeholder { color: var(--t4); }

@media (max-width: 767px) {
  html, body, #root { overflow: hidden; }

  .app-shell { flex-direction: column; }

  .scroll-area {
    -webkit-overflow-scrolling: touch;
    /* Reserve space for fixed bottom nav + browser chrome / safe area */
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 16px));
  }

  /* Bottom nav stretches into the safe area so its background covers the gap */
  nav[style*="position: fixed"][style*="bottom"] {
    height: calc(60px + env(safe-area-inset-bottom, 0px)) !important;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    align-items: flex-start !important;
  }

  .px-card { min-width: 0; }
}

:root {
  --bg-base: #06080d;
  --bg-surface: rgba(8,11,18,0.6);
  --text-primary: rgba(255,255,255,0.92);
  --text-secondary: rgba(255,255,255,0.5);
  --text-muted: rgba(255,255,255,0.28);
  --border-color: rgba(255,255,255,0.06);

  /* Theme-aware color tokens used as inline style values */
  --t1: rgba(255,255,255,0.92);   /* primary text */
  --t2: rgba(255,255,255,0.65);   /* secondary text */
  --t3: rgba(255,255,255,0.45);   /* muted text / icons */
  --t4: rgba(255,255,255,0.30);   /* very muted */
  --t5: rgba(255,255,255,0.18);   /* disabled / ghost */
  --ui1: rgba(255,255,255,0.10);  /* borders, button bg */
  --ui2: rgba(255,255,255,0.06);  /* subtle borders/bg */
  --ui3: rgba(255,255,255,0.03);  /* very subtle bg */
}

[data-theme="light"] {
  --bg-base: #f0f2f7;
  --bg-surface: rgba(255,255,255,0.85);
  --text-primary: rgba(12,14,22,0.92);
  --text-secondary: rgba(12,14,22,0.55);
  --text-muted: rgba(12,14,22,0.35);
  --border-color: rgba(0,0,0,0.09);

  --t1: rgba(12,14,22,0.92);
  --t2: rgba(12,14,22,0.60);
  --t3: rgba(12,14,22,0.46);
  --t4: rgba(12,14,22,0.32);
  --t5: rgba(12,14,22,0.20);
  --ui1: rgba(0,0,0,0.09);
  --ui2: rgba(0,0,0,0.06);
  --ui3: rgba(0,0,0,0.03);
}

[data-theme="light"] body {
  background: var(--bg-base);
  color: var(--text-primary);
}

[data-theme="light"] .app-shell {
  background: var(--bg-base) !important;
}

[data-theme="light"] .px-card {
  background: rgba(255,255,255,0.82) !important;
  border-color: rgba(0,0,0,0.08) !important;
}

[data-theme="light"] aside,
[data-theme="light"] header {
  background: rgba(255,255,255,0.9) !important;
  border-color: rgba(0,0,0,0.08) !important;
}

[data-theme="light"] nav {
  background: rgba(255,255,255,0.97) !important;
  border-color: rgba(0,0,0,0.1) !important;
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: rgba(0,0,0,0.05) !important;
  border-color: rgba(0,0,0,0.12) !important;
  color: rgba(12,14,22,0.92) !important;
}

[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder {
  color: rgba(12,14,22,0.35) !important;
}

[data-theme="light"] button {
  color: inherit;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15) !important;
}

.compact .px-card {

}

.focus-mode aside { display: none !important; }
.focus-mode nav[style*="position: fixed"] { display: none !important; }

.px-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.px-modal {
  background: #0d1117;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

[data-theme="light"] .px-modal {
  background: #ffffff;
  border-color: rgba(0,0,0,0.1);
}

[data-theme="light"] .px-modal-overlay {
  background: rgba(0,0,0,0.3);
}

.px-tooltip { position: relative; }

.px-tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1f2e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11px;
  white-space: nowrap;
  color: rgba(255,255,255,0.85);
  z-index: 500;
  transition: opacity .15s;
  pointer-events: none;
  font-family: 'Inter', sans-serif;
}

.px-tooltip:hover .px-tooltip-text {
  visibility: visible;
  opacity: 1;
}

[data-theme="light"] .px-tooltip-text {
  background: #2d3748;
  color: white;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #F87171;
  font-size: 9px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #06080d;
}

[data-theme="light"] .notif-badge {
  border-color: #f0f2f7;
}

.px-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  border: 1px solid;
}

@keyframes px-pop-in {
  from { opacity: 0; transform: scale(0.94) translateY(-8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

.px-pop-in { animation: px-pop-in .2s cubic-bezier(.2,.8,.3,1) both; }

@keyframes px-shimmer {
  0%,100% { opacity: .4; }
  50%      { opacity: .9; }
}

@keyframes slide-in-right {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.notif-panel {
  animation: slide-in-right .22s cubic-bezier(.2,.8,.3,1) both;
}
