:root {
  /* Light mode colors */
  --bg-primary: #f8f9fa;
  --bg-secondary: #fff;
  --bg-task: #e3eafc;
  --bg-column: #fff;
  --bg-input: #e6e1d1;

  --text-primary: #333;
  --text-secondary: #2c3e50;
  --text-muted: #666;
  --text-light: #888;

  --border-color: #ccc;
  --border-light: #eee;

  --shadow-color: rgba(0, 0, 0, 0.05);
  --shadow-medium: rgba(0, 0, 0, 0.08);
  --shadow-strong: rgba(0, 0, 0, 0.15);

  --tag-bg: #e0e0e0;
  --tag-text: #333;

  --btn-bg: #fff;
  --btn-hover: #f0f0f0;

  --modal-overlay: rgba(0, 0, 0, 0.3);
  --modal-bg: #fff;
  --modal-text: #222;

  --color-primary: #2196f3;
  --color-secondary: #1976d2;
  --color-success: rgba(17, 153, 142, 0.9);
  --color-success-light: rgba(82, 214, 107, 0.9);
  --color-danger: #a14946;
  --color-danger-dark: #6a2222;
  --color-link: #007bff;
  --color-on-primary: #fff;

  --color-storage-bg: rgba(0, 0, 0, 0.8);
  --color-storage-text: #fff;
}

body.darkmode {
  /* Dark mode colors */
  --bg-primary: #181a1b;
  --bg-secondary: #23272b;
  --bg-task: #31363b;
  --bg-column: #23272b;
  --bg-input: #23272b;

  --text-primary: #e0e0e0;
  --text-secondary: #fff;
  --text-muted: #888;
  --text-light: #bbb;

  --border-color: #444;
  --border-light: #666;

  --shadow-color: rgba(0, 0, 0, 0.3);
  --shadow-medium: rgba(0, 0, 0, 0.5);
  --shadow-strong: rgba(0, 0, 0, 0.5);

  --tag-bg: #444;
  --tag-text: #e0e0e0;

  --btn-bg: #23272b;
  --btn-hover: rgba(255, 255, 255, 0.1);

  --modal-overlay: rgba(20, 20, 20, 0.7);
  --modal-bg: #23272e;
  --modal-text: #f3f3f3;

  --color-link: #90caf9;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text-primary);
}

a {
  color: var(--color-link);
}

.main-content {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.board {
  display: flex;
  gap: 32px;
  justify-content: center;
  margin-top: 20px;
  margin-left: auto;
  margin-right: auto;
  width: 90%;
  max-width: 100vw;
}

.column {
  background: var(--bg-column);
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--shadow-color);
  padding: 0 16px 16px 16px;
  min-width: 320px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
}

.column h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  min-height: 43px;
}

.icebox-column {
  position: fixed;
  left: 0;
  top: 10vh;
  z-index: 100;
  width: 320px;
  min-width: unset;
  height: 80vh;
  overflow: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-column);
  border-radius: 0 8px 8px 0;
  box-shadow: 2px 0 12px var(--shadow-medium);
  transform: translateX(-285px);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.icebox-column.expand {
  transform: translateX(0);
  box-shadow: 6px 0 32px var(--shadow-strong);
}


.icebox-column h2 {
  position: sticky;
  top: 0;
  padding: 0.83em;
  margin: 0;
  z-index: 4;
  background: var(--bg-column);
  justify-content: flex-start;
  white-space: nowrap;
  overflow: hidden;
}

.icebox-label {
  font-size: 1.3em;
  flex-shrink: 0;
}

.icebox-title {
  flex: 1;
  margin-left: 8px;
}

