/* ============================================================
   SellPilot Platform Shell — Global Navigation Bar
   Injected via <link> into ALL sub-apps (Flask, React, etc.)
   All classes prefixed with sp- to avoid host app conflicts
   ============================================================ */

/* ── Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Variables ── */
:root {
  --sp-shell-h: 56px;
  --sp-shell-bg: #111318;
  --sp-shell-border: rgba(255, 255, 255, 0.06);
  --sp-shell-text: #7D7F8A;
  --sp-shell-text-hover: #EEEEF0;
  --sp-shell-text-active: #FFFFFF;
  --sp-shell-accent: #1D9E75;
  --sp-dd-bg: #1A1D25;
  --sp-dd-border: rgba(255, 255, 255, 0.07);
  --sp-dd-shadow: 0 16px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --sp-ebay: #E53238;
  --sp-amazon: #FF9900;
  --sp-biz: #6366F1;
  --sp-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --sp-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Body offset ── */
body.sp-shell-active {
  padding-top: var(--sp-shell-h) !important;
}

/* ── Shell bar ── */
#sp-shell {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--sp-shell-h);
  background: var(--sp-shell-bg);
  border-bottom: 1px solid var(--sp-shell-border);
  z-index: 99999;
  display: flex;
  align-items: center;
  padding: 0 24px;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', 'Pretendard Variable', 'Pretendard', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Subtle noise texture overlay */
#sp-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* ── Logo ── */
.sp-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 36px;
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
}

.sp-logo-mark {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, #1D9E75, #17856A);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: #FFF;
  letter-spacing: -0.5px;
  box-shadow: 0 2px 8px rgba(29, 158, 117, 0.3);
}

.sp-logo-text {
  font-weight: 600;
  font-size: 17px;
  color: #FFF;
  letter-spacing: -0.4px;
}

.sp-logo-text span {
  color: var(--sp-shell-accent);
}

/* ── Navigation ── */
.sp-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  height: 100%;
}

.sp-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--sp-shell-text);
  cursor: pointer;
  transition: color 0.2s var(--sp-ease-out);
  user-select: none;
  white-space: nowrap;
}

.sp-nav-item:hover {
  color: var(--sp-shell-text-hover);
}

.sp-nav-item.sp-active {
  color: var(--sp-shell-text-active);
}

/* Active indicator bar — bottom edge */
.sp-nav-item.sp-active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 16px; right: 16px;
  height: 2px;
  background: var(--sp-shell-accent);
  border-radius: 2px 2px 0 0;
}

/* Hover glow — subtle underline */
.sp-nav-item:not(.sp-active)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 16px; right: 16px;
  height: 2px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px 2px 0 0;
  transform: scaleX(0);
  transition: transform 0.25s var(--sp-ease-out);
}

.sp-nav-item:not(.sp-active):hover::after {
  transform: scaleX(1);
}

/* Chevron arrow */
.sp-chevron {
  margin-left: 5px;
  font-size: 9px;
  opacity: 0.5;
  transition: transform 0.25s var(--sp-ease-spring);
}

.sp-nav-item.sp-open .sp-chevron {
  transform: rotate(180deg);
}

/* Channel dot indicator */
.sp-channel-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 7px;
  flex-shrink: 0;
}

/* ── Dropdown ── */
.sp-dropdown {
  position: absolute;
  top: calc(var(--sp-shell-h) - 1px);
  left: 0;
  min-width: 280px;
  background: var(--sp-dd-bg);
  border: 1px solid var(--sp-dd-border);
  border-radius: 0 0 14px 14px;
  box-shadow: var(--sp-dd-shadow);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s var(--sp-ease-out),
              transform 0.25s var(--sp-ease-spring),
              visibility 0.2s;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.sp-dropdown.sp-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Channel accent stripe at top */
.sp-dropdown-accent {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

/* ── Dropdown items ── */
.sp-dd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s, transform 0.15s var(--sp-ease-out);
}

.sp-dd-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sp-dd-item:active {
  transform: scale(0.98);
}

.sp-dd-item.sp-soon {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.sp-dd-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sp-dd-info {
  flex: 1;
  min-width: 0;
}

.sp-dd-name {
  font-size: 13px;
  font-weight: 500;
  color: #EEEEF0;
  line-height: 1.3;
}

.sp-dd-desc {
  font-size: 11px;
  color: var(--sp-shell-text);
  margin-top: 1px;
}

.sp-dd-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #7D7F8A;
  flex-shrink: 0;
}

.sp-dd-badge.sp-live {
  background: rgba(29, 158, 117, 0.15);
  color: #1D9E75;
}

.sp-dd-badge.sp-live::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  background: #1D9E75;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
  animation: sp-pulse 2s ease-in-out infinite;
}

