/* ========== Token Page Layout ========== */
.token-page {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  padding: 20px;
}

.tp-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.tp-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ========== Chart ========== */
.tp-chart-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tp-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.tp-chart-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tp-chart-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.tp-chart-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.tp-chart-price {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-secondary);
}

.tp-chart-change {
  font-weight: 700;
  font-size: 13px;
}

.tp-chart-change.positive { color: var(--green); }
.tp-chart-change.negative { color: var(--red); }

.tp-chart-tabs {
  display: flex;
  gap: 4px;
}

.tp-tf {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.tp-tf:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
}

.tp-tf.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.tp-chart {
  height: 400px;
  position: relative;
  padding: 16px;
}

.tp-chart canvas {
  width: 100%;
  height: 100%;
}

/* ========== Trade Panel ========== */
.tp-trade {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tp-trade-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.tp-trade-tab {
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  transition: all 0.15s;
  font-family: inherit;
}

.tp-trade-tab.active[data-side="buy"] {
  background: rgba(74, 222, 128, 0.1);
  color: var(--green);
  box-shadow: inset 0 -2px 0 var(--green);
}

.tp-trade-tab.active[data-side="sell"] {
  background: rgba(248, 113, 113, 0.1);
  color: var(--red);
  box-shadow: inset 0 -2px 0 var(--red);
}

.tp-trade-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tp-trade-balance {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

.tp-trade-balance span:last-child {
  color: var(--text-primary);
  font-weight: 600;
}

.tp-trade-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  transition: border-color 0.15s;
}

.tp-trade-input-wrap:focus-within {
  border-color: var(--accent);
}

.tp-trade-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
  padding: 12px 0;
  outline: none;
  font-family: inherit;
}

.tp-trade-input::placeholder {
  color: var(--text-muted);
}

.tp-trade-currency {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
}

.tp-quick-amounts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.tp-quick {
  padding: 8px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.tp-quick:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.tp-trade-estimate {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.tp-trade-estimate span:last-child {
  color: var(--text-primary);
  font-weight: 600;
}

.tp-trade-btn {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  background: var(--green);
  color: #0a0806;
}

.tp-trade-btn:hover {
  opacity: 0.9;
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.3);
}

.tp-trade-btn.sell-mode {
  background: var(--red);
}

.tp-trade-btn.sell-mode:hover {
  box-shadow: 0 0 20px rgba(248, 113, 113, 0.3);
}

/* ========== Token Info Card ========== */
.tp-info {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.tp-info-img-wrap {
  width: 90px;
  height: 90px;
  margin: 0 auto 14px;
  position: relative;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  overflow: visible;
}

.tp-info-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
}

.tp-info-img-wrap .token-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #0a0806;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.tp-info-img-wrap .token-badge img {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
}

.tp-info-details {
  margin-bottom: 12px;
}

.tp-info-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.tp-info-ticker {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.tp-info-verified {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  background: linear-gradient(135deg, #d4a74a, #f5d280, #c4944a, #f5d280, #d4a74a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
}

.tp-info-verified img {
  width: 16px;
  height: 16px;
  border-radius: 2px;
}

.tp-info-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
  text-align: left;
}

/* Token links */
.tp-info-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tp-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.15s;
}

.tp-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* Voice clip player */
.tp-info-audio {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.tp-play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid rgba(196, 136, 78, 0.2);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.tp-play-btn:hover {
  background: var(--accent);
  color: var(--text-on-accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.tp-waveform {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1.5px;
  height: 24px;
}

.tp-waveform .wv-bar {
  flex: 1;
  border-radius: 1px;
  background: var(--accent);
  opacity: 0.25;
  transition: opacity 0.2s;
}

.tp-waveform.playing .wv-bar {
  opacity: 0.7;
  animation: wvPulse 0.6s ease-in-out infinite alternate;
}

.tp-waveform.playing .wv-bar:nth-child(odd) {
  animation-delay: 0.15s;
}

.tp-waveform.playing .wv-bar:nth-child(3n) {
  animation-delay: 0.3s;
}

@keyframes wvPulse {
  0% { transform: scaleY(0.6); opacity: 0.4; }
  100% { transform: scaleY(1); opacity: 0.9; }
}

.tp-audio-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

/* Meta info rows */
.tp-info-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.tp-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.tp-meta-row:last-child { border-bottom: none; }

.tp-meta-label {
  color: var(--text-muted);
}

.tp-meta-value {
  color: var(--text-primary);
  font-weight: 600;
}

/* ========== Bonding Curve ========== */
.tp-bonding {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.tp-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.tp-bonding-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.tp-bonding-bar {
  flex: 1;
  height: 10px;
  background: var(--bg-tertiary);
  border-radius: 5px;
  overflow: hidden;
}

.tp-bonding-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #f5d280);
  border-radius: 5px;
  transition: width 0.3s;
}

.tp-bonding-pct {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  min-width: 36px;
}

.tp-bonding-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

.tp-bonding-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tp-bstat {
  background: var(--bg-tertiary);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tp-bstat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tp-bstat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ========== Holder Distribution ========== */
.tp-holders {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.tp-holder-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tp-holder {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.tp-holder-rank {
  width: 20px;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}

.tp-holder-addr {
  color: var(--text-secondary);
  font-weight: 500;
  min-width: 80px;
}

.tp-holder-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.tp-holder-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  opacity: 0.6;
}

.tp-holder-pct {
  color: var(--text-primary);
  font-weight: 700;
  min-width: 40px;
  text-align: right;
}

.tp-holder.creator .tp-holder-addr {
  color: var(--accent);
}

.tp-holder.creator .tp-holder-bar {
  background: linear-gradient(90deg, var(--accent), #f5d280);
  opacity: 1;
}

/* ========== Thread / Comments ========== */
.tp-thread {
  padding: 0 20px 40px;
}

.tp-thread-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.tp-thread-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.tp-thread-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

.tp-thread-input::placeholder {
  color: var(--text-muted);
}

.tp-thread-send {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.tp-thread-send:hover {
  background: var(--accent-hover);
}

.tp-comments {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tp-comment {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.tp-comment:first-child {
  border-radius: var(--radius) var(--radius) 0 0;
}

.tp-comment:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
}

.tp-comment:only-child {
  border-radius: var(--radius);
}

.tp-comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
}

.tp-comment-body {
  flex: 1;
  min-width: 0;
}

.tp-comment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.tp-comment-addr {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.tp-comment-time {
  font-size: 11px;
  color: var(--text-muted);
}

.tp-comment-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ========== Responsive ========== */
@media (max-width: 900px) {
  .token-page {
    grid-template-columns: 1fr;
  }

  .tp-chart {
    height: 300px;
  }
}

@media (max-width: 768px) {
  .token-page {
    padding: 12px;
    gap: 12px;
  }

  .tp-thread {
    padding: 0 12px 30px;
  }
}
