:root {
  --bg: #f8f5e9;
  --fg: #2f3e46;
  --accent: #607274;
  --border: #d6d0c4;
  --font-family: "Courier New", monospace;
}

body[data-theme="classic"] {
  --bg: #f8f5e9;
  --fg: #2f3e46;
  --font-family: "Courier New", monospace;
  --accent: #607274;
  --border: #d6d0c4;
}

body[data-theme="monokai"] {
  --bg: #272822;
  --fg: #f8f8f2;
  --font-family: "Fira Code", "Courier New", monospace;
  --accent: #a6e22e;
  --border: #3e3d32;
}

body[data-theme="nord"] {
  --bg: #2e3440;
  --fg: #d8dee9;
  --font-family: "JetBrains Mono", "Fira Code", monospace;
  --accent: #88c0d0;
  --border: #4c566a;
}

body[data-theme="solar-light"] {
  --bg: #fdf6e3;
  --fg: #586e75;
  --font-family: "IBM Plex Mono", "Courier New", monospace;
  --accent: #268bd2;
  --border: #eee8d5;
}


body[data-theme="midnight"] {
  --bg: #1e1e2e;
  --fg: #cdd6f4;
  --font-family: "Cascadia Code", "JetBrains Mono", monospace;
  --accent: #89b4fa;
  --border: #313244;
}

body[data-theme="terminal"] {
  --bg: #0c0c0c;
  --fg: #33ff66;
  --font-family: "VT323", "Courier New", monospace;
  --accent: #00cc66;
  --border: #1a1a1a;
}

body {
  background: var(--bg);
  color: var(--fg);
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-family);
  transition: background 0.3s, color 0.3s;
}

.zen-header {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  overflow: hidden;
  height: 2rem;
}

.zen-header.collapsed {
  display: none;
}

.zen-wrapper {

  /* hide if mobile */
  @media (max-width: 768px) {
    display: none;
  }
}

#editor,
#preview {
  flex: 1;
}

#preview {
  display: none;
}

.zen-preview,
.zen-editor {
  /* no focus outline */
  outline: none;
  height: calc(100vh - 2rem);
  resize: none;
  width: 100%;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 1.5rem;
  border: none;
  font-size: 0.9rem;
  line-height: 1;
  color: var(--fg);
  background: var(--bg);
}

#btn-toggle-header {
  min-width: 2rem;
  padding: 0.4rem;
  transition: transform 0.3s ease;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 0.4rem;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

button:hover {
  opacity: 0.8;
}

/* Task list styling */
.task-list-item {
  list-style: none;
  margin-left: -1.5em;
}

.task-list-item input[type="checkbox"] {
  margin-right: 0.5em;
  vertical-align: middle;
  cursor: pointer;
  transform: scale(1.2);
}

/* List spacing */
ul,
ol {
  padding-left: 2em;
}

/* Nested lists (2nd level and beyond) */
ul ul,
ol ul,
ul ol,
ol ol {
  padding-left: 3em;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

/* Headings */
h1,
h2,
h3 {
  color: var(--accent);
  margin-top: 1.4em;
}

/* Horizontal rule */
hr {
  border: none;
  border-bottom: 1px solid var(--border);
  margin: 1.5em 0;
}

/* Inline code styling */
code {
  background: rgba(0, 0, 0, 0.05);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-family: "Fira Code", "Courier New", monospace;
  font-size: 0.9em;
  color: var(--fg);
  border: 1px solid var(--border);
}

/* Dark theme inline code adjustment */
body[data-theme="monokai"] code,
body[data-theme="nord"] code,
body[data-theme="midnight"] code,
body[data-theme="terminal"] code {
  background: rgba(255, 255, 255, 0.1);
}

/* Code blocks styling */
pre {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1em;
  overflow-x: auto;
  margin: 1em 0;
}

/* Dark theme code blocks adjustment */
body[data-theme="monokai"] pre,
body[data-theme="nord"] pre,
body[data-theme="midnight"] pre,
body[data-theme="terminal"] pre {
  background: rgba(255, 255, 255, 0.05);
}

/* Code inside pre (code blocks) */
pre code {
  background: none;
  border: none;
  padding: 0.5em;
  font-size: 0.85em;
  display: block;
  line-height: 1.5;
}

/* Table styling */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5em 0;
  font-size: 0.9em;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
}

/* Table headers */
thead th {
  background: var(--accent);
  color: white;
  font-weight: bold;
  text-align: left;
  padding: 0.75em 1em;
  border-bottom: 2px solid var(--border);
}

/* Table cells */
td {
  padding: 0.75em 1em;
  border-bottom: 1px solid var(--border);
}

/* Table rows */
tbody tr:hover {
  background: rgba(0, 0, 0, 0.03);
}

/* Dark theme table row hover */
body[data-theme="monokai"] tbody tr:hover,
body[data-theme="nord"] tbody tr:hover,
body[data-theme="midnight"] tbody tr:hover,
body[data-theme="terminal"] tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Remove border from last row */
tbody tr:last-child td {
  border-bottom: none;
}

/* Alternating row colors (zebra striping) */
tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

/* Dark theme zebra striping */
body[data-theme="monokai"] tbody tr:nth-child(even),
body[data-theme="nord"] tbody tr:nth-child(even),
body[data-theme="midnight"] tbody tr:nth-child(even),
body[data-theme="terminal"] tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

/* Table responsive wrapper */
.zen-preview table {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
  margin: 1em 0;
  padding: 1em;
  border: none;
}

/* Center-aligned cells (optional - for numeric columns) */
td:has(> code),
th:has(> code) {
  font-family: var(--font-family);
}
