* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e1e4ed;
  --text-dim: #8b8fa3;
  --accent: #6c8cff;
  --accent-dim: #4a6ad4;
  --tag-bg: #252836;
  --tag-text: #a3b1e0;
  --danger: #e05561;
  --success: #7ec98a;
  --mark-bg: rgba(108, 140, 255, 0.25);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

header h1 span {
  color: var(--accent);
}

header p {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.search-box {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-box input {
  width: 100%;
  padding: 0.9rem 1rem 0.9rem 2.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--accent);
}

.search-box .icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 1.1rem;
}

.stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dim);
}

.btn-danger {
  color: var(--danger);
  border-color: transparent;
  background: transparent;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
}

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

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

/* Add bookmark panel */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: none;
}

.panel.active {
  display: block;
}

.panel h3 {
  font-size: 0.95rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.form-group {
  margin-bottom: 0.75rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.loading-indicator {
  font-size: 0.8rem;
  color: var(--accent);
  margin-top: 0.3rem;
}

/* Results */
.results {
  list-style: none;
}

.result-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s;
}

.result-item:hover {
  border-color: var(--accent);
}

.result-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.result-title a {
  color: var(--accent);
  text-decoration: none;
}

.result-title a:hover {
  text-decoration: underline;
}

.result-url {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.result-desc mark {
  background: var(--mark-bg);
  color: var(--accent);
  padding: 0 2px;
  border-radius: 2px;
}

.result-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s;
}

.tag:hover {
  background: var(--accent);
  color: #fff;
}

.tag.active {
  background: var(--accent);
  color: #fff;
}

.active-toggle {
  border-color: var(--accent);
  color: var(--accent);
}

.secret-tag {
  background: rgba(224, 85, 97, 0.2);
  color: var(--danger);
  cursor: default;
}

.result-item.secret {
  border-left: 3px solid var(--danger);
}

.result-date {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* Tags sidebar */
.tags-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 1.5rem;
}

/* Import */
.import-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.2s;
}

.import-zone:hover {
  border-color: var(--accent);
}

.import-zone input[type="file"] {
  display: none;
}

.import-result {
  margin-top: 1rem;
  font-size: 0.85rem;
}

.import-result.success { color: var(--success); }
.import-result.error { color: var(--danger); }

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 100;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
}

.empty-state p {
  margin-bottom: 0.5rem;
}

footer {
  text-align: center;
  padding: 2rem 0 1rem;
  font-size: 0.8rem;
}

footer a {
  color: var(--text-dim);
  text-decoration: none;
}

footer a:hover {
  color: var(--accent);
}

@media (max-width: 600px) {
  .container { padding: 1rem 0.75rem; }
  header h1 { font-size: 1.4rem; }
}
