/* ================================================
   Glow UI — Text Diff Checker
   ================================================ */

:root {
  --bg: #121212;
  --bg-card: #181818;
  --bg-hover: #282828;
  --border: #404040;
  --text-muted: #535353;
  --text-secondary: #B3B3B3;
  --text-primary: #FFFFFF;
  --green: #1DB954;
  --added-bg: rgba(39, 174, 96, 0.15);
  --added-border: #27AE60;
  --added-text: #27AE60;
  --removed-bg: rgba(192, 57, 43, 0.15);
  --removed-border: #C0392B;
  --removed-text: #C0392B;
}

[data-theme="light"] {
  --bg: #FFFFFF;
  --bg-card: #F5F5F5;
  --bg-hover: #E8E8E8;
  --border: #D0D0D0;
  --text-muted: #999999;
  --text-secondary: #666666;
  --text-primary: #121212;
  --green: #1DB954;
  --added-bg: rgba(39, 174, 96, 0.12);
  --added-border: #27AE60;
  --added-text: #1a8a4a;
  --removed-bg: rgba(192, 57, 43, 0.12);
  --removed-border: #C0392B;
  --removed-text: #a02420;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.2s, color 0.2s;
}

/* ── Header ── */
.global-header {
  background: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  height: 64px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

[data-theme="light"] .global-header {
  background: rgba(255, 255, 255, 0.9);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  color: var(--green);
  font-weight: 800;
  font-size: 20px;
  text-decoration: none;
  white-space: nowrap;
}

.breadcrumb {
  color: var(--text-secondary);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--text-primary);
}

.breadcrumb-sep {
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-to-hub {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  transition: all 0.2s;
  white-space: nowrap;
}

.back-to-hub:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

/* ── Top Ad ── */
.ad-slot--top {
  background: var(--bg-card);
  min-height: 90px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

/* ── Main Layout ── */
.main-layout {
  display: flex;
  gap: 24px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
  flex: 1;
  align-items: flex-start;
}

/* ── Sidebars ── */
.sidebar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar--left {
  width: 160px;
}

.sidebar--right {
  width: 300px;
}

.ad-slot--sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ── Content Area ── */
.content-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 8px 0 4px;
}

.hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.2;
}

.hero-sub {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Tool Section ── */
.tool-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.input-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.diff-textarea {
  width: 100%;
  height: 240px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  font-family: 'Menlo', 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.diff-textarea:focus {
  border-color: var(--green);
}

.diff-textarea::placeholder {
  color: var(--text-muted);
}

/* ── Actions ── */
.action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--green);
  color: #000;
  border: none;
  border-radius: 9999px;
  padding: 11px 28px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: #1ed760;
  transform: scale(1.03);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 10px 24px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* ── Stats Bar ── */
.stats-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stat {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 9999px;
}

.stat--added {
  background: var(--added-bg);
  color: var(--added-text);
  border: 1px solid var(--added-border);
}

.stat--removed {
  background: var(--removed-bg);
  color: var(--removed-text);
  border: 1px solid var(--removed-border);
}

.stat--unchanged {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* ── Diff Output ── */
.diff-output {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.diff-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
}

.diff-label {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
}

.diff-label--original {
  border-right: 1px solid var(--border);
}

.diff-body {
  font-family: 'Menlo', 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
}

/* Diff rows */
.diff-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 22px;
}

.diff-cell {
  padding: 2px 14px;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 22px;
}

.diff-cell--left {
  border-right: 1px solid var(--border);
}

/* Added (right cell) */
.diff-row--added .diff-cell--right {
  background: var(--added-bg);
  color: var(--added-text);
}

.diff-row--added .diff-cell--right::before {
  content: '+ ';
  font-weight: 700;
}

/* Removed (left cell) */
.diff-row--removed .diff-cell--left {
  background: var(--removed-bg);
  color: var(--removed-text);
}

.diff-row--removed .diff-cell--left::before {
  content: '- ';
  font-weight: 700;
}

/* Unchanged */
.diff-row--unchanged .diff-cell {
  color: var(--text-secondary);
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 16px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state p {
  font-size: 15px;
  color: var(--text-secondary);
}

.empty-state strong {
  color: var(--green);
}

/* ── Inline Ad ── */
.ad-slot--inline {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 90px;
  display: none; /* shown only on mobile via media query */
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* ── Content Sections ── */
.content-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px 32px;
}

.content-section h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.content-section p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 12px;
}

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

.content-section ul,
.content-section ol {
  margin: 0 0 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.content-section li {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.content-section code {
  font-family: 'Menlo', 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  background: var(--bg-hover);
  color: var(--green);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.text-added { color: var(--added-text); }
.text-removed { color: var(--removed-text); }
.text-unchanged { color: var(--text-secondary); }

/* ── FAQ ── */
.faq-section {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.faq-section h2 {
  margin-bottom: 20px;
}

.faq-item {
  border-top: 1px solid var(--border);
  padding: 20px 0;
}

.faq-item:last-child {
  padding-bottom: 0;
}

.faq-item h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.faq-item p {
  margin-bottom: 0;
}

/* ── Cross-links ── */
.cross-links {
  padding: 28px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.cross-links h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.cross-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.service-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s;
}

.service-card:hover {
  background: var(--bg-hover);
  border-color: var(--green);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.service-icon {
  font-size: 22px;
  font-weight: 700;
  color: var(--green);
  font-family: 'Menlo', 'Consolas', monospace;
}

.service-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.service-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Bottom Ad ── */
.ad-slot--bottom {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 90px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* ── Footer ── */
.global-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0 8px;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--text-primary);
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .sidebar--left,
  .sidebar--right {
    display: none;
  }

  .ad-slot--inline {
    display: flex;
  }
}

@media (max-width: 768px) {
  .global-header {
    padding: 0 16px;
    height: 56px;
  }

  .breadcrumb {
    display: none;
  }

  .main-layout {
    padding: 16px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .diff-textarea {
    height: 180px;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .content-section {
    padding: 20px 18px;
  }

  .cross-links {
    padding: 20px 18px;
  }

  .cross-links-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .diff-header {
    display: none;
  }

  .diff-row {
    grid-template-columns: 1fr;
  }

  .diff-cell--left {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 480px) {
  .action-row {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
  }
}
