/* ============================================
   FeediX Mini App - Crypto Signals Niche CSS
   Trading terminal aesthetic (Binance/TradingView style)
   ============================================ */

/* -----------------------------------------------
   Body override: near-black with green tint
   ----------------------------------------------- */
body.niche-crypto,
body[data-niche="crypto"] {
  background: #050d09;
  color: #c8d8cd;
}

/* -----------------------------------------------
   Header
   ----------------------------------------------- */
.sig-header {
  background: #040b07;
  border-bottom: 1px solid #0d2b18;
  position: sticky;
  top: 0;
  z-index: 100;
}

.sig-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  gap: 10px;
}

.sig-header-left {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.sig-header-right {
  flex-shrink: 0;
}

.sig-channel-name {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #00ff87;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-header-labels {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.sig-label-badge {
  background: #0d2b18;
  color: #00c896;
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 9px;
  border-radius: 3px;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Pulsing live dot */
.sig-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #00c896;
  border-radius: 50%;
  box-shadow: 0 0 6px #00c896;
  flex-shrink: 0;
  animation: sig-pulse 1.5s ease-in-out infinite;
}

@keyframes sig-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px #00c896; }
  50% { opacity: 0.5; box-shadow: 0 0 2px #00c896; }
}

.sig-post-count {
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 11px;
  color: #3d7a5a;
  font-variant-numeric: tabular-nums;
}

.sig-updated {
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 11px;
  color: #2a5a3e;
}

/* Admin stats button */
.sig-admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 200, 150, 0.1);
  border: 1px solid rgba(0, 200, 150, 0.25);
  border-radius: 5px;
  color: #00c896;
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.sig-admin-btn:active {
  background: rgba(0, 200, 150, 0.2);
}

/* -----------------------------------------------
   Ticker strip
   ----------------------------------------------- */
.sig-ticker-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 7px 14px;
  border-top: 1px solid #0d2b18;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: #040b07;
}

.sig-ticker-strip::-webkit-scrollbar {
  display: none;
}

.sig-ticker-pill {
  background: #0d2b18;
  color: #00c896;
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 3px;
  border: 1px solid #1a4d30;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

/* -----------------------------------------------
   Feed container
   ----------------------------------------------- */
#crypto-feed {
  display: flex;
  flex-direction: column;
  padding: 8px 0 32px;
  background: #050d09;
}

/* -----------------------------------------------
   Signal card base
   ----------------------------------------------- */
.sig-card {
  background: #080f0a;
  border: 1px solid #0d2b18;
  border-left: 3px solid #2a4a3a;
  border-radius: 6px;
  margin: 5px 12px;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  /* scroll reveal base state is applied via .sr-init class */
}

.sig-card:active,
.sig-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 200, 150, 0.08);
}

/* Direction variants */
.sig-card--buy {
  border-left-color: #00c896;
}

.sig-card--sell {
  border-left-color: #e53935;
}

.sig-card--neutral {
  border-left-color: #2a4a3a;
}

/* -----------------------------------------------
   Card top bar
   ----------------------------------------------- */
.sig-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid #0d2b18;
}

.sig-top--buy {
  background: #051a0f;
}

.sig-top--sell {
  background: #150505;
}

.sig-top--neutral {
  background: #080f0a;
}

/* Direction badge */
.sig-direction {
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 4px 11px;
  border-radius: 4px;
  flex-shrink: 0;
  line-height: 1;
}

.sig-direction--buy {
  background: rgba(0, 200, 150, 0.15);
  color: #00c896;
  border: 1px solid rgba(0, 200, 150, 0.3);
}

.sig-direction--sell {
  background: rgba(229, 57, 53, 0.15);
  color: #e53935;
  border: 1px solid rgba(229, 57, 53, 0.3);
}

.sig-direction--neutral {
  background: rgba(100, 100, 100, 0.1);
  color: #666;
  border: 1px solid #222;
}

