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

:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #0f3460;
  --accent: #e94560;
  --accent-hover: #ff6b6b;
  --text-primary: #eaeaea;
  --text-secondary: #a0a0a0;
  --border: #2a2a4a;
  --success: #4ade80;
  --warning: #fbbf24;
}

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

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.search-input {
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  width: 250px;
}

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

.search-input::placeholder {
  color: var(--text-secondary);
}

.stats {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Main Layout */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 320px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.create-form {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.create-form h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.create-form form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.create-form input,
.create-form textarea {
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
}

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

.create-form input::placeholder,
.create-form textarea::placeholder {
  color: var(--text-secondary);
}

/* Buttons */
.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

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

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

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

.btn-danger {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

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

/* Notes List */
.notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.note-item {
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 2px solid transparent;
}

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

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

.note-item h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item .note-date {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* Note View */
.note-view {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.note-detail {
  max-width: 700px;
}

.note-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.note-detail-title {
  font-size: 1.75rem;
  font-weight: 700;
  flex: 1;
}

.note-detail-title input {
  width: 100%;
  font-size: 1.75rem;
  font-weight: 700;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border);
  color: var(--text-primary);
  padding-bottom: 8px;
}

.note-detail-title input:focus {
  outline: none;
  border-color: var(--accent);
}

.note-detail-actions {
  display: flex;
  gap: 8px;
  margin-left: 16px;
}

.note-detail-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.note-detail-content {
  line-height: 1.7;
  white-space: pre-wrap;
}

.note-detail-content textarea {
  width: 100%;
  min-height: 300px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.7;
  resize: vertical;
}

.note-detail-content textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Loading & Messages */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

.message {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.message-success {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid var(--success);
  color: var(--success);
}

.message-error {
  background: rgba(233, 69, 96, 0.1);
  border: 1px solid var(--accent);
  color: var(--accent);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}
