/* LogSieve Styles */

/* CSS Variables */
:root {
  --bg: #fafafa;
  --panel: #ffffff;
  --muted: #6b7280;
  --ink: #111827;
  --accent: #3b82f6;
  --accent2: #f59e0b;
  --ok: #10b981;
  --warn: #f59e0b;
  --err: #ef4444;
  --ring: rgba(59, 130, 246, 0.2);
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Dark Theme Variables */
:root.dark-theme {
  --bg: #0f172a;
  --panel: #1e293b;
  --muted: #94a3b8;
  --ink: #f8fafc;
  --accent: #60a5fa;
  --accent2: #fbbf24;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --ring: rgba(96, 165, 250, 0.3);
  --border: #334155;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3), 0 4px 6px rgba(0, 0, 0, 0.2);
}

/* Base Styles */
* {
  box-sizing: border-box;
}

html {
  /* Use 16px as base for better accessibility and zoom support */
  font-size: 16px;
}

body {
  margin: 0;
  font: 0.875rem/1.4 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--ink);
}

@media (max-width: 768px) {
  html {
    /* Slightly larger base font on mobile */
    font-size: 16px;
  }
}

/* Header */
header {
  padding: 0.375rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

:root.dark-theme header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

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

.header-top h1 {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Button-like Links in Header */
header a.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0.35rem 0.625rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--ink);
  background-color: var(--panel);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

header a.tag:hover {
  background-color: var(--accent);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

@media (max-width: 768px) {
  header {
    padding: 0.875rem 1rem;
  }
  
  .header-top h1 {
    font-size: 0.875rem;
  }
  
  .header-links,
  .header-actions {
    width: 100%;
  }
  
  header a.tag {
    flex: 1 1 auto;
    min-width: calc(50% - 0.25rem);
    font-size: 0.8125rem;
  }
}

/* Layout */
.app-container {
  display: flex;
  min-height: calc(100vh - 200px);
}

main {
  padding: 0.75rem;
  margin: 0 auto;
  max-width: 100%;
}

.grid {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 900px) {
  .grid {
    grid-template-columns: 1fr 280px;
  }
}

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
}

:root.dark-theme .card {
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  letter-spacing: .02em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

:root.dark-theme .card h2 {
  border-bottom: 1px solid var(--border);
}

.pad {
  padding: 0.375rem;
}

/* Form Controls */
.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.375rem;
}

.controls .wide {
  grid-column: 1 / -1;
}

/* Wide label variant used in other contexts (not only in .controls) */
label.wide {
  display: block;
  width: 100%;
}

.controls label {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--muted);
}

input[type="text"],
input[type="search"],
input[type="datetime-local"],
select,
textarea {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  outline: none;
  font-size: 0.875rem;
  min-height: 2.125rem;
}

:root.dark-theme input[type="text"],
:root.dark-theme input[type="search"],
:root.dark-theme input[type="datetime-local"],
:root.dark-theme select,
:root.dark-theme textarea {
  background: var(--panel);
  border: 1px solid var(--border);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
  outline: none;
}

@media (max-width: 768px) {
  .controls {
    grid-template-columns: 1fr;
  }
  
  .controls .wide {
    grid-column: 1;
  }
}

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  padding: 0.375rem 0.625rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  min-height: 2.125rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

:root.dark-theme .btn {
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn:active {
  transform: translateY(0);
}

.btn.ghost {
  background: transparent;
  box-shadow: none;
}

:root.dark-theme .btn.ghost {
  background: transparent;
}

/* Dropdown Styles */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  cursor: pointer;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  min-width: 150px;
  padding: 0.5rem 0;
}

:root.dark-theme .dropdown-menu {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.dropdown-menu.show {
  display: block;
}

.dropdown-menu a,
.dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 1rem;
  border: none;
  background: none;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.875rem;
  text-decoration: none;
  transition: background 0.2s ease;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
  background: rgba(59, 130, 246, 0.1);
}

.dropdown-submenu {
  position: relative;
}

