/* ============================================
   MANIESTA NOTES — COMPONENTS
   ============================================ */

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  transition: transform var(--transition-base);
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 1.375rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.sidebar-logo img {
  width: 40px;
  height: 40px;
  transition: transform var(--transition-base);
}

.sidebar-logo img:hover {
  transform: scale(1.05);
}

.nav-list {
  list-style: none;
  padding: 0.5rem 0.75rem;
  flex: 1;
  overflow-y: auto;
  justify-content: flex-start;   /* Aligns icon + text to the left */
  text-align: left;
}

.nav-item {
  margin-bottom: 0.125rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
}

.nav-link svg {
  width: 20px !important;
  height: 20px !important;
  flex-shrink: 0;
}

.nav-link:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  transform: translateX(2px);
}

.nav-link.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(79,70,229,0.3);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--primary-hover);
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-weight: 500;
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar footer logout button */
.sidebar-footer .btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  font-size: var(--text-sm);
  justify-content: flex-start;
}

.sidebar-footer .btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.sidebar-footer .btn svg {
  width: 20px !important;
  height: 20px !important;
}

/* ===== Header ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  transition: box-shadow var(--transition-base);
  gap: 1rem;
}

.header.scrolled {
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-title {
  font-size: var(--text-lg);
  font-weight: 600;
}

.header-search {
  flex: 1;
  max-width: 480px;
  margin: 0;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper svg {
  position: absolute;
  left: 0.75rem;
  width: 18px !important;
  height: 18px !important;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-wrapper input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.5rem;
  border-radius: var(--radius-full);
  background: var(--bg-soft);
  border: 1px solid transparent;
  transition: all var(--transition-base);
}

.search-input-wrapper input:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ===== Icon Buttons ===== */
.icon-btn {
  background: transparent;
  border: none;
  padding: 0.375rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.icon-btn svg {
  width: 20px !important;
  height: 20px !important;
}

/* ===== Note Grid & Cards ===== */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  padding: 1.5rem;
}

.note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
  will-change: transform;
}

.note-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.note-card.pinned {
  border-left: 4px solid var(--warning);
}

.note-card .note-title {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.note-card .note-preview {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-card .note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.note-card .tag {
  background: var(--surface-hover);
  color: var(--text-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
}

.note-card .note-meta {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.note-card .note-actions {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.75rem;
}

.note-actions .icon-btn svg {
  width: 18px !important;
  height: 18px !important;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 500px;
  width: 90%;
  animation: modalIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.1);
  box-shadow: var(--shadow-xl);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { transform: scale(0.95) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* ===== Toast ===== */
.toast-root {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--primary); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem 1rem;
  text-align: center;
}

.empty-state .empty-icon {
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.empty-state svg {
  width: 64px !important;
  height: 64px !important;
  max-width: 64px !important;
  max-height: 64px !important;
}

.empty-state h3 {
  font-size: var(--text-lg);
  font-weight: 600;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

/* ===== Loader ===== */
.spinner {
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  animation: spin 0.8s linear infinite;
  margin: auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.app-loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 999;
}

/* ===== Mobile Sidebar Overlay ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: calc(var(--z-sidebar) - 1);
}

.sidebar-overlay.open {
  display: block;
}

/* ===== Hamburger hidden by default ===== */
#mobile-menu-btn {
  display: none;
}

/* ===== Settings Page ===== */
.settings-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.settings-header {
  margin-bottom: 2rem;
}

.settings-header h2 {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

.settings-card:hover {
  box-shadow: var(--shadow-md);
}

.settings-card h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: 1rem;
}

.settings-profile-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.user-avatar.large {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 600;
}

.settings-form .form-group {
  margin-bottom: 1.25rem;
}

.theme-options {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.theme-option {
  padding: 0.625rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--text-sm);
}

.theme-option:hover {
  background: var(--surface-hover);
}

.theme-option.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 500;
}

/* Note color accents */
.note-card.color-blue {
  --note-accent: #3b82f6;
  --accent-rgb: 59, 130, 246;
  border-left: 4px solid var(--note-accent);
}

.note-card.color-purple {
  --note-accent: #8b5cf6;
  --accent-rgb: 139, 92, 246;
  border-left: 4px solid var(--note-accent);
}

.note-card.color-green {
  --note-accent: #10b981;
  --accent-rgb: 16, 185, 129;
  border-left: 4px solid var(--note-accent);
}

.note-card.color-orange {
  --note-accent: #f59e0b;
  --accent-rgb: 245, 158, 11;
  border-left: 4px solid var(--note-accent);
}

.note-card.color-rose {
  --note-accent: #f43f5e;
  --accent-rgb: 244, 63, 94;
  border-left: 4px solid var(--note-accent);
}

.note-card.color-amber {
  --note-accent: #f59e0b;
  --accent-rgb: 245, 158, 11;
  border-left: 4px solid var(--note-accent);
}

/* If you want the hover glow to match the accent color, you can also set */
.note-card.color-blue:hover,
.note-card.color-purple:hover,
.note-card.color-green:hover,
.note-card.color-orange:hover,
.note-card.color-rose:hover,
.note-card.color-amber:hover {
  border-color: var(--note-accent);
  box-shadow: 0 8px 25px rgba(var(--accent-rgb), 0.15), var(--shadow-md);
}

.btn-text {
  display: inline;
}

.btn-primary {
  border: none;                 /* Remove any possible border */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
  box-shadow: var(--shadow-md);
}
/* New Note button label hiding on mobile */
@media (max-width: 480px) {
  #new-note-btn .btn-text {
    display: none;
  }
  #new-note-btn {
    padding: 60rem;
  }
}