/* Trading pair / title */
.sig-pair {
  flex: 1;
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 14px;
  font-weight: 700;
  color: #e8e8e8;
  letter-spacing: 0.4px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Timestamp */
.sig-time {
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 11px;
  color: #3d7a5a;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* -----------------------------------------------
   Price levels table
   ----------------------------------------------- */
.sig-prices {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background: #040b07;
  border-bottom: 1px solid #0d2b18;
}

.sig-price-cell {
  padding: 8px 12px;
  border-right: 1px solid #0d2b18;
}

.sig-price-cell:last-child {
  border-right: none;
}

.sig-price-cell--empty {
  opacity: 0.35;
}

.sig-price-label {
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 9px;
  font-weight: 700;
  color: #3d7a5a;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sig-price-val {
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 13px;
  font-weight: 700;
  color: #c8c8c8;
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
  letter-spacing: -0.2px;
}

.sig-target {
  color: #00c896;
}

.sig-stop {
  color: #e53935;
}

.sig-price-dash {
  color: #2a4a3a;
  font-size: 12px;
}

/* -----------------------------------------------
   Chart image
   ----------------------------------------------- */
.sig-chart {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  background: #040b07;
}

/* -----------------------------------------------
   Signal body preview (2-line clamp)
   ----------------------------------------------- */
.sig-body {
  padding: 10px 14px 8px;
  font-size: 13px;
  color: #7a9a8a;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* -----------------------------------------------
   Card footer
   ----------------------------------------------- */
.sig-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid #0d2b18;
}

.sig-tags {
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 11px;
  color: #2a7a5a;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sig-view-btn {
  font-size: 13px;
  font-weight: 600;
  color: #00c896;
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.sig-view-btn:active,
.sig-view-btn:hover {
  color: #00e6ad;
}

/* -----------------------------------------------
   Empty state
   ----------------------------------------------- */
.sig-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 24px;
  text-align: center;
  gap: 14px;
}

.sig-empty-icon {
  font-size: 44px;
  line-height: 1;
  opacity: 0.4;
}

.sig-empty-title {
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 15px;
  font-weight: 700;
  color: #3d7a5a;
  letter-spacing: 1px;
}

.sig-empty-msg {
  font-size: 13px;
  color: #2a4a3a;
  max-width: 240px;
  line-height: 1.6;
}

/* -----------------------------------------------
   Scroll reveal animations
   ----------------------------------------------- */
.sig-card.sr-init {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease var(--sr-delay, 0ms),
              transform 0.2s ease var(--sr-delay, 0ms);
}

.sig-card.sr-visible {
  opacity: 1;
  transform: translateY(0);
}

/* -----------------------------------------------
   Pull-to-refresh indicator
   ----------------------------------------------- */
.pull-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 0;
  overflow: hidden;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  color: #00c896;
  transition: height 0.2s ease;
  background: #040b07;
}

.pull-indicator.active {
  height: 40px;
}

.pull-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #0d2b18;
  border-top-color: #00c896;
  border-radius: 50%;
  animation: sig-spin 0.7s linear infinite;
}

@keyframes sig-spin {
  to { transform: rotate(360deg); }
}

/* -----------------------------------------------
   Scroll sentinel
   ----------------------------------------------- */
.scroll-sentinel {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  min-height: 60px;
}

.scroll-sentinel.loading .scroll-spinner {
  display: block;
}

/* -----------------------------------------------
   Story context panel -- crypto theme override
   ----------------------------------------------- */

.story-ctx-panel--crypto {
  border-top-color: #0d2b18;
}

.story-ctx-panel--crypto .story-ctx-header {
  color: #00c896;
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
}

.story-ctx-panel--crypto .story-ctx-title {
  color: #e8e8e8;
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 13px;
}

.story-ctx-panel--crypto .story-ctx-item {
  border-bottom-color: #0d2b18;
}

.story-ctx-panel--crypto .story-ctx-cat {
  color: #00c896;
  background: rgba(0, 200, 150, 0.1);
  border-color: rgba(0, 200, 150, 0.2);
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
}

.story-ctx-panel--crypto .story-ctx-text {
  color: #5a9a7a;
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 12px;
}

/* -----------------------------------------------
   Wider screens (tablet / web preview)
   ----------------------------------------------- */
@media (min-width: 480px) {
  #crypto-feed {
    max-width: 480px;
    margin: 0 auto;
  }
}

/* -----------------------------------------------
   Crypto story cards
   ----------------------------------------------- */

.crypto-story-card {
  background: #080f0a;
  border: 1px solid #0d2b18;
  border-left: 3px solid #00c896;
  border-radius: 6px;
  margin: 5px 12px;
  padding: 13px 14px 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  /* scroll reveal */
}

.crypto-story-card.sr-init {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease var(--sr-delay, 0ms),
              transform 0.2s ease var(--sr-delay, 0ms);
}

.crypto-story-card.sr-visible {
  opacity: 1;
  transform: translateY(0);
}

.crypto-story-card:active,
.crypto-story-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 200, 150, 0.1);
}

/* Top row */
.market-story-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.market-story-badge {
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  background: rgba(0, 200, 150, 0.1);
  border: 1px solid rgba(0, 200, 150, 0.25);
  color: #00c896;
  padding: 3px 8px;
  border-radius: 3px;
  flex-shrink: 0;
  line-height: 1.4;
}