.dropdown-submenu .dropdown-menu {
  top: -0.5rem;
  left: 100%;
  margin-left: 0.25rem;
}

.dropdown-submenu-toggle::after {
  content: '▶';
  float: right;
  font-size: 0.75rem;
  margin-left: auto;
}

/* Dropdown Group */
.dropdown-group {
  display: flex;
  align-items: center;
  gap: 0;
}

/* Theme Toggle Button */
.theme-toggle {
  min-width: 2.75rem;
  padding: 0.625rem;
}

.theme-icon {
  font-size: 1rem;
  line-height: 1;
}

/* Hamburger menu deprecated — removed in layout (no sidebar) */

@media (max-width: 900px) {
  /* Hamburger removed */

  /* Keep the theme toggle hidden by default; show next to hamburger on small screens */
  .small-theme { display: inline-flex; margin-left: 48px; }
}

/* Extra tight layout for very small screens */
@media (max-width: 480px) {
  header { padding: 0.5rem; }
  .pad { padding: 0.25rem; }
  .section-header { padding: 0.5rem; font-size: 0.9rem; }
  .section-card { margin-bottom: 0.5rem; }
  .controls { gap: 6px; }
  .btn { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
  .tab-btn { padding: 6px 8px; }
  table { min-width: 650px; }
  thead th { font-size: 0.7rem; padding: 0.25rem 0.5rem; }
  tbody td { padding: 0.35rem 0.5rem; font-size: 0.8rem; }
}

@media (max-width: 768px) {
  .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
}

/* Drag & Drop */
.drop {
  border: 2px dashed var(--border);
  border-radius: 0.5rem;
  padding: 1.25rem 0.75rem;
  text-align: center;
  color: var(--muted);
}

:root.dark-theme .drop {
  border: 2px dashed var(--border);
}

.drop.drag {
  background: rgba(59, 130, 246, .08);
  border-color: var(--accent);
}

/* Tags & Pills */
.tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  font: 0.75rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--panel);
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

:root.dark-theme .tag {
  background: var(--panel);
  border: 1px solid var(--border);
}

.pill {
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font: 0.75rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
}

:root.dark-theme .pill {
  border: 1px solid var(--border);
}

@media (max-width: 768px) {
  .tag {
    font-size: 0.8125rem;
    padding: 0.5rem 0.875rem;
  }
}

/* Statistics */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem;
  box-shadow: var(--shadow);
}

