:root {
  --bg: #020617;
  --bg-elevated: #020617;
  --card: #0b1120;
  --card-soft: #020617;
  --border-subtle: rgba(148, 163, 184, 0.35);
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.16);
  --accent-strong: #16a34a;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --danger: #f97373;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, #0f172a 0, #020617 55%);
  color: var(--text-main);
}

/* Center the app horizontally (keeps top alignment) */
body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.user-greeting-header {
  text-align: right;
  padding: 0.5rem 1rem;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-main);
}

.app-root {
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem;
  padding-top: 4rem; /* Add space for fixed theme toggle */
  direction: rtl;
}

@media (min-width: 768px) {
  .app-root {
    padding: 1.5rem;
    padding-top: 4.5rem;
  }
}

/* Top bar */

.topbar {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  justify-content: space-between;
  align-items: stretch;
  background: linear-gradient(90deg, #020617, #020617f2);
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  padding: 0.8rem 1rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.9);
}

@media (min-width: 768px) {
  .topbar {
    flex-direction: row;
    align-items: center;
    border-radius: 999px;
    padding: 0.8rem 1.2rem;
    margin-bottom: 1.6rem;
  }
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  justify-content: center;
}

@media (min-width: 768px) {
  .topbar-left {
    justify-content: flex-start;
  }
}

.topbar-logo {
  height: 2.5rem;
  width: auto;
  object-fit: contain;
}

@media (min-width: 768px) {
  .topbar-logo {
    height: 3rem;
  }
}

.logo-emoji {
  font-size: 1.8rem;
}

.brand-title {
  font-weight: 800;
  font-size: 1rem;
}

@media (min-width: 768px) {
  .brand-title {
    font-size: 1.2rem;
  }
}

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

@media (min-width: 768px) {
  .brand-subtitle {
    font-size: 0.8rem;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  .topbar-actions {
    gap: 0.6rem;
    justify-content: flex-end;
  }
}

/* Mobile-compact buttons */
.btn-mobile-compact .btn-text-desktop {
  display: none;
}

.btn-mobile-compact .btn-text-mobile {
  display: inline;
}

@media (min-width: 768px) {
  .btn-mobile-compact .btn-text-desktop {
    display: inline;
  }
  
  .btn-mobile-compact .btn-text-mobile {
    display: none;
  }
}

.user-greeting {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0.5rem 1rem;
  background: rgba(79, 70, 229, 0.1);
  border-radius: 8px;
}

/* Layout */

.layout {
  display: grid;
  gap: 1.4rem;
}

@media (min-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  
  .layout:has(.pinned-lists-sidebar) {
    grid-template-columns: 320px minmax(0, 1fr) minmax(0, 1fr);
  }
}

.pinned-lists-sidebar {
  display: none;
}

@media (min-width: 960px) {
  .pinned-lists-sidebar {
    display: block;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }
}

/* Mobile pinned sidebar - slides in from left */
@media (max-width: 959px) {
  .pinned-lists-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 90%;
    max-width: 360px;
    height: 100vh;
    background: var(--bg);
    z-index: 70;
    overflow-y: auto;
    padding: 1rem;
    transition: left 0.3s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
  }
  
  .pinned-lists-sidebar.mobile-visible {
    display: block;
    left: 0;
  }
  
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    z-index: 65;
  }
  
  .close-sidebar-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #5a4a2a;
    cursor: pointer;
    z-index: 10;
    padding: 0.25rem;
  }
  
  .close-sidebar-btn:hover {
    color: #3a2a1a;
  }
}

.content-wrapper {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.4rem;
}

@media (min-width: 960px) {
  .content-wrapper {
    display: contents;
  }
}

.sidebar,
.content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Panels */

.panel {
  background: var(--card);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.7);
}

@media (min-width: 768px) {
  .panel {
    border-radius: 18px;
    padding: 1.1rem 1.2rem;
  }
}

.panel.secondary {
  background: var(--card-soft);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.75rem;
}

/* Filter panel */

.filter-panel h3 {
  margin-top: 0;
  margin-bottom: 0.6rem;
}

