/* APOGEE v2 — upgrade layer · ساخته شده توسط مبین.آ */

/* ---------- token refinements ---------- */
:root {
  --glow: rgba(255, 92, 51, 0.35);
  --glass-2: rgba(255, 255, 255, 0.045);
  --radius: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
html[data-theme="ice"] { --glow: rgba(56, 189, 248, 0.35); }
html[data-theme="ember"] { --glow: rgba(255, 107, 61, 0.4); }
html[data-theme="oled"] { --glow: rgba(255, 92, 51, 0.22); }

/* ---------- starfield behind the globe ---------- */
.stars {
  position: absolute;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1px 1px at 12% 22%, rgba(255, 255, 255, 0.7) 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 64%, rgba(255, 255, 255, 0.45) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 41% 18%, rgba(180, 220, 255, 0.8) 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 42%, rgba(255, 255, 255, 0.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 67% 78%, rgba(255, 255, 255, 0.6) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 78% 26%, rgba(255, 200, 170, 0.75) 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 58%, rgba(255, 255, 255, 0.4) 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 82%, rgba(255, 255, 255, 0.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 34% 8%, rgba(255, 255, 255, 0.55) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 62% 10%, rgba(160, 210, 255, 0.7) 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 88%, rgba(255, 255, 255, 0.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 40%, rgba(255, 255, 255, 0.35) 50%, transparent 51%);
  background-size: 100% 100%;
  animation: drift 160s linear infinite alternate;
  opacity: 0.85;
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-2%, -1.5%, 0) scale(1.06); }
}

/* ---------- glass upgrade ---------- */
.card, .rail, .drawer-card, .about-card, .stat, .meta-block, .iss-chip {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 34px rgba(0, 0, 0, 0.28);
}
.card {
  border-radius: var(--radius);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.card:hover { border-color: var(--stroke-2); }
.launch-item, .sat-item, .chip-btn, .btn, .icon-btn, .tab {
  transition:
    transform 0.18s var(--ease),
    background 0.18s var(--ease),
    border-color 0.18s var(--ease),
    color 0.18s var(--ease),
    box-shadow 0.18s var(--ease);
}
.launch-item:hover, .sat-item:hover {
  transform: translateY(-1px);
  border-color: var(--stroke-2);
  background: var(--glass-2);
}
.launch-item:active, .sat-item:active, .btn:active, .chip-btn:active, .icon-btn:active {
  transform: scale(0.97);
}
.launch-item.on {
  border-color: color-mix(in srgb, var(--flame) 55%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 10px 34px rgba(0, 0, 0, 0.3),
    0 0 0 1px color-mix(in srgb, var(--flame) 35%, transparent),
    0 0 26px var(--glow);
}
.brand .word {
  background: linear-gradient(100deg, var(--text), var(--flame-2) 65%, var(--flame));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.countdown { text-shadow: 0 0 28px var(--glow); }
.hero-card {
  overflow: hidden;
}
.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.06) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: sheen 7s var(--ease) infinite;
}
@keyframes sheen {
  0%, 60% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}

/* ---------- focus + scrollbars ---------- */
:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 2px;
  border-radius: 8px;
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.28); }

/* ---------- kbd + command button ---------- */
kbd, .kbd {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--stroke-2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}
.cmd-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px 0 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--muted);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.cmd-btn:hover { color: var(--text); border-color: var(--stroke-2); }
.cmd-btn svg { width: 16px; height: 16px; fill: currentColor; }

