/* ===========================
   PaperCut — Themed CSS
   XP / Glass / Neo + Light mode
   1400px layout + auto-fit grid
   =========================== */

/* Base (XP Dark) variables */
:root {
  --bg-gradient: linear-gradient(135deg, #fffbe6 0%, #fff8dc 40%, #fffdf4 100%);

  --card-bg: #5077A3;                      /* XP blue */
  --card-border: rgba(255, 255, 255, 0.25);

  --section-bg: #f3f7ff;
  --section-border: #d4e4ff;
  --section-text: #0f172a;

  --input-bg: #0f1f3a;
  --textarea-bg: #0c1a33;

  --pill-bg: #111827;
  --pill-border: #1f2937;

  --accent: #166534;
  --accent-soft: rgba(22, 101, 52, 0.25);
  --accent-text: #e5f9ee;

  --text-main: #f9fafb;
  --text-soft: #e5e7eb;
  --text-muted: #d1d5db;

  --danger: #b91c1c;
}

/* ===========================
   THEMES
   =========================== */

/* XP theme (default) */
body.theme-xp {
  --card-bg: #5077A3;
  --card-border: rgba(255, 255, 255, 0.25);

  --section-bg: #f3f7ff;
  --section-border: #d4e4ff;
  --section-text: #0f172a;

  --input-bg: #0f1f3a;
  --textarea-bg: #0c1a33;

  --text-main: #f9fafb;
  --text-soft: #e5e7eb;
  --text-muted: #d1d5db;
}

/* Glass UI – dark glassy theme */
body.theme-glass {
  --card-bg: rgba(15, 23, 42, 0.92);
  --card-border: rgba(148, 163, 184, 0.4);

  /* darker glass cards for dark mode */
  --section-bg: rgba(15, 23, 42, 0.82);
  --section-border: rgba(148, 163, 184, 0.45);
  --section-text: #e5e7eb;

  --input-bg: rgba(15, 23, 42, 0.94);
  --textarea-bg: #020617;

  --text-main: #f9fafb;
  --text-soft: #e5e7eb;
  --text-muted: #cbd5e1;
}

/* Soft Neo-brutalist — flat, chunky, high contrast */
body.theme-neo {
  --bg-gradient: #f5f5f5;

  --card-bg: #f5f5f5;
  --card-border: #111827;

  --section-bg: #ffffff;
  --section-border: #111827;
  --section-text: #111827;

  --input-bg: #ffffff;
  --textarea-bg: #f9fafb;

  --pill-bg: #111827;
  --pill-border: #111827;

  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.25);
  --accent-text: #ecfeff;

  --text-main: #020617;
  --text-soft: #111827;
  --text-muted: #4b5563;
}

/* Light Mode (on top of any theme) */
body.mode-light {
  --bg-gradient: linear-gradient(135deg, #f0f4fa 0%, #e8eef8 40%, #ffffff 100%);

  --card-bg: #e8eef8;
  --card-border: rgba(15, 23, 42, 0.20);

  --section-bg: #ffffff;
  --section-border: #c8d4f5;
  --section-text: #0f172a;

  --input-bg: #f1f5f9;
  --textarea-bg: #ffffff;

  --text-main: #020617;
  --text-soft: #0f172a;
  --text-muted: #6b7280;
}

/* ===========================
   GLOBAL
   =========================== */

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui,-apple-system,BlinkMacSystemFont,sans-serif;
  font-size: 18px;
  background: var(--bg-gradient);
  color: var(--text-main);
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* 1400px max width, side padding scales with viewport */
.page {
  width: 100%;
  max-width: 1400px;
  padding: 32px clamp(16px, 4vw, 48px) 48px;
}

/* Main XP panel with subtle “ring” around it */
.container {
  width: 100%;
  margin: 0 auto;
  padding: 28px clamp(20px, 3vw, 32px) 26px;
  background: var(--card-bg);
  border-radius: 22px;
  border: 1px solid var(--card-border);
  box-shadow:
    0 28px 70px rgba(15, 23, 42, 0.55),        /* drop shadow */
    0 0 0 1px rgba(15, 23, 42, 0.55),          /* dark outline */
    0 0 0 4px rgba(255, 255, 255, 0.35);       /* XP-style light ring */
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* In Glass theme, drop the XP white ring and use a cleaner glass shadow */
body.theme-glass .container {
  box-shadow:
    0 32px 80px rgba(15, 23, 42, 0.85),
    0 0 0 1px rgba(148, 163, 184, 0.5);
}

/* ===========================
   HEADER
   =========================== */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.35);
  padding-bottom: 16px;
}

