/* ── Binance-style Dark Theme Variables ──────────────────────────────── */
:root {
  --btl-bg: #181A20;
  --btl-card-bg: #0B0E11;
  /* Darker card bg */
  --btl-text: #EAECEF;
  --btl-text-dim: #848E9C;
  --btl-border: #2B3139;
  --btl-primary: #F0B90B;
  /* Binance Orange */
  --btl-primary-dim: rgba(240, 185, 11, 0.15);
  --btl-success: #0ECB81;
  --btl-error: #F6465D;
  --btl-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ── Card container (fixed bottom-right, stacks upward) ───────────────────── */

.btl-card-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Individual TLDR card ────────────────────────────────────────────────── */

.btl-tldr-card {
  width: 420px;
  max-height: 55vh;
  background: rgba(11, 14, 17, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(240, 185, 11, 0.2);
  border-radius: 12px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 2px 8px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  overflow: hidden;
  pointer-events: auto;
  animation: btl-slide-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--btl-text);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btl-tldr-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.6),
    0 4px 12px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(240, 185, 11, 0.3) inset;
}

/* ── Card header ─────────────────────────────────────────────────────────── */

.btl-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(240, 185, 11, 0.15);
  background: linear-gradient(135deg, rgba(24, 26, 32, 0.9) 0%, rgba(11, 14, 17, 0.95) 100%);
  backdrop-filter: blur(10px);
}

.btl-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--btl-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btl-card-title-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

.btl-card-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--btl-text-dim);
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.btl-card-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--btl-text);
}

/* ── Card body ───────────────────────────────────────────────────────────── */

.btl-card-body {
  padding: 16px;
  max-height: calc(55vh - 50px);
  overflow-y: auto;
  background: var(--btl-card-bg);
}

/* Scrollbar */
.btl-card-body::-webkit-scrollbar {
  width: 4px;
}

.btl-card-body::-webkit-scrollbar-thumb {
  background: var(--btl-border);
  border-radius: 2px;
}

/* ── Original tweet link ─────────────────────────────────────────────────── */

.btl-original-link {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--btl-border);
  display: flex;
  justify-content: space-between;
}

.btl-original-link a {
  font-size: 12px;
  color: var(--btl-primary);
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.2s;
}

.btl-original-link a:hover {
  opacity: 0.8;
}

/* ── Formatted content ───────────────────────────────────────────────────── */

.btl-tldr-content {
  font-size: 13px;
  line-height: 1.6;
  color: var(--btl-text);
}

.btl-tldr-content p {
  margin: 0 0 10px 0;
}

.btl-tldr-content p:last-child {
  margin-bottom: 0;
}

.btl-tldr-content strong {
  font-weight: 700;
  color: #fff;
  /* Stark white for emphasis */
}

.btl-tldr-content em {
  font-style: italic;
  color: var(--btl-text-dim);
}

.btl-tldr-content ul {
  margin: 8px 0;
  padding-left: 18px;
  list-style-type: disc;
}

.btl-tldr-content ol {
  margin: 8px 0;
  padding-left: 20px;
}

.btl-tldr-content li {
  margin-bottom: 6px;
  padding-left: 2px;
}

.btl-tldr-content li:last-child {
  margin-bottom: 0;
}

.btl-tldr-content li::marker {
  color: var(--btl-primary);
}

/* ── Section headings ────────────────────────────────────────────────────── */

.btl-section-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--btl-primary);
  margin: 16px 0 8px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--btl-primary-dim);
}

.btl-section-heading:first-child {
  margin-top: 0;
}

/* ── Credibility score badge ─────────────────────────────────────────────── */

.btl-score-line {
  margin: 16px 0 0 0;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--btl-bg);
  /* Darker inner container */
  border: 1px solid var(--btl-border);
  font-size: 12px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btl-score-badge {
  display: inline-block;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  text-transform: uppercase;
}

/* Use Binance-ish colors for scores */
.btl-score-high {
  background: rgba(14, 203, 129, 0.15);
  color: var(--btl-success);
  border: 1px solid rgba(14, 203, 129, 0.3);
}

.btl-score-mid {
  background: rgba(240, 185, 11, 0.15);
  color: var(--btl-primary);
  border: 1px solid rgba(240, 185, 11, 0.3);
}

.btl-score-low {
  background: rgba(246, 70, 93, 0.15);
  color: var(--btl-error);
  border: 1px solid rgba(246, 70, 93, 0.3);
}

/* ── Error state ─────────────────────────────────────────────────────────── */

.btl-tldr-card.btl-error .btl-tldr-content {
  color: var(--btl-error);
}

/* ── Loading state ───────────────────────────────────────────────────────── */

.btl-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.btl-loading span {
  color: var(--btl-text-dim);
  font-size: 13px;
  font-weight: 500;
}

.btl-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(240, 185, 11, 0.2);
  border-top-color: var(--btl-primary);
  border-right-color: var(--btl-primary);
  border-radius: 50%;
  \n animation: btl-spin 0.6s linear infinite;
  filter: drop-shadow(0 0 4px rgba(240, 185, 11, 0.3));
}

/* ── Animations ──────────────────────────────────────────────────────────── */

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

@keyframes btl-slide-in {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.btl-fade-out {
  animation: btl-fade-out 0.2s ease-in forwards;
}

@keyframes btl-fade-out {
  to {
    opacity: 0;
    transform: translateY(10px);
  }
}