.sp-dd-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
  margin: 4px 12px;
}

/* ── Right section ── */
.sp-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Notification bell */
.sp-notif {
  position: relative;
  width: 38px; height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--sp-shell-text);
  transition: background 0.15s, color 0.15s;
}

.sp-notif:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--sp-shell-text-hover);
}

.sp-notif svg {
  width: 20px; height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sp-notif-count {
  position: absolute;
  top: 5px; right: 5px;
  min-width: 16px; height: 16px;
  background: var(--sp-ebay);
  color: #FFF;
  font-size: 10px;
  font-weight: 600;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-family: 'JetBrains Mono', monospace;
}

/* User button */
.sp-user-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.sp-user-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sp-avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--sp-shell-accent), #17856A);
  color: #FFF;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
}

.sp-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--sp-shell-text);
  transition: color 0.15s;
}

.sp-user-btn:hover .sp-user-name {
  color: var(--sp-shell-text-hover);
}

.sp-user-chevron {
  font-size: 9px;
  color: var(--sp-shell-text);
  opacity: 0.5;
}

/* User dropdown */
.sp-user-dd {
  position: absolute;
  top: calc(var(--sp-shell-h) - 1px);
  right: 0;
  min-width: 200px;
  background: var(--sp-dd-bg);
  border: 1px solid var(--sp-dd-border);
  border-radius: 0 0 14px 14px;
  box-shadow: var(--sp-dd-shadow);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s var(--sp-ease-out),
              transform 0.25s var(--sp-ease-spring),
              visibility 0.2s;
  backdrop-filter: blur(16px);
}

.sp-user-dd.sp-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.sp-user-dd-header {
  padding: 8px 12px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 4px;
}

.sp-user-dd-name {
  font-size: 14px;
  font-weight: 600;
  color: #FFF;
}

.sp-user-dd-email {
  font-size: 11px;
  color: var(--sp-shell-text);
  margin-top: 2px;
}

.sp-user-dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--sp-shell-text-hover);
  transition: background 0.15s;
  text-decoration: none;
}

.sp-user-dd-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sp-user-dd-item svg {
  width: 16px; height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.sp-user-dd-item.sp-danger {
  color: var(--sp-ebay);
}

/* ── Animations ── */
@keyframes sp-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Dropdown staggered entrance */
.sp-dropdown.sp-open .sp-dd-item {
  animation: sp-dd-enter 0.25s var(--sp-ease-out) both;
}
.sp-dropdown.sp-open .sp-dd-item:nth-child(2) { animation-delay: 0.03s; }
.sp-dropdown.sp-open .sp-dd-item:nth-child(3) { animation-delay: 0.06s; }
.sp-dropdown.sp-open .sp-dd-item:nth-child(4) { animation-delay: 0.09s; }
.sp-dropdown.sp-open .sp-dd-item:nth-child(5) { animation-delay: 0.12s; }

@keyframes sp-dd-enter {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  #sp-shell { padding: 0 12px; }
  .sp-logo-text { display: none; }
  .sp-nav-item { padding: 0 10px; font-size: 13px; }
  .sp-user-name { display: none; }
  .sp-dropdown { min-width: 240px; }
}

@media (max-width: 480px) {
  .sp-channel-dot { display: none; }
  .sp-nav { gap: 0; }
  .sp-nav-item { padding: 0 8px; }
}