.title-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Clean icon tile */
.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.18);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 4px;
}

.logo-icon img {
  width: 90%;
  height: 90%;
  object-fit: contain;
  filter: none;          /* no darkening */
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  color: var(--text-main);
}

/* bigger subtitle */
.subtitle {
  color: var(--text-muted);
  font-size: 16px;
  margin-top: 6px;
  max-width: 700px;
}

.header-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.badge {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(248,250,252,0.3);
  background: rgba(15,23,42,0.8);
  color: #e5e7eb;
}

/* theme + light mode controls */

.theme-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-select {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,0.3);
  background: rgba(248,250,252,0.9);
  font-size: 12px;
  outline: none;
}

.theme-select:focus {
  border-color: var(--accent);
}

.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toggle-label {
  font-size: 11px;
}

.toggle-input {
  width: 32px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.4);
  background: rgba(15, 23, 42, 0.3);
  position: relative;
  cursor: pointer;
}

.toggle-input::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #f9fafb;
  transition: transform 0.16s ease;
}

.toggle-input.is-on {
  background: rgba(22, 163, 74, 0.6);
  border-color: rgba(22, 163, 74, 0.8);
}

.toggle-input.is-on::before {
  transform: translateX(14px);
}

/* ===========================
   INPUT CARD
   =========================== */

.input-card {
  margin-top: 18px;
  padding: 16px 16px 18px;
  border-radius: 16px;
  background: var(--input-bg);
  border: 1px solid rgba(0,0,0,0.25);
  box-shadow: 0 20px 40px rgba(15,23,42,0.7);
}

label.small {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  min-height: 160px;
  border-radius: 12px;
  border: 1px solid #374151;
  padding: 12px 13px;
  font-size: 16px;
  font-family: inherit;
  background: var(--textarea-bg);
  color: var(--text-soft);
  resize: vertical;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

/* ===========================
   BUTTON
   =========================== */

.controls {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  gap: 10px;
}

button {
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 16px 28px rgba(22,101,52,0.75);
}

button:hover:not(:disabled) {
  background: #15803d;
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

.status {
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
  flex: 1;
}

/* ===========================
   OUTPUT SECTIONS
   =========================== */

.output {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(15,23,42,0.35);
  display: none;
}

/* AUTO-FIT GRID:
   each card min 320px, fills available width */
.output-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.section {
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--section-bg);
  border: 1px solid var(--section-border);
  box-shadow: 0 14px 30px rgba(15,23,42,0.25);
  color: var(--section-text);
}

.section.wide {
  grid-column: 1 / -1;
}

.section h2 {
  font-size: 18px;
  margin: 0 0 6px 0;
  color: var(--section-text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section h2 span.light {
  font-weight: 400;
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0;
  text-transform: none;
}

/* MAIN CONTENT TEXT INSIDE SECTIONS – bumped up for readability */
.section-body {
  font-size: 18px;
  color: var(--section-text);
  line-height: 1.7;
}

/* ===========================
   PILLS
   =========================== */

.pill-list {
  margin-top: 2px;
}

.pill-list span {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--pill-bg);
  margin: 0 6px 6px 0;
  font-size: 14px;
  border: 1px solid var(--pill-border);
  color: #f9fafb;
  white-space: nowrap;
  overflow: hidden;
}

/* override pills: show plain text for four sections,
   and match the larger body size */
#facts span,
#emotions span,
#noise span,
#assumptions span {
  display: block;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  margin: 0 0 4px 0;
  font-size: 18px;
  color: var(--section-text);
  white-space: normal;
}

.pill-list .small {
  font-size: 14px;
  color: var(--text-muted);
  background: transparent;
  border: none;
}

/* ===========================
   NEXT STEPS
   =========================== */

.next-steps {
  padding-left: 20px;
  margin: 4px 0 0;
  font-size: 18px;
  color: var(--section-text);
  line-height: 1.7;
}

.next-steps li {
  margin-bottom: 6px;
}

.footer-note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

/* ===========================
   RESPONSIVE
   =========================== */

@media (max-width: 900px) {
  .page {
    padding: 24px clamp(12px, 4vw, 24px) 36px;
  }

  .container {
    padding: 22px clamp(14px, 3vw, 22px) 20px;
  }
}

@media (max-width: 600px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }

  h1 {
    font-size: 26px;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  button {
    width: 100%;
    justify-content: center;
  }

  .status {
    text-align: left;
  }
}