.task {
  position: relative; /* for absolute elements inside*/
  background: var(--bg-task);
  border-radius: 5px;
  padding: 10px;
  margin: 5px 0 5px 0;
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.task.dragging {
  opacity: 0.5;
}

/* Divider task styling - compact and highlighted */
.task.task-divider {
  padding: 10px 10px 10px 6px; /* space for left border */
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: var(--color-on-primary);
  font-weight: 600;
  border-left: 4px solid var(--color-secondary);
  box-shadow: 0 2px 4px var(--shadow-medium);
}

.task.task-divider .divider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.task.task-divider .task-type-btn {
  flex-shrink: 0;
  color: var(--color-on-primary);
  border-radius: 4px;
  font-size: 0.9em;
  cursor: pointer;
  transition: background 0.2s;
}

.task.task-divider .divider-text {
  flex: 1;
  text-align: center;
  font-size: 0.95em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task.task-divider .delete-task-btn {
  flex-shrink: 0;
  color: var(--color-on-primary);
}

.task.task-divider .delete-task-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

.task-placeholder {
  border-top: 3px solid var(--color-primary);
  margin: 2px 0;
}

.task img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 4px 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  min-height: 24px;
}

.tag-label {
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.85em;
  display: flex;
  align-items: center;
  margin-right: 2px;
}

.remove-tag {
  background: none;
  border: none;
  margin-left: 4px;
  cursor: pointer;
  font-size: 1em;
  color: var(--text-light);
}

.add-tag-input {
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: 12px;
  font-size: 0.85em;
  margin-left: 4px;
  margin-top: 2px;
  padding: 2px 0 2px 10px;
  min-width: 60px;
  display: inline-block;
  visibility: hidden;
}

.task:hover .add-tag-input {
  visibility: visible;
}

.add-tag-input:focus {
  visibility: visible;
}

.add-task {
  cursor: pointer;
  font-size: 1.5em;
  margin-left: 8px;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.add-task:hover {
  color: var(--color-link) !important;
}

.btn {
  font-family: inherit;
  font-size: 1em;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: var(--btn-bg);
  color: var(--text-primary);
  box-shadow: 0 2px 8px var(--shadow-medium);
  transition: background 0.2s, box-shadow 0.2s;
}

/* Floating controls container */
.floating-controls {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

/* Base styles for floating control buttons */
.floating-controls button {
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

/* Small floating buttons (settings, download, etc.) */
.floating-control-secondary {
  font-size: 0.9em;
  background: var(--btn-bg);
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px var(--shadow-medium);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
}

.floating-control-secondary {
  background: var(--btn-hover);
}

/* Dark mode toggle button */
.floating-control-primary {
  font-size: 1.8em;
  background: var(--text-secondary);
  color: var(--bg-secondary);
  border: none;
  width: 56px;
  height: 56px;
  box-shadow: 0 2px 8px var(--shadow-strong);
  transition: background 0.2s, color 0.2s;
}

/* Floating control tooltips */
.floating-controls button {
  position: relative;
}

.floating-controls button:hover::after,
.floating-controls button:focus::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 12px;
  background: var(--bg-secondary);
  color: var(--modal-text);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.85em;
  box-shadow: 0 2px 8px var(--shadow-medium);
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}

/* Hourglass icon and tooltip */
.task-hourglass {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 1.1em;
  color: var(--text-light);
  cursor: pointer;
  z-index: 2;
  background: none;
  border: none;
  padding: 0;
}

.task-hourglass:hover + .hourglass-tooltip,
.task-hourglass:focus + .hourglass-tooltip {
  display: block;
}

.hourglass-tooltip {
  display: none;
  position: absolute;
  bottom: 32px;
  right: 8px;
  background: var(--bg-secondary);
  color: var(--modal-text);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.95em;
  box-shadow: 0 2px 8px var(--shadow-medium);
  white-space: nowrap;
  z-index: 10;
}

.delete-task-btn {
  visibility: hidden;
  cursor: pointer;
  line-height: 19px;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
}

.status-advance-btn {
  visibility: hidden;
  cursor: pointer;
  background: transparent;
  border: none;
  line-height: 1;
  font-size: 1.05em;
  opacity: 0.7;
  padding: 2px 4px;
}

.task:hover .status-advance-btn,
.task:focus-within .status-advance-btn {
  visibility: visible;
}

.status-advance-btn:hover {
  opacity: 1;
}

.status-advance-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  border-radius: 4px;
}

.task:hover .delete-task-btn {
  visibility: visible;
}


.type-dropdown {
  position: relative;
  left: 40px;
  margin-top: 4px;
  z-index: 100;


  font-family: inherit;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-secondary);
}


.type-option:hover {
  background: var(--btn-hover);
}

.type-option-selected {
  background: var(--color-primary);
  font-weight: bold;
}

/* Modal styles */
.modal {
  display: none; /* Hidden by default */
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  overflow: auto;
  background: var(--modal-overlay);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--modal-bg);
  margin: 10% auto;
  padding: 32px 24px 24px 24px;
  border-radius: 12px;
  width: 100%;
  max-width: 800px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
  position: relative;
  color: var(--modal-text);
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 1.5em;
  color: var(--text-light);
  cursor: pointer;
  transition: color 0.2s;
}