/* ---------- command palette ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: min(14vh, 130px) 16px 24px;
  background: rgba(4, 5, 8, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeIn 0.18s var(--ease);
}
.overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.palette {
  width: min(620px, 100%);
  border-radius: 18px;
  border: 1px solid var(--stroke-2);
  background: color-mix(in srgb, var(--bg) 82%, #12151c 18%);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04);
  overflow: hidden;
  animation: pop 0.22s var(--ease);
}
@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.palette-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--stroke);
}
.palette-input-row svg { width: 18px; height: 18px; fill: var(--muted); flex-shrink: 0; }
#palette-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}
#palette-input::placeholder { color: var(--muted); }
.palette-results {
  max-height: min(52vh, 430px);
  overflow-y: auto;
  padding: 8px;
}
.palette-group {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 10px 6px;
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: start;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
}
.palette-item .pi-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke);
  font-size: 13px;
}
.palette-item .pi-text { flex: 1; min-width: 0; }
.palette-item .pi-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.palette-item .pi-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.palette-item mark {
  background: transparent;
  color: var(--flame-2);
  font-weight: 700;
}
.palette-item.active, .palette-item:hover {
  background: color-mix(in srgb, var(--flame) 12%, transparent);
  border-color: color-mix(in srgb, var(--flame) 30%, transparent);
}
.palette-foot {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  padding: 9px 14px;
  border-top: 1px solid var(--stroke);
  color: var(--muted);
  font-size: 11px;
}
.palette-foot .sp { flex: 1; }

/* ---------- hotkeys sheet ---------- */
.hotkeys-card {
  width: min(560px, 100%);
  border-radius: 18px;
  border: 1px solid var(--stroke-2);
  background: color-mix(in srgb, var(--bg) 86%, #12151c 14%);
  box-shadow: var(--shadow);
  padding: 20px;
  animation: pop 0.22s var(--ease);
  max-height: 76vh;
  overflow-y: auto;
}
.hotkeys-card h3 {
  font-family: var(--display);
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}
.hotkey-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}
.hotkey-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
}
.hotkey-row .keys { display: flex; gap: 4px; }

/* ---------- telemetry card ---------- */
.tel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tel-name {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ice);
  letter-spacing: 0.04em;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 12px;
  margin-top: 10px;
}
.tel-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tel-k {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.tel-v {
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.tel-v em {
  font-style: normal;
  color: var(--muted);
  font-size: 10px;
}
.tel-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--go);
  box-shadow: 0 0 8px var(--go);
  animation: led 1.6s ease-in-out infinite;
}

/* ---------- reminder bell ---------- */
.remind-btn.on {
  color: var(--hold);
  border-color: var(--hold);
  box-shadow: 0 0 18px rgba(255, 204, 102, 0.22);
}
.remind-btn svg { width: 15px; height: 15px; fill: currentColor; }

/* ---------- offline banner ---------- */
.net-banner {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(12px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 204, 102, 0.35);
  background: rgba(40, 28, 8, 0.88);
  color: var(--hold);
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.net-banner.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.net-banner.ok {
  border-color: rgba(93, 255, 178, 0.35);
  background: rgba(8, 34, 22, 0.88);
  color: var(--go);
}

/* ---------- toast upgrade ---------- */
#toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  padding: 9px 18px;
  border: 1px solid var(--stroke-2);
  background: color-mix(in srgb, var(--bg) 80%, #1a1e26 20%);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ---------- status pill soft tints ---------- */
.pill.go { background: rgba(93, 255, 178, 0.12); }
.pill.hold, .pill.tbd, .pill.tbc { background: rgba(255, 204, 102, 0.12); }
.pill.failure, .pill.partial-failure { background: rgba(255, 77, 106, 0.12); }
.pill.success { background: rgba(138, 215, 255, 0.12); }
.pill.in-flight { background: rgba(255, 92, 51, 0.14); }

/* ---------- settings extras ---------- */
.set-row .btn.ghost.on { border-color: var(--ice); color: var(--ice); }

/* ---------- action bar wrap safety ---------- */
.actions { flex-wrap: wrap; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .stars, .hero-card::after, .tel-live, .live-pill .pill-dot {
    animation: none !important;
  }
  .launch-item:hover, .sat-item:hover { transform: none; }
  .overlay, .palette, .hotkeys-card { animation: none; }
}

/* ---------- small screens ---------- */
@media (max-width: 980px) {
  .cmd-btn .kbd { display: none; }
  .tel-grid { grid-template-columns: 1fr 1fr; }
  .overlay { padding-top: 10vh; }
}
