body[data-theme="light"] {
  --bg: #f5f5f5;
  --card: #ffffff;
  --card-hover: #eeeeee;
  --text: #1a1a1a;
  --muted: #777777;
  --accent: #000000;
  --accent-hover: #333333;
  --border: #dddddd;
  --input-bg: #ffffff;
}

body[data-theme="dark"] {
  --bg: #121212;
  --card: #1e1e1e;
  --card-hover: #2a2a2a;
  --text: #eaeaea;
  --muted: #888888;
  --accent: #ffffff;
  --accent-hover: #cccccc;
  --border: #2c2c2c;
  --input-bg: #1a1a1a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Open Sans', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
  transition: all 0.2s;
}

.note-container {
  width: 100%;
  max-width: 400px;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.theme-btn,
.add-btn {
  font-size: 1.8rem;
  border: none;
  cursor: pointer;
  color: var(--accent);
  padding: 0.1rem 0.6rem;
  background-color: var(--border);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s, color 0.2s;
}

.add-btn:active {
  transform: rotate(90deg) scale(0.98);
}

/* Search */
.search {
  width: 100%;
  padding: 0.9rem 0.8rem;
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  border: 2px solid transparent;
  outline: none;
  margin-bottom: 1.2rem;
  font-size: 0.85rem;
  transition: background 0.2s, border 0.2s;
}

.search:focus {
  border: 2px solid var(--accent);
}

::placeholder {
  color: var(--muted);
}

/* Notes */
.note {
  background: var(--card);
  border-radius: 10px;
  padding: 0.8rem;
  margin-bottom: 0.8rem;
  border-top: 6px solid transparent;
  transition: background 0.2s, border-top 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

@keyframes fadeOutSlide {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

.note.deleting {
  animation: fadeOutSlide 0.3s ease forwards;
}

.note:focus-within {
  border-top: 6px solid var(--accent);
}

.note:hover {
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  background: var(--card-hover);
}

/* Toolbar */
.note-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.note-toolbar .material-symbols-outlined {
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.2s;
}

.note-toolbar .material-symbols-outlined:hover {
  color: var(--accent);
}

.pin-btn {
  color: var(--muted);
  transition: color 0.2s;
}

.note.pinned {
  border-top: 2px solid var(--accent);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.note.pinned:focus-within {
  border-top: 6px solid var(--accent);
}

.note.pinned .pin-btn {
  color: var(--accent);
}

/* Editor & Preview */
.note-editor {
  width: 100%;
  min-height: 300px;
  border: none;
  resize: vertical;
  background: var(--input-bg);
  color: var(--text);
  padding: 0.5rem;
  font-size: 0.95rem;
  border-radius: 6px;
  outline: none;
  display: none;
}

.note-editor::-webkit-scrollbar {
  width: 8px;
}

.note-editor::-webkit-scrollbar-track {
  background: var(--input-bg);
  border-radius: 4px;
}

.note-editor::-webkit-scrollbar-thumb {
  background: var(--muted);
  cursor: default;
  border-radius: 4px;
}

.note-editor::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

.note.editing .note-editor {
  display: block;
}

.note.editing .note-timestamp {
  display: none;
}

/* Note Preview */
.note-preview {
  font-size: 0.95rem;
  line-height: 1.4;
  padding: 0 0.6rem;
  display: -webkit-box;
  animation: fadeSlide 0.2s;
  -webkit-line-clamp: 14;
  line-clamp: 14;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre-wrap;
}

.note.expanded .note-preview {
  max-height: none;
  -webkit-line-clamp: unset;
  line-clamp: unset;
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.note.editing .note-preview {
  display: none;
}

/* Empty state */
.empty {
  color: var(--muted);
  text-align: center;
  padding: 3.2rem 1rem;
}

/* Timestamp */
.note-timestamp {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.4rem;
  text-align: right;
  font-style: italic;
}

/* Highlighted text */
mark {
  background-color: #cfd8dc;
  color: #000;
  padding: 0.1rem;
  border-radius: 4px;
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  background: var(--card-hover);
  color: var(--text);
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-size: 0.80rem;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: scale(0.85) translateX(-50%);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 999;
}

.toast.show {
  transform: scale(1) translateX(-50%);
  opacity: 1;
}