:root.dark-theme .stat {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.stat .k {
  font-size: 11px;
  color: var(--muted);
}

.stat .v {
  font: 600 18px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.stat.ok .v {
  color: var(--ok);
}

.stat.warn .v {
  color: var(--warn);
}

.stat.err .v {
  color: var(--err);
}

/* Tables */
.table-container {
  margin: 0 -0.5rem;
  padding: 0 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.375rem;
  min-width: 600px;
  table-layout: fixed;
}

thead th {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: left;
  padding: 0.5rem 0.625rem;
  white-space: nowrap;
}

tbody td {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: none;
  border-right: none;
  padding: 0.5rem 0.75rem;
  vertical-align: top;
  font-size: 0.875rem;
  /* Avoid breaking single characters across lines on narrow screens */
  word-break: normal;
  overflow-wrap: break-word;
  max-width: 80ch;
}

:root.dark-theme tbody td {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: none;
  border-right: none;
}

tbody td pre {
  /* Keep natural line breaks but avoid crushing text into vertical single characters */
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: anywhere;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

tbody tr td:first-child {
  border-left: 1px solid var(--border);
  border-top-left-radius: 0.5rem;
  border-bottom-left-radius: 0.5rem;
}

:root.dark-theme tbody tr td:first-child {
  border-left: 1px solid var(--border);
}

tbody tr td:last-child {
  border-right: 1px solid var(--border);
  border-top-right-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
}

:root.dark-theme tbody tr td:last-child {
  border-right: 1px solid var(--border);
}

@media (max-width: 768px) {
  table {
    /* On small screens let the table layout adapt naturally so message column can stretch */
    min-width: 550px;
    table-layout: auto;
  }
  
  thead th {
    font-size: 0.6875rem;
    padding: 0.375rem 0.5rem;
  }
  
  tbody td {
    padding: 0.5rem 0.625rem;
    font-size: 0.8125rem;
  }
}

/* Code & Text */
code,
pre {
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

details summary {
  cursor: pointer;
  color: var(--accent);
}

/* Help TOC arrow rotation */
details .help-toc-arrow { transition: transform 0.2s ease; display:inline-block; font-size:10px; color:var(--muted); }
details[open] > summary .help-toc-arrow { transform: rotate(90deg); }

/* Saved filter dropdown - match other inputs */
#savedFilterSelect {
  width: 100%;
  margin-top: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.375rem 0.5rem;
}

/* Log Level Colors */
.lvl-INFO {
  color: #7ee787;
}

.lvl-WARNING {
  color: #ffd166;
}

.lvl-ERROR {
  color: #ff6b6b;
}

.lvl-DEBUG {
  color: #79c0ff;
}

.lvl-CRITICAL {
  color: #ff8fab;
}

/* Utility Classes */
.flex {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.right {
  margin-left: auto;
}

@media (max-width: 768px) {
  .flex {
    width: 100%;
  }
  
  .flex .right {
    margin-left: 0;
    width: 100%;
  }
}

/* Pagination */
.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Canvas */
canvas {
  width: 100%;
  height: 80px;
  display: block;
}

/* RegexLab Output */
.out {
  white-space: pre-wrap;
  word-wrap: anywhere;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem;
  min-height: 220px;
}

:root.dark-theme .out {
  border: 1px solid var(--border);
}

/* RegexLab specific classes */
.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.cols {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 900px) {
  .cols {
    grid-template-columns: 1fr;
  }
}

.groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--panel);
}

:root.dark-theme .group {
  border: 1px solid var(--border);
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.k {
  color: var(--muted);
  font-size: 11px;
}

.explainer {
  font-size: 13px;
  line-height: 1.5;
}

.explainer code {
  background: var(--panel);
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.pipeline-alert {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 0.5rem;
  padding: 0.625rem 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.4;
}

.pipeline-alert.error {
  border-color: var(--err);
}

.pipeline-alert .title {
  font-weight: 700;
  color: var(--err);
  margin-bottom: 0.25rem;
}

.pipeline-alert ul {
  margin: 0.25rem 0 0 1rem;
  padding: 0;
}

:root.dark-theme .explainer code {
  border: 1px solid var(--border);
}

.flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

:root.dark-theme .flag {
  border: 1px solid var(--border);
}

.footer {
  padding: 8px 16px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.muted {
  color: var(--muted);
}

.wide-input {
  width: 100%;
}

/* Collapsible Sections */
.collapsible-header {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  border-radius: 0.375rem;
  padding: 0.25rem 0.5rem;
  margin: -0.25rem -0.5rem;
}

.collapsible-header:hover {
  background: rgba(59, 130, 246, .08);
}

.collapse-icon {
  transition: transform 0.2s;
  font-size: 10px;
}

.collapsible-header.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.collapsible-content {
  max-height: 2000px;
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
  opacity: 1;
}

.collapsible-content.collapsed {
  max-height: 0;
  opacity: 0;
}

/* Tabs for Search Tools */
.tabs { display: block; }
.tab-nav { display:flex; gap:8px; margin-bottom:12px; align-items:center; }
.tab-btn { appearance:none; border:1px solid var(--border); background:transparent; color:var(--muted); padding:6px 10px; border-radius:6px; cursor:pointer; font-weight:600;}
.tab-btn.active { background:var(--panel); color:var(--accent); border-color:var(--accent); box-shadow:var(--shadow); }
.tab-panel { display:block; }

@media (max-width:768px) {
  .tab-nav { flex-wrap:wrap; gap:6px; }
  .tab-btn { padding:8px 10px; }
}

/* Library Lists */
.library-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.library-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.library-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

:root.dark-theme .library-item {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.library-item-content {
  flex: 1;
  min-width: 0;
}

.library-item-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
}

.library-item-desc {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.library-item-pattern {
  font: 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.library-item-actions button {
  padding: 6px 10px;
  font-size: 12px;
  min-width: unset;
}

.library-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
}

/* Filter Item Specific */
.filter-item-settings {
  font: 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-item-settings span {
  background: var(--panel);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

:root.dark-theme .filter-item-settings span {
  background: var(--panel);
  border: 1px solid var(--border);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
}

:root.dark-theme .modal-content {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

:root.dark-theme .modal-header {
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.modal-close:hover {
  background: rgba(184, 197, 209, .2);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-body label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.modal-body input[type="text"],
.modal-body textarea {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.625rem;
  outline: none;
  font-family: inherit;
}

:root.dark-theme .modal-body input[type="text"],
:root.dark-theme .modal-body textarea {
  background: var(--panel);
  border: 1px solid var(--border);
}

.modal-body textarea {
  font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
}

.modal-body input:focus,
.modal-body textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.modal-body input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

:root.dark-theme .modal-footer {
  border-top: 1px solid var(--border);
}

.filter-preview {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem;
  font-size: 12px;
}

:root.dark-theme .filter-preview {
  background: var(--panel);
  border: 1px solid var(--border);
}

/* Info section styles */
.pad p {
  margin: 0 0 12px 0;
}

.pad ul {
  margin: 8px 0;
}

.pad li {
  margin: 4px 0;
}

.pad code {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--accent);
}

:root.dark-theme .pad code {
  background: var(--panel);
  border: 1px solid var(--border);
}

/* Sidebar and nav-link removed */

/* Mobile Sidebar Overlay */
/* Mobile sidebar overlay rules removed */

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 0.75rem;
  overflow-x: hidden;
}

/* Section Cards (Accordion) */
.section-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 0.5rem;
  overflow: hidden;
}

:root.dark-theme .section-card {
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.section-header {
  margin: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  letter-spacing: .02em;
  color: var(--ink);
  background: rgba(59, 130, 246, .08);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  transition: background 0.2s ease;
}

:root.dark-theme .section-header {
  border-bottom: 1px solid var(--border);
}

.section-header:hover {
  background: rgba(59, 130, 246, .15);
}

.section-icon {
  font-size: 1.125rem;
  line-height: 1;
}

.section-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.section-card.active .section-content {
  max-height: 5000px;
  transition: max-height 0.5s ease-in;
}

/* Always visible sections don't collapse */
.section-card.always-visible .section-header {
  cursor: default;
  background: transparent;
}

.section-card.always-visible .section-header:hover {
  background: transparent;
}

.section-card.always-visible .section-content {
  max-height: none;
  overflow: visible;
}

/* Progress Bars */
.progress-container {
  margin: 8px 0;
  display: none;
}

.progress-container.visible {
  display: block;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(229, 231, 235, 0.5);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

:root.dark-theme .progress-bar {
  background: rgba(51, 65, 85, 0.5);
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 4px;
}

.progress-text {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  text-align: center;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .library-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .library-item-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  
  .library-item-actions button {
    flex: 1 1 auto;
    min-width: 100px;
  }
  
  /* Make pagination buttons larger on mobile */
  .pagination .btn {
    min-width: 2.75rem;
    padding: 0.75rem;
  }
  
  /* Improve drag and drop area on mobile */
  .drop {
    padding: 2rem 1rem;
    font-size: 0.9375rem;
  }
  
  /* Modal improvements for mobile */
  .modal {
    padding: 1rem;
  }
  
  .modal-content {
    max-height: 85vh;
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .modal-footer {
    padding: 1rem;
    flex-direction: column;
  }
  
  .modal-footer .btn {
    width: 100%;
  }
  
/* Sidebar completely removed; no desktop collapsed state needed */
}