/* Viktor Notes - Professional Dark Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-card: #1a1a1a;
  --bg-hover: #252525;
  --bg-input: #1f1f1f;
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --border: #27272a;
  --border-light: #3f3f46;
  --success: #22c55e;
  --error: #ef4444;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Landing Page */
.landing-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  overflow: auto;
}

.landing-content {
  text-align: center;
  padding: 2rem;
  max-width: 500px;
}

.landing-logo {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  margin: 0 auto 2rem;
  box-shadow: 0 20px 60px var(--accent-glow);
}

.landing-content h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-content > p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 2.5rem;
  line-height: 1.6;
}

.google-signin-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 1rem 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.google-signin-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.landing-features {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.feature-icon {
  font-size: 1.5rem;
}

.feature span:last-child {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.landing-footer {
  margin-top: 3rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Notes App Container */
.notes-app {
  display: flex;
  height: 100vh;
  width: 100%;
}

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

.sidebar-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.brand-text {
  font-weight: 600;
  font-size: 1.1rem;
}

.sidebar-actions {
  padding: 1rem;
}

.new-note-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--accent);
  border: none;
  border-radius: 0.625rem;
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
  box-shadow: 0 0 20px var(--accent-glow);
}

.new-note-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.notes-list-header {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notes-list-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

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

.notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.5rem 0.5rem;
}

.empty-notes {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-notes p:first-child {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.empty-hint {
  font-size: 0.8rem;
  opacity: 0.7;
}

.note-item {
  padding: 0.75rem 0.875rem;
  border-radius: 0.5rem;
  cursor: pointer;
  margin-bottom: 0.25rem;
  transition: all 0.15s;
}

.note-item:hover {
  background: var(--bg-card);
}

.note-item.active {
  background: var(--bg-hover);
  border-left: 3px solid var(--accent);
}

.note-item-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.note-item-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.note-item-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.625rem;
  margin-bottom: 0.75rem;
}

.user-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.signout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.625rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.signout-btn:hover {
  background: var(--bg-hover);
  color: var(--error);
  border-color: var(--error);
}

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-primary);
}

.main-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.main-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text-primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.note-title-input {
  flex: 1;
  background: none;
  border: none;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
}

.note-title-input::placeholder {
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.save-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.save-status.saved {
  color: var(--success);
}

.delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--error);
  color: var(--error);
}

/* Editor */
.editor-container {
  flex: 1;
  padding: 1.5rem;
  overflow: hidden;
}

.note-editor {
  width: 100%;
  height: 100%;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.8;
  resize: none;
  outline: none;
}

.note-editor::placeholder {
  color: var(--text-muted);
}

.editor-footer {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  border-radius: 0.625rem;
  font-size: 0.9rem;
  z-index: 1001;
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.error {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    z-index: 100;
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .sidebar-overlay.open {
    display: block;
    opacity: 1;
  }

  .menu-btn {
    display: flex;
  }

  .main-header {
    padding: 0.75rem 1rem;
  }

  .note-title-input {
    font-size: 1.1rem;
  }

  .editor-container {
    padding: 1rem;
  }

  .note-editor {
    font-size: 0.95rem;
  }

  .editor-footer {
    padding: 0.625rem 1rem;
  }
}

@media (max-width: 380px) {
  .landing-content {
    padding: 1.5rem;
  }

  .landing-content h1 {
    font-size: 2rem;
  }

  .landing-features {
    flex-direction: column;
    gap: 1.25rem;
  }
}