.panel-grid {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
}

@media (min-width: 720px) {
  .panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.field-full {
  grid-column: 1 / -1;
}

input,
select {
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: #020617;
  color: var(--text-main);
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  min-height: 44px; /* Better touch target for mobile */
}

@media (min-width: 768px) {
  input,
  select {
    padding: 0.4rem 0.65rem;
    min-height: auto;
  }
}

/* Buttons */

.btn {
  border-radius: 999px;
  padding: 0.65rem 1rem;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease,
    background-color 0.08s ease;
  min-height: 44px; /* Better touch target for mobile */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 768px) {
  .btn {
    padding: 0.55rem 1.2rem;
    min-height: auto;
  }
}

.btn.full {
  width: 100%;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #f9fafb;
  box-shadow: 0 12px 25px rgba(22, 163, 74, 0.6);
}

.btn.accent {
  background: var(--accent-soft);
  color: #bbf7d0;
}

.btn.ghost {
  background: transparent;
  color: var(--text-main);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.btn.danger {
  background: linear-gradient(135deg, var(--danger), #e74c3c);
  color: #fde8e8;
  box-shadow: 0 12px 25px rgba(249, 115, 115, 0.4);
}

.btn.small {
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 15px 30px rgba(15, 23, 42, 0.75);
}

/* Recipe list */

.recipe-list {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0 0;
  max-height: 280px;
  overflow: auto;
}

.recipe-list-item {
  display: flex;
  padding: 0.55rem 0.4rem;
  border-radius: 11px;
  cursor: pointer;
  transition: background-color 0.08s ease, transform 0.05s ease;
}

.recipe-list-item:hover {
  background: rgba(15, 23, 42, 0.9);
  transform: translateY(-1px);
}

.recipe-list-item.active {
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid rgba(34, 197, 94, 0.6);
}

.recipe-list-image {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  overflow: hidden;
  margin-left: 0.6rem;
  flex-shrink: 0;
  background: rgba(15, 23, 42, 0.5);
}

.recipe-list-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recipe-list-main {
  flex: 1;
}

.recipe-list-name {
  font-size: 0.92rem;
  font-weight: 500;
}

.recipe-list-meta {
  display: flex;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

/* Recipe details */

.recipe-card {
  min-height: 260px;
  display: flex;
  flex-direction: column;

}

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

.recipe-header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.recipe-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.recipe-made-by {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.pill {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.7);
  font-size: 0.78rem;
}

/* Recipe Image */
.recipe-image-container {
  width: 100%;
  height: 250px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0.8rem;
  background: rgba(15, 23, 42, 0.5);
}

.recipe-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recipe-body {
  display: grid;
  gap: 0.8rem;
  flex: 1;
}

@media (min-width: 720px) {
  .recipe-body {
    grid-template-columns: 1fr 1.2fr;
  }
}

.recipe-column h3 {
  margin: 0 0 0.3rem;
  font-size: 0.95rem;
}

.recipe-column ul,
.recipe-column ol {
  margin: 0;
  padding-right: 1rem;
  font-size: 0.9rem;
}

.recipe-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.8rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  .recipe-actions {
    gap: 0.4rem;
  }
}

.tags {
  margin-top: 0.6rem;
}

.tag {
  display: inline-block;
  margin-left: 0.25rem;
  margin-bottom: 0.2rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(75, 85, 99, 0.7);
  font-size: 0.78rem;
}

/* Placeholder */

.placeholder {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}

/* Error */

.error-banner {
  background: rgba(248, 113, 113, 0.12);
  border-radius: 12px;
  border: 1px solid rgba(252, 165, 165, 0.7);
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  color: #fecaca;
  margin-bottom: 0.6rem;
}

/* Drawer */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  display: flex;
  justify-content: flex-start;
  align-items: stretch;
  z-index: 40;
}

.drawer {
  width: 100%;
  max-width: 420px;
  background: #020617;
  border-left: 1px solid var(--border-subtle);
  padding: 1rem;
  box-shadow: 18px 0 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 768px) {
  .drawer {
    width: min(420px, 90vw);
    padding: 1rem 1rem 1rem 1.2rem;
  }
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 1rem;
}

.drawer-footer {
  margin-top: auto;
  padding-top: 0.7rem;
  display: flex;
  gap: 0.5rem;
  position: sticky;
  bottom: 0;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
}

.icon-btn.small {
  font-size: 0.9rem;
}

/* Dynamic lists */

.dynamic-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.dynamic-row {
  display: flex;
  gap: 0.3rem;
}

.dynamic-row input {
  flex: 1;
}

.two-cols {
  display: grid;
  gap: 0.6rem;
}

@media (min-width: 600px) {
  .two-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  padding: 1rem;
}

.modal {
  background: var(--card);
  border-radius: 16px;
  padding: 1.2rem;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
  max-width: 400px;
  width: 100%;
}

@media (min-width: 768px) {
  .modal {
    border-radius: 18px;
    padding: 1.5rem;
    width: 90vw;
  }
}

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

.modal-header h2 {
  margin: 0;
  font-size: 1rem;
}

@media (min-width: 768px) {
  .modal-header h2 {
    font-size: 1.1rem;
  }
}

.modal-body {
  margin-bottom: 1.2rem;
  color: var(--text-muted);
  line-height: 1.5;
  font-size: 0.9rem;
}

@media (min-width: 768px) {
  .modal-body {
    font-size: 1rem;
  }
}

.modal-footer {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
}

.modal-footer .btn {
  flex: 1;
}

/* Image Upload */
.image-upload-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.image-preview {
  position: relative;
  width: 100%;
  max-height: 180px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.5);
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-remove-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: background 0.2s ease;
}

.image-remove-btn:hover {
  background: rgba(249, 115, 115, 0.8);
}

.image-input {
  display: none;
}

.image-upload-label {
  padding: 0.7rem 1rem;
  border-radius: 8px;
  border: 2px dashed rgba(148, 163, 184, 0.5);
  background: transparent;
  color: var(--text-main);
  text-align: center;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.image-upload-label:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(34, 197, 94, 0.05);
}

/* Light mode image upload */
[data-theme="light"] .image-preview {
  background: rgba(229, 231, 235, 0.5);
}

[data-theme="light"] .image-upload-label {
  border: 2px dashed rgba(107, 114, 128, 0.4);
  color: var(--text-main);
}

[data-theme="light"] .image-upload-label:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(5, 150, 105, 0.05);
}

/* Toast Notifications */

.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 0.5rem;
  left: 0.5rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  pointer-events: none;
}

@media (min-width: 768px) {
  .toast-container {
    bottom: 5rem;
    right: 1.5rem;
    left: auto;
    max-width: 400px;
  }
}

.toast {
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  animation: slideIn 0.3s ease-out;
  pointer-events: auto;
  font-size: 0.85rem;
}

@media (min-width: 768px) {
  .toast {
    padding: 1rem 1.2rem;
    font-size: 0.9rem;
  }
}

.toast.success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.5);
  color: #86efac;
}

.toast.error {
  background: rgba(249, 115, 115, 0.1);
  border-color: rgba(249, 115, 115, 0.5);
  color: #fca5a5;
}

.toast.info {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.5);
  color: #93c5fd;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Theme Toggle (fixed floating button) */
.theme-toggle {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 100;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--card);
  color: var(--text-main);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  transition: all 180ms ease;
}

@media (min-width: 768px) {
  .theme-toggle {
    top: 1.5rem;
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
    font-size: 1.2rem;
  }
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* Pinned notes toggle button - mobile only - styled like a mini sticky note */
.pinned-toggle-btn {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  width: 3rem;
  height: 3rem;
  border-radius: 4px;
  border: 1px solid #f5e6c8;
  background: linear-gradient(135deg, #fff9e6 0%, #fffaed 100%);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.5rem;
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.1),
    0 4px 12px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: all 180ms ease;
  transform: rotate(-2deg);
}

.pinned-toggle-btn::before {
  content: '📌';
  position: absolute;
  top: -6px;
  right: 8px;
  font-size: 1rem;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
  transform: rotate(15deg);
}

.pinned-toggle-btn:hover {
  transform: rotate(0deg) scale(1.05);
  box-shadow: 
    0 4px 8px rgba(0, 0, 0, 0.15),
    0 8px 20px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.pinned-toggle-btn:active {
  transform: rotate(0deg) scale(0.95);
}

.note-icon-lines {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 1.5rem;
}

.note-icon-lines span {
  height: 2px;
  background: rgba(90, 74, 42, 0.4);
  border-radius: 1px;
}

.note-icon-lines span:nth-child(1) {
  width: 100%;
}

.note-icon-lines span:nth-child(2) {
  width: 85%;
}

.note-icon-lines span:nth-child(3) {
  width: 70%;
}

/* Mobile only utility class */
.mobile-only {
  display: block;
}

@media (min-width: 960px) {
  .mobile-only {
    display: none !important;
  }
}

/* Update body to apply bg properly in both themes */
body {
  background: var(--bg);
}

[data-theme="dark"] body {
  background: radial-gradient(circle at top, #0f172a 0, #020617 55%);
}

[data-theme="light"] {
  --bg: #f9fafbef;
  --bg-elevated: #ffffffd7;
  --card: #ffffffd5;
  --card-soft: #f3f4f6;
  --border-subtle: rgba(107, 114, 128, 0.25);
  --accent: #059669;
  --accent-soft: rgba(5, 150, 105, 0.12);
  --accent-strong: #047857;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --danger: #dc2626;
}

[data-theme="light"] body {
  background: linear-gradient(180deg, #ac8d75 0%, #ede9e5 100%);
  color: var(--text-main);
}

[data-theme="light"] .topbar {
  background: linear-gradient(90deg, #e7be9e, #e2b08a);
  border: 1px solid rgba(107, 114, 128, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

[data-theme="light"] .btn.accent {
  background: var(--accent-soft);
  color: #065f46;
}

[data-theme="light"] .btn.accent:hover {
  background: rgba(5, 150, 105, 0.2);
}

[data-theme="light"] .btn.ghost {
  background: transparent;
  color: var(--text-main);
  border: 1px solid rgba(214, 210, 208, 0.3);
}

[data-theme="light"] .btn.ghost:hover {
  background: rgba(149, 151, 156, 0.1);
}

[data-theme="light"] .btn.danger {
  background: rgba(218, 32, 32, 0.486);
  color: #881f1f;
}

[data-theme="light"] .btn.danger:hover {
  background: rgba(189, 15, 15, 0.644);
}

[data-theme="light"] input,
[data-theme="light"] select {
  border-radius: 10px;
  border: 1px solid rgba(107, 114, 128, 0.3);
  background: #d4cfcf;
  color: var(--text-main);
}

[data-theme="light"] input::placeholder {
  color: var(--text-muted);
}

[data-theme="light"] option {
  background: #ffffff;
  color: var(--text-main);
}

[data-theme="light"] .panel {
  background: var(--card);
  border: 1px solid rgba(107, 114, 128, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .modal {
  background: var(--card);
  border: 1px solid rgba(107, 114, 128, 0.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .drawer {
  background: #d1b29b;
  border-left: 1px solid rgba(107, 114, 128, 0.2);
  box-shadow: -4px 0 15px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .error-banner {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.5);
  color: #991b1b;
}

[data-theme="light"] .pill {
  background: rgba(107, 114, 128, 0.1);
  border: 1px solid rgba(107, 114, 128, 0.3);
  color: var(--text-main);
}

[data-theme="light"] .tag {
  background: rgba(107, 114, 128, 0.1);
  border: 1px solid rgba(107, 114, 128, 0.3);
  color: var(--text-main);
}

[data-theme="light"] .toast.success {
  background: rgba(5, 150, 105, 0.1);
  border-color: rgba(5, 150, 105, 0.5);
  color: #047857;
}

[data-theme="light"] .recipe-list-item:hover {
  background: rgba(229, 231, 235, 0.6);
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.5);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.7);
}

/* Light mode scrollbar */
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(107, 114, 128, 0.4);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 114, 128, 0.6);
}

/* Firefox scrollbar */
html {
  scrollbar-color: rgba(148, 163, 184, 0.5) transparent;
  scrollbar-width: thin;
}

[data-theme="light"] html {
  scrollbar-color: rgba(107, 114, 128, 0.4) transparent;
}

/* Search and Filter Panel */
.search-filter-panel {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.search-box-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box {
  width: 100%;
  padding: 0.65rem 2.4rem 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: #020617;
  color: var(--text-main);
  font-size: 0.9rem;
}

.search-box::placeholder {
  color: var(--text-muted);
}

.search-box:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.search-clear {
  position: absolute;
  left: 0.6rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem 0.4rem;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.search-clear:hover {
  color: var(--text-main);
}

.filters-grid {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-btn {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: transparent;
  color: var(--text-main);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.filter-btn.active {
  background: var(--accent);
  color: #f9fafb;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.time-filter-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.time-slider {
  width: 100%;
  height: 5px;
  border-radius: 5px;
  background: rgba(148, 163, 184, 0.2);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.time-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.4);
}

.time-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.4);
}

.time-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tag-filter-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-filter-btn {
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: transparent;
  color: var(--text-main);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.tag-filter-btn.active {
  background: var(--accent);
  color: #f9fafb;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

/* Light mode search and filter styles */
[data-theme="light"] .search-box {
  border: 1px solid rgba(107, 114, 128, 0.3);
  background: #ffffff;
  color: var(--text-main);
}

[data-theme="light"] .search-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

[data-theme="light"] .filter-btn {
  border: 1px solid rgba(107, 114, 128, 0.3);
  color: var(--text-main);
}

[data-theme="light"] .filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

[data-theme="light"] .filter-btn.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

[data-theme="light"] .time-slider {
  background: rgba(107, 114, 128, 0.15);
}

[data-theme="light"] .time-slider::-webkit-slider-thumb {
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
}

[data-theme="light"] .time-slider::-moz-range-thumb {
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
}

[data-theme="light"] .tag-filter-btn {
  border: 1px solid rgba(107, 114, 128, 0.3);
  color: var(--text-main);
}

[data-theme="light"] .tag-filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

[data-theme="light"] .tag-filter-btn.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

/* Unified Recipe Search List */
.recipe-search-list {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.recipe-search-header {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
  padding: 1.1rem 1.2rem 0.8rem;
  border-bottom: 1px solid var(--border-subtle);
}

.search-box-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.filter-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.15s ease;
  position: relative;
}

.filter-toggle-btn:hover {
  border-color: var(--accent);
  background: rgba(34, 197, 94, 0.1);
}

.filter-icon {
  display: block;
  font-size: 0.9rem;
}

.filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 0.3rem;
  background: var(--accent);
  color: #f9fafb;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.recipe-filters-expanded {
  padding: 0.8rem 1.2rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  background: rgba(15, 23, 42, 0.5);
}

.recipe-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.2rem 0.6rem;
}

.recipe-list-header h3 {
  margin: 0;
  font-size: 0.95rem;
}

.recipe-list {
  list-style: none;
  padding: 0.6rem 1.2rem 1rem;
  margin: 0;
  max-height: 400px;
  overflow-y: auto;
  flex: 1;
}

.recipe-list::-webkit-scrollbar {
  width: 6px;
}

.recipe-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 3px;
}

.recipe-list::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.6);
}

/* Light mode unified list */
[data-theme="light"] .recipe-search-header {
  border-bottom: 1px solid rgba(107, 114, 128, 0.2);
}

[data-theme="light"] .filter-toggle-btn {
  border: 1px solid rgba(107, 114, 128, 0.3);
  color: var(--text-main);
}

[data-theme="light"] .filter-toggle-btn:hover {
  border-color: var(--accent);
  background: rgba(5, 150, 105, 0.1);
}

[data-theme="light"] .recipe-filters-expanded {
  border-bottom: 1px solid rgba(107, 114, 128, 0.2);
  background: rgba(229, 231, 235, 0.3);
}

[data-theme="light"] .recipe-list {
  max-height: 400px;
  overflow-y: auto;
}

[data-theme="light"] .recipe-list::-webkit-scrollbar-thumb {
  background: rgba(107, 114, 128, 0.35);
}

[data-theme="light"] .recipe-list::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 114, 128, 0.5);
}

/* Light mode recipe list styling */
[data-theme="light"] .recipe-list-item:hover {
  background: rgba(229, 231, 235, 0.6);
}

[data-theme="light"] .recipe-list-image {
  background: rgba(229, 231, 235, 0.5);
}

/* Auth Pages */
.auth-container {
  min-height: 100vh;
  height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  background: radial-gradient(circle at top, #0f172a 0, #020617 55%);
  overflow-y: auto;
  overflow-x: hidden;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #020617;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  margin: 2rem auto;
  flex-shrink: 0;
}

.auth-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  text-align: center;
  color: var(--text-main);
}

.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-footer {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  font-weight: 600;
}

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

.full-width {
  width: 100%;
}

/* Light mode auth styles */
[data-theme="light"] .auth-container {
  background: linear-gradient(180deg, #ac8d75 0%, #ede9e5 100%);
}

[data-theme="light"] .auth-card {
  background: #d1b29b;
  border: 1px solid rgba(107, 114, 128, 0.2);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
}

/* Main Navigation Tabs */
.main-navigation {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 0;
  border-bottom: 2px solid var(--border-subtle);
  margin-bottom: 1.5rem;
}

.nav-tab {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all 0.2s;
}

.nav-tab:hover {
  background: var(--card-soft);
  color: var(--text-main);
}

.nav-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

/* Grocery Lists specific styles */
.grocery-lists-container {
  --panel-bg: var(--card);
  --hover-bg: var(--card-soft);
  --primary-color: var(--accent);
  --border-color: var(--border-subtle);
}

[data-theme="light"] .grocery-lists-container {
  --panel-bg: #f9fafb;
  --hover-bg: #f3f4f6;
  --primary-color: #22c55e;
  --border-color: #e5e7eb;
}

.grocery-lists-container input,
.grocery-lists-container select,
.grocery-lists-container textarea {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 1rem;
}

[data-theme="light"] .grocery-lists-container input,
[data-theme="light"] .grocery-lists-container select,
[data-theme="light"] .grocery-lists-container textarea {
  background: white;
  color: #1f2937;
}

.grocery-lists-container .btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

.grocery-lists-container .btn.primary:hover {
  background: var(--accent-strong);
}

.grocery-lists-container .btn.secondary {
  background: var(--card-soft);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.grocery-lists-container .btn.secondary:hover {
  background: var(--card);
}

.grocery-lists-container .btn.ghost {
  background: transparent;
  color: var(--text-main);
}

.grocery-lists-container .btn.ghost:hover {
  background: var(--hover-bg);
}

.grocery-lists-container .btn.danger {
  background: var(--danger);
  color: white;
}

.grocery-lists-container .btn.danger:hover {
  opacity: 0.9;
}

.grocery-lists-container .btn.small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.grocery-lists-container .btn-icon {
  background: transparent;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.grocery-lists-container .btn-icon:hover {
  color: var(--text-main);
}

.grocery-lists-container .btn-icon.delete {
  color: var(--danger);
}

.grocery-lists-container .btn-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
  line-height: 1;
}

.grocery-lists-container .btn-close:hover {
  color: var(--text-main);
}

.grocery-lists-container .loading {
  text-align: center;
  padding: 2rem;
  font-size: 1.125rem;
  color: var(--text-muted);
}

/* Autocomplete Input Styles */
.autocomplete-wrapper {
  position: relative;
  width: 100%;
}

.autocomplete-wrapper input {
  width: 100%;
  position: relative;
  z-index: 2;
  background: transparent;
}

.autocomplete-suggestion {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  z-index: 1;
}

@media (min-width: 768px) {
  .autocomplete-suggestion {
    padding: 0.4rem 0.65rem;
    min-height: auto;
  }
}

.autocomplete-typed {
  opacity: 0;
}

.autocomplete-rest {
  color: var(--text-muted);
  opacity: 0.5;
}

/* Share Modal Search Results Styles */
.share-search .search-results {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  max-height: 300px;
  overflow-y: auto;
}

.share-search .search-results li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background-color 0.2s;
}

.share-search .search-results li:hover:not(.disabled) {
  background-color: var(--accent-soft);
}

.share-search .search-results li.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.share-search .search-results li.disabled:hover {
  background-color: transparent;
}

.share-search .search-results .username {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

.share-search .search-results .badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

/* Share Actions */
.share-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.shares-list .share-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.shares-list .share-item .username {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

/* Admin Panel */
.admin-view {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 2rem;
}

.admin-panel {
  background: var(--panel-bg);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

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

.admin-header h2 {
  margin: 0 0 0.5rem 0;
  color: var(--text-main);
}

.environment-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.env-badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.env-badge.dev {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.env-badge.prod {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.bucket-name {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--border-subtle);
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
}

.backups-list {
  margin-top: 1.5rem;
}

.backups-table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  background: var(--surface-bg);
  border-radius: 8px;
  overflow: hidden;
}

.backups-table thead {
  background: var(--border-subtle);
}

.backups-table th,
.backups-table td {
  padding: 0.75rem;
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.backups-table th {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.9rem;
}

.backups-table td {
  color: var(--text-muted);
}

/* Column widths */
.backups-table .col-filename,
.backups-table td.filename {
  width: auto;
}

.backups-table .col-date,
.backups-table td.date {
  width: auto;
}

.backups-table .col-size,
.backups-table td.size {
  width: auto;
}

.backups-table .col-actions,
.backups-table td.actions {
  width: auto;
  text-align: center;
}

.backups-table td.filename {
  color: var(--text-main);
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
}

.backups-table tbody tr:last-child td {
  border-bottom: none;
}

.backups-table tbody tr:hover {
  background: var(--hover-bg);
}

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

.btn.danger {
  background: #dc2626;
  color: white;
}

.btn.danger:hover {
  background: #b91c1c;
}

.restore-warning {
  text-align: center;
  padding: 1rem;
}

.restore-warning p {
  margin: 0.5rem 0;
  color: var(--text-main);
}

.restore-warning .filename-highlight {
  font-family: 'Courier New', monospace;
  color: var(--accent);
  font-weight: 600;
  margin: 1rem 0;
}

/* Restore Progress */
.restore-progress {
  text-align: center;
  padding: 2rem 1rem;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--border-subtle);
  border-radius: 999px;
  overflow: hidden;
  margin: 1.5rem 0;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #10b981);
  border-radius: 999px;
  animation: progressAnimation 2s ease-in-out infinite;
}

@keyframes progressAnimation {
  0% {
    width: 0%;
    opacity: 0.6;
  }
  50% {
    width: 70%;
    opacity: 1;
  }
  100% {
    width: 100%;
    opacity: 0.8;
  }
}

.progress-text {
  margin: 0.5rem 0;
  color: var(--text-main);
  font-weight: 500;
}

.progress-text-muted {
  margin: 1rem 0 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.loading,
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .admin-view {
    padding: 1rem;
  }

  .admin-panel {
    padding: 1rem;
  }

  .backups-table {
    font-size: 0.8rem;
  }

  .backups-table th,
  .backups-table td {
    padding: 0.5rem;
  }

  .backups-table td.filename {
    font-size: 0.75rem;
  }

  .backups-table .col-filename,
  .backups-table td.filename {
    width: 35%;
  }

  .backups-table .col-date,
  .backups-table td.date {
    width: 32%;
  }

  .backups-table .col-size,
  .backups-table td.size {
    width: 18%;
  }

  .backups-table .col-actions,
  .backups-table td.actions {
    width: 15%;
  }
}