.close-btn:hover {
  color: var(--color-danger);
}

/* Settings Checkbox */
.checkbox-toggle input[type="checkbox"] {
  visibility: hidden;
  display: none;
}

.checkbox-toggle .toggle {
  position: relative;
  display: block;
  width: 42px;
  height: 24px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transform: translate3d(0, 0, 0);
}

.checkbox-toggle .toggle:before {
  content: "";
  position: relative;
  top: 1px;
  left: 1px;
  width: 40px;
  height: 22px;
  display: block;
  background: var(--border-color);
  border-radius: 12px;
  transition: background 0.2s ease;
}

.checkbox-toggle .toggle span {
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  display: block;
  background: var(--bg-secondary);
  border-radius: 50%;
  box-shadow: 0 2px 6px var(--shadow-medium);
  transition: all 0.2s ease;
}

.checkbox-toggle .toggle span svg {
  margin: 7px;
  fill: none;
}

.checkbox-toggle .toggle span svg path {
  stroke: var(--border-color);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;
  stroke-dashoffset: 0;
  transition: all 0.5s linear;
}

.checkbox-toggle input[type="checkbox"]:checked + .toggle:before {
  background: var(--color-success-light);
}

.checkbox-toggle input[type="checkbox"]:checked + .toggle span {
  transform: translateX(18px);
}

.checkbox-toggle input[type="checkbox"]:checked + .toggle span path {
  stroke: var(--color-success-light);
  stroke-dasharray: 25;
  stroke-dashoffset: 25;
}

.add-beneath-btn {
  display: flex;
  width: 100%;
  height: 28px;
  background: var(--btn-bg);
  border: 1px dashed var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  justify-content: center;
  align-items: center;
  color: var(--text-muted);
  font-size: 1.2em;
  transition: all 0.2s ease;
}