.story-tickers {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow: hidden;
  min-width: 0;
  flex: 1;
  justify-content: center;
}

.story-ticker-chip {
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 10px;
  font-weight: 700;
  color: #00c896;
  background: #0d2b18;
  border: 1px solid #1a4d30;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.story-importance {
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.4;
}

.story-importance--high {
  background: rgba(229, 57, 53, 0.12);
  color: #e53935;
  border: 1px solid rgba(229, 57, 53, 0.25);
}

.story-importance--medium {
  background: rgba(255, 167, 38, 0.1);
  color: #ffa726;
  border: 1px solid rgba(255, 167, 38, 0.2);
}

.story-importance--low {
  background: rgba(100, 100, 100, 0.08);
  color: #3d7a5a;
  border: 1px solid #1a4d30;
}

/* Crypto story title */
.crypto-story-title {
  font-size: 15px;
  font-weight: 700;
  color: #e8e8e8;
  line-height: 1.4;
  margin-bottom: 9px;
  letter-spacing: -0.1px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Key facts */
.crypto-story-facts {
  list-style: none;
  margin: 0 0 9px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.crypto-story-facts li {
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 12px;
  color: #5a9a7a;
  line-height: 1.4;
  padding-left: 14px;
  position: relative;
}

.crypto-story-facts li::before {
  content: '>';
  position: absolute;
  left: 0;
  color: #00c896;
  font-size: 10px;
  top: 1px;
}

/* Update count footer */
.crypto-story-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid #0d2b18;
  margin-top: 2px;
  gap: 4px;
}

.crypto-story-count {
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 12px;
  font-weight: 700;
  color: #00c896;
  letter-spacing: 0.5px;
}

.crypto-story-chevron {
  font-size: 14px;
  color: #00c896;
  line-height: 1;
  margin-top: -1px;
}

/* -----------------------------------------------
   Crypto story detail (timeline)
   ----------------------------------------------- */

.crypto-story-detail {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #050d09;
  z-index: 200;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.crypto-story-detail-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #040b07;
  border-bottom: 1px solid #0d2b18;
  padding: 12px 14px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.crypto-story-back {
  background: none;
  border: none;
  color: #3d7a5a;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease;
}

.crypto-story-back:active {
  color: #00c896;
}

.crypto-story-header-label {
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 10px;
  font-weight: 800;
  color: #00c896;
  letter-spacing: 1px;
  text-transform: uppercase;
  flex: 1;
}

.crypto-story-detail-title {
  font-size: 16px;
  font-weight: 700;
  color: #e8e8e8;
  line-height: 1.4;
  padding: 14px 14px 12px;
  border-bottom: 1px solid #0d2b18;
  letter-spacing: -0.15px;
}

.crypto-story-timeline {
  padding: 8px 0 40px;
}

.crypto-story-entry {
  display: flex;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid #0d2b18;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease;
}

.crypto-story-entry:active {
  background: #080f0a;
}

.crypto-story-entry:last-child {
  border-bottom: none;
}

.crypto-entry-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 6px;
  padding-top: 6px;
  gap: 0;
}

.crypto-entry-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00c896;
  flex-shrink: 0;
  margin-left: -1px;
  box-shadow: 0 0 4px rgba(0, 200, 150, 0.4);
}

.crypto-entry-line {
  width: 2px;
  flex: 1;
  background: #0d2b18;
  margin-top: 4px;
  min-height: 24px;
}

.crypto-story-entry:last-child .crypto-entry-line {
  display: none;
}

.crypto-entry-body {
  flex: 1;
  min-width: 0;
}

.crypto-entry-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.crypto-category-badge {
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1.5;
}

.crypto-category-badge--breaking {
  background: rgba(229, 57, 53, 0.15);
  color: #e53935;
  border: 1px solid rgba(229, 57, 53, 0.3);
}

.crypto-category-badge--update {
  background: rgba(255, 167, 38, 0.1);
  color: #ffa726;
  border: 1px solid rgba(255, 167, 38, 0.22);
}

.crypto-category-badge--analysis {
  background: rgba(66, 165, 245, 0.1);
  color: #42a5f5;
  border: 1px solid rgba(66, 165, 245, 0.22);
}

.crypto-category-badge--signal,
.crypto-category-badge--price_alert {
  background: rgba(0, 200, 150, 0.1);
  color: #00c896;
  border: 1px solid rgba(0, 200, 150, 0.22);
}

.crypto-entry-time {
  font-family: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 11px;
  color: #3d7a5a;
  font-variant-numeric: tabular-nums;
}

.crypto-entry-text {
  font-size: 13px;
  color: #7a9a8a;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
