:root {
  --bg: #0f0f23;
  --surface: #1a1a2e;
  --accent: #6c63ff;
  --accent-hover: #5a52e0;
  --text: #e0e0e0;
  --text-muted: #888;
  --border: #2a2a4a;
  --success: #4ade80;
  --danger: #f87171;
}

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

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

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

/* Login */
.login-box {
  max-width: 360px;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--surface);
  border-radius: 12px;
  text-align: center;
}

.login-box h1 {
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

header h1 {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

/* Forms */
input, textarea, button {
  font-family: inherit;
  font-size: 1rem;
}

input, textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

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

textarea {
  resize: vertical;
  min-height: 80px;
}

button {
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

button:hover {
  background: var(--accent-hover);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
}

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

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover {
  background: #ef4444;
}

.btn-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
}

/* Search & Filter Bar */
.toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.toolbar input {
  flex: 1;
  min-width: 200px;
}

.filter-btn {
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.875rem;
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Add Form */
.add-form {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 2rem;
}

.add-form h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.form-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.form-row input {
  flex: 1;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* Bookmark List */
.bookmark-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bookmark-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.25rem;
  transition: transform 0.2s;
}

.bookmark-card:hover {
  transform: translateY(-2px);
}

.bookmark-card.is-read {
  opacity: 0.7;
}

.bookmark-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.bookmark-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  word-break: break-word;
}

.bookmark-title:hover {
  color: var(--accent);
}

.bookmark-url {
  font-size: 0.8rem;
  color: var(--text-muted);
  word-break: break-all;
  margin-bottom: 0.5rem;
}

.bookmark-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bookmark-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.bookmark-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  padding: 0.2rem 0.6rem;
  background: var(--bg);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--accent);
  cursor: pointer;
}

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

.bookmark-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.bookmark-actions {
  display: flex;
  gap: 0.5rem;
}

.read-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: var(--success);
  color: var(--bg);
  border-radius: 4px;
}

/* Edit Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.modal {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  margin-bottom: 1rem;
}

.modal .form-group {
  margin-bottom: 1rem;
}

.modal label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 600px) {
  .container {
    padding: 1rem;
  }
  
  header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .form-row {
    flex-direction: column;
  }
  
  .bookmark-header {
    flex-direction: column;
  }
  
  .bookmark-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
