/* ═══════════════════════════════════════════
   CleanNews — Dark Minimal + Neon Accents
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg: #09090b;
  --bg-card: #131316;
  --text: #f0f0f2;
  --text-secondary: #b0b0b8;
  --text-tertiary: #8a8a95;
  --border: #1c1c22;
  --accent: #e4e4e7;
  --chip-bg: #18181b;
  --chip-active-bg: #e4e4e7;
  --chip-active-text: #09090b;
  --source-bg: #18181b;
  --paywall-color: #facc15;
  --slider-track: #27272a;
  --slider-thumb: #4ade80;
  --max-width: 640px;
  --radius: 10px;
  --radius-sm: 6px;
  --neon-cyan: #4ade80;
  --neon-pink: #ff2d78;
  --neon-lime: #a0ff00;
  --neon-violet: #bf5fff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── SVG Icons ── */
.icon {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.15em;
  display: inline-block;
  flex-shrink: 0;
}

.icon-sm {
  width: 0.95em;
  height: 0.95em;
}

body {
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
}

/* ── Header ── */

.header {
  padding: 2rem 1.25rem 1rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.logo-accent {
  font-weight: 300;
  color: var(--neon-cyan);
}

.settings-toggle {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: color 0.2s;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-toggle .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.settings-toggle:hover {
  color: var(--text);
}

.tagline {
  color: var(--text-secondary);
  font-size: 0.72rem;
  margin-top: 0.2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ── Settings Panel ── */

.settings-panel {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem 1rem;
  animation: slideDown 0.2s ease;
}

.settings-panel[hidden] {
  display: none;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.bubble-control {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.bubble-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.bubble-icon {
  font-size: 1rem;
}

.bubble-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--slider-track);
  outline: none;
  margin: 0.75rem 0 0.4rem;
  cursor: pointer;
}

.bubble-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--neon-cyan);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.4);
}

.bubble-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--neon-cyan);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.4);
}

.bubble-hints {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* ── Image Setting ── */

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.image-control {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.image-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.image-options {
  display: flex;
  gap: 0.3rem;
}

.image-opt {
  padding: 0.35rem 0.7rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.image-opt:hover {
  border-color: var(--text-tertiary);
}

.image-opt.active {
  background: transparent;
  color: var(--neon-cyan);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.15);
}

/* ── Filters ── */

.filters {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem 0.75rem;
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.filters::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  padding: 0.4rem 0.85rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--text-tertiary);
  color: var(--text);
}

.chip.active {
  background: transparent;
  color: var(--neon-cyan);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.15);
}

/* ── Feed ── */

.feed {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* ── Article Card ── */

.article {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.article-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s;
}

.article:first-child {
  padding-top: 0.5rem;
}

.article-link:hover {
  opacity: 0.75;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.article-source {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text);
  background: var(--source-bg);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.01em;
}

.article-category {
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.article-paywall {
  font-size: 0.65rem;
  color: var(--paywall-color);
  font-weight: 500;
}

.article-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 0.3rem;
  letter-spacing: -0.02em;
}

.article-description {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-time {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
}

/* ── Article Images ── */

.article-image {
  display: none;
}

/* Discrete mode: small thumbnail on the right */
body.img-discrete .article-body {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

body.img-discrete .article-text {
  flex: 1;
  min-width: 0;
}

body.img-discrete .article-image {
  display: block;
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  margin-top: 0.1rem;
}

/* Prominent mode: large image above text */
body.img-prominent .article-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  object-fit: cover;
  margin-bottom: 0.65rem;
}

body.img-prominent .article-body {
  display: block;
}

/* ── Chat ── */

.article-actions {
  margin-top: 0.5rem;
}

.chat-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.3rem 0.65rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}

.chat-toggle:hover {
  color: var(--neon-cyan);
  border-color: var(--neon-cyan);
}

.chat-panel {
  margin-top: 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  animation: slideDown 0.2s ease;
}

.chat-messages {
  max-height: 300px;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.chat-suggestion-row {
  display: flex;
  justify-content: center;
  padding: 0.25rem 0;
}

.chat-suggestion-btn {
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.25);
  color: var(--neon-cyan);
  font-family: inherit;
  font-size: 0.75rem;
  padding: 0.45rem 0.85rem;
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}

.chat-suggestion-btn:hover {
  background: rgba(74, 222, 128, 0.15);
  border-color: rgba(74, 222, 128, 0.45);
}

.chat-msg {
  font-size: 0.8rem;
  line-height: 1.5;
  max-width: 90%;
}

.chat-msg-user {
  align-self: flex-end;
  background: var(--neon-cyan);
  color: #09090b;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius) var(--radius) var(--radius-sm) var(--radius);
  font-weight: 500;
}

.chat-msg-model {
  align-self: flex-start;
  background: var(--chip-bg);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius) var(--radius) var(--radius) var(--radius-sm);
}

.chat-msg-model p {
  margin: 0.3rem 0;
}

.chat-msg-model p:first-child {
  margin-top: 0;
}

.chat-msg-model p:last-child {
  margin-bottom: 0;
}

.chat-msg-model strong {
  font-weight: 700;
}

.chat-msg-model a {
  color: var(--neon-cyan);
  text-decoration: none;
}

.chat-msg-model a:hover {
  text-decoration: underline;
}

.chat-sources {
  margin-top: 0.4rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
  font-size: 0.65rem;
}

.chat-sources-label {
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}

.chat-source-link {
  color: var(--neon-cyan);
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.6;
}

.chat-source-link:hover {
  text-decoration: underline;
}

.chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  background: var(--chip-bg);
  border-radius: var(--radius);
}

.chat-typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--neon-cyan);
  animation: pulse 1.2s ease-in-out infinite;
}

.chat-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.3s; }

.chat-input-row {
  display: flex;
  border-top: 1px solid var(--border);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.65rem 0.75rem;
  outline: none;
}

.chat-input::placeholder {
  color: var(--text-tertiary);
}

.chat-send {
  background: none;
  border: none;
  color: var(--neon-cyan);
  font-size: 1rem;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  transition: opacity 0.15s;
  font-family: inherit;
  display: flex;
  align-items: center;
}

.chat-send:hover {
  opacity: 0.7;
}

.chat-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.chat-error {
  font-size: 0.75rem;
  color: var(--paywall-color);
  padding: 0.5rem 0.75rem;
}

/* ── Loading ── */

.loading {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  padding: 3rem 0;
}

.loading-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-cyan);
  animation: pulse 1.2s ease-in-out infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.15s; }
.loading-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ── Load More ── */

.load-more-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
  text-align: center;
}

.load-more-wrap[hidden] {
  display: none;
}

.load-more {
  background: var(--chip-bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.6rem 1.5rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.15s;
}

.load-more:hover {
  color: var(--neon-cyan);
  border-color: var(--neon-cyan);
  background: transparent;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.15);
}

/* ── Empty State ── */

.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ── Error State ── */

.error {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--paywall-color);
  font-size: 0.9rem;
}

/* ── Footer ── */

.footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem;
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