.add-beneath-btn:hover {
  background: var(--btn-hover);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.task:hover .add-beneath-btn {
  opacity: 1;
  visibility: visible;
}

/* Task editing textarea */
.edit-input {
  background: var(--bg-input);
  color: var(--text-primary);
  width: 95%;
  min-height: 12em;
  resize: vertical;
  margin: 8px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 8px;
  font-family: inherit;
  font-size: inherit;
}

.edit-input:focus {
  outline: none;
  border-color: #2196f3;
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

/* Task header and ID row */
.task-id-row {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.task-type-btn {
  position: relative;
  margin-right: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  vertical-align: middle;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.task-type-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.task-type-icon {
  font-size: 1.2em;
}

.task-id {
  display: inline-block;
  font-weight: 500;
  color: var(--text-muted);
  flex: 1;
}


.column#done-col .task-id {
  display: block !important;
  flex: unset !important;
}

/* Type dropdown styling improvements */
.type-dropdown {
  position: absolute;
  z-index: 1000;
  display: none;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 2px 8px var(--shadow-strong);
  margin-top: 4px;
  overflow: hidden;
}

.type-option {
  color: var(--text-primary);
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.type-icon {
  font-size: 1.2em;
  margin-right: 4px;
}

/* Tag suggestion box */
.tag-input-wrapper {
  position: relative;
  display: inline-block;
}

.tag-suggestion-box {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--shadow-medium);
  z-index: 10;
  display: none;
  min-width: 100px;
  max-height: 120px;
  overflow-y: auto;
  background: var(--bg-secondary);
}

.tag-suggestion-item {
  padding: 4px 8px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.tag-suggestion-item:hover,
.tag-suggestion-item.selected {
  background: #f3f4f6;
}

body.darkmode .tag-suggestion-item:hover,
body.darkmode .tag-suggestion-item.selected {
  background: var(--btn-hover);
}

/* Modal overlay and box */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.modal-box {
  background: var(--modal-bg);
  color: var(--modal-text);
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
  text-align: center;
  max-width: 700px;
  width: 90%;
}

/* Modal buttons */
.modal-btn {
  border: none;
  padding: 8px 24px;
  margin: 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95em;
  transition: all 0.2s;
}

.modal-btn-confirm {
  background: #e53935;
  color: #fff;
}

.modal-btn-confirm:hover {
  background: #b71c1c;
}

.modal-btn-cancel {
  background: #eee;
  color: #333;
}

.modal-btn-cancel:hover {
  background: #ddd;
}

/* Collapsed title */
.collapsed-title {
  display: inline-block;
  flex: 1;
}

/* Collapsed row */
.collapsed-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Button group for collapse and delete buttons in done column */
.done-button-group {
  position: absolute;
  top: 16px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Task placeholder for drag and drop */
.task-placeholder {
  height: 0;
  border-top: 3px solid #2196f3;
  margin: 2px 0;
  transition: border-color 0.2s;
}

/* Task text placeholder */
.task-text-placeholder {
  font-style: italic;
  color: #888;
}

/* Demo banner */
.page-banner {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: var(--color-on-primary, #fff);
  padding: 12px 20px;
  text-align: center;
  font-weight: 500;
  box-shadow: 0 2px 8px var(--shadow-color, rgba(0, 0, 0, 0.15));
  display: none; /* Hidden by default, shown in page mode */
}

.page-banner.fs-active {
  background: linear-gradient(135deg, var(--color-success) 0%, var(--color-success-light) 100%);
}

.page-banner a {
  color: #fff;
  text-decoration: underline;
  font-weight: 600;
}

.page-banner a:hover {
  opacity: 0.9;
}

.storage-mode-indicator {
  position: fixed;
  top: 60px;
  right: 20px;
  background: var(--color-storage-bg, rgba(0, 0, 0, 0.8));
  color: var(--color-storage-text, #fff);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.9em;
  z-index: 1000;
  display: none; /* Hidden by default, shown in page mode */
  cursor: pointer;
}

.storage-mode-indicator.filesystem {
  background: var(--color-success, rgba(17, 153, 142, 0.9));
}

/* Load error home button - use primary color instead of danger */
.load-error-home-btn {
  background: var(--color-primary, #2196f3);
}

.load-error-home-btn:hover {
  background: var(--color-secondary, #1976d2);
}

/* Help modal */
.help-modal-body {
  text-align: left;
  font-size: 0.93em;
  line-height: 1.6;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}

.help-section {
  margin-bottom: 20px;
}

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

.help-section h4 {
  margin: 0 0 8px;
  font-size: 1em;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 4px;
}

.help-section p,
.help-section ul {
  margin: 0;
  color: var(--text-muted);
}

.help-section ul {
  padding-left: 20px;
}

.help-section li {
  margin-bottom: 4px;
}

.help-shortcuts {
  width: 100%;
  border-collapse: collapse;
  color: var(--text-muted);
}

.help-shortcuts td {
  padding: 6px 8px;
  vertical-align: top;
  border-bottom: 1px solid var(--border-light);
}

.help-shortcuts td:first-child {
  white-space: nowrap;
  padding-right: 16px;
}

.help-shortcuts tr:last-child td {
  border-bottom: none;
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 0.85em;
  font-family: monospace;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--border-color);
  color: var(--text-primary);
}

