@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Spectral:ital,wght@0,400;0,600;1,400&family=DM+Mono:wght@400;500&display=swap');

:root {
  /* Troop 222 Palette */
  --ink: #1A1410;
  --stone: #3D332A;
  --bark: #6B5040;
  --sand: #C4A882;
  --cream: #F5EDD8;
  --sage: #7C9070;
  --sky: #4A7C9A;
  --gold: #C8A028;
  --ember: #C84820;
  --bg: #F0E8D5;
  --border: rgba(100, 80, 50, 0.18);

  /* Map Mealie components to Troop Theme */
  --bg-primary: var(--bg);
  --bg-sidebar: var(--ink);
  --bg-card: var(--cream);
  --bg-glass-hover: rgba(196, 168, 130, 0.12);
  --border-color: var(--border);
  --border-card: var(--border);
  --text-primary: var(--ink);
  --text-secondary: var(--stone);
  --text-muted: var(--bark);
  --accent-color: var(--gold);
  --accent-hover: #b08c20;
  --accent-light: rgba(200, 160, 40, 0.12);
  --success-color: var(--sage);
  --danger-color: var(--ember);
  
  --radius-sm: 4px;
  --radius-md: 4px;
  --radius-lg: 4px;
}

/* We override dark mode behavior to respect the warm paper theme, 
   but provide a custom high-contrast dark version using the Troop colors if needed */
[data-theme="dark"] {
  --bg-primary: #1A1410;
  --bg-sidebar: #0f0a07;
  --bg-card: #2d231b;
  --bg-glass-hover: rgba(196, 168, 130, 0.08);
  --border-color: rgba(196, 168, 130, 0.15);
  --border-card: rgba(196, 168, 130, 0.15);
  --text-primary: #F5EDD8;
  --text-secondary: #C4A882;
  --text-muted: #9c8466;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Spectral', Georgia, serif;
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  overflow: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Topographic/Grid pattern on body */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(100, 80, 50, 0.06) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(100, 80, 50, 0.04) 40px);
  background-size: 40px 40px;
}

h1, h2, h3, h4 {
  font-family: 'Bebas Neue', sans-serif;
  font-weight: normal;
  letter-spacing: 0.03em;
  color: var(--stone);
}

[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3, [data-theme="dark"] h4 {
  color: var(--sand);
}

button, input, select, textarea {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
}

/* Background elements disabled (Mesh gradients removed to match Troop theme) */
.bg-gradient-mesh {
  display: none;
}

/* Main Layout Container */
.app-container {
  display: flex;
  width: 100%;
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* Sidebar Navigation (Troop Style dark nav banner style) */
.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 10;
  transition: width 0.3s ease;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 3rem;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: var(--gold);
  color: var(--ink);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.4rem;
  font-family: 'Bebas Neue', sans-serif;
  box-shadow: 0 4px 10px rgba(200, 160, 40, 0.2);
}

.brand-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  color: var(--cream);
  letter-spacing: 0.05em;
  font-weight: normal;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  color: var(--sand);
  text-decoration: none;
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.nav-item:hover {
  color: var(--gold);
  transform: translateX(4px);
}

.nav-item.active {
  color: var(--gold);
  background: rgba(200, 160, 40, 0.08);
  border: 1px solid rgba(200, 160, 40, 0.2);
}

.nav-item svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.nav-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: var(--sand);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--gold);
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  height: 100%;
  overflow-y: auto;
  padding: 3rem 2.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Section Wrapper classes */
.app-section {
  display: none;
  animation: fadeUp 0.5s ease forwards;
}

.app-section.active {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Header bar */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 1rem;
}

.section-title {
  font-size: 2.8rem;
  color: var(--stone);
}

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

/* Cards (Troop Style Module Card) */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: none;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--bark);
  transition: background 0.2s;
}

.glass-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  border-color: var(--gold);
}

.glass-card:hover::before {
  background: var(--gold);
}

/* Buttons (Troop style module buttons) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.2rem;
  border-radius: 2px;
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}

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

.btn-primary:hover {
  background: #5a7050;
  border-color: #5a7050;
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--bark);
}

.btn-secondary:hover {
  background: var(--stone);
  color: var(--cream);
  border-color: var(--stone);
  transform: translateY(-1px);
}

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

.btn-danger:hover {
  filter: brightness(0.9);
  transform: translateY(-1px);
}

.btn-icon-only {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--bark);
  border: 1px solid var(--border);
}

.btn-icon-only:hover {
  background: var(--stone);
  color: var(--cream);
  transform: none;
}

/* Search and Filter Inputs */
.search-container {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  max-width: 450px;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: var(--cream);
  color: var(--text-primary);
  font-family: 'Spectral', serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  border-color: var(--gold);
}

select.form-control {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
}

/* Recipe Grid and Cards */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  width: 100%;
}

.recipe-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  overflow: hidden;
  height: 400px;
}

.recipe-card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 2px;
  background-color: rgba(100, 80, 50, 0.08);
}

.recipe-card-content {
  padding: 1.25rem 0 0 0;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.recipe-card-meta {
  display: flex;
  gap: 0.75rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  color: var(--bark);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.recipe-card-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.recipe-card-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.2rem;
  line-height: 1;
  color: var(--stone);
  margin-bottom: 0.8rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recipe-card-desc {
  font-family: 'Spectral', serif;
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: auto;
}/* Monthly Calendar Planner */
.calendar-days-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bark);
  padding: 0.5rem 0 1rem 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0.5rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

.calendar-cell {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 2px;
  min-height: 125px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  position: relative;
  transition: all 0.15s ease;
}

.calendar-cell:hover {
  border-color: var(--gold);
  background: rgba(100, 80, 50, 0.04);
}

.calendar-cell.other-month {
  opacity: 0.35;
  background: transparent;
}

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

.calendar-date-number {
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  font-weight: bold;
  color: var(--stone);
}

.calendar-cell.today .calendar-date-number {
  color: var(--gold);
  background: var(--ink);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-meals-container {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-grow: 1;
}

.calendar-meal-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  padding: 0.15rem 0.35rem;
  border-radius: 2px;
  font-family: 'Spectral', serif;
  font-size: 0.72rem;
  font-weight: bold;
  line-height: 1.2;
  cursor: pointer;
  border: 1px solid transparent;
  width: 100%;
}

.calendar-meal-pill .meal-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-grow: 1;
}

.calendar-meal-pill.breakfast {
  background: rgba(74, 124, 154, 0.1);
  border-color: rgba(74, 124, 154, 0.3);
  color: var(--sky);
}

.calendar-meal-pill.breakfast:hover {
  background: rgba(74, 124, 154, 0.2);
}

.calendar-meal-pill.lunch {
  background: rgba(124, 144, 112, 0.1);
  border-color: rgba(124, 144, 112, 0.3);
  color: #4a5c43;
}

.calendar-meal-pill.lunch:hover {
  background: rgba(124, 144, 112, 0.2);
}

.calendar-meal-pill.dinner {
  background: rgba(200, 160, 40, 0.1);
  border-color: rgba(200, 160, 40, 0.3);
  color: #8c6a0c;
}

.calendar-meal-pill.dinner:hover {
  background: rgba(200, 160, 40, 0.2);
}

.calendar-meal-pill .meal-remove-btn {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  color: var(--bark);
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: 0.5;
  display: flex;
  align-items: center;
}

.calendar-meal-pill:hover .meal-remove-btn {
  opacity: 1;
}

.calendar-meal-pill .meal-remove-btn:hover {
  color: var(--ember);
}

.calendar-cell-add-btn {
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 2px;
  background: transparent;
  color: var(--bark);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: opacity 0.15s;
  font-size: 0.65rem;
}

.calendar-cell:hover .calendar-cell-add-btn {
  opacity: 0.8;
}

.calendar-cell-add-btn:hover {
  background: var(--stone);
  color: var(--cream);
  opacity: 1;
}

/* Shopping List Layout */
.shopping-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  align-items: start;
}

.shopping-items-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.shopping-category-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.shopping-category-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  color: var(--stone);
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

.shopping-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 2px;
  transition: all 0.15s ease;
}

.shopping-item-row:hover {
  background: rgba(100, 80, 50, 0.04);
  border-color: var(--sand);
}

.shopping-item-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-grow: 1;
}

.shopping-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--sage);
  cursor: pointer;
}

.shopping-item-name {
  font-family: 'Spectral', serif;
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
}

.shopping-item-row.checked .shopping-item-name {
  text-decoration: line-through;
  color: var(--bark);
  opacity: 0.6;
}

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

/* Modals / Dialogs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(26, 20, 16, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
  animation: fadeIn 0.25s ease;
}

.modal-overlay.open {
  display: flex;
}

.modal-container {
  background: var(--bg);
  border: 2px solid var(--stone);
  border-radius: 4px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
  width: 90%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeUp 0.3s ease;
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 2px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--cream);
}

.modal-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.2rem;
  color: var(--stone);
  line-height: 1;
}

.modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--bark);
  font-size: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--ember);
}

.modal-body {
  padding: 2rem;
  overflow-y: auto;
  flex-grow: 1;
}

.modal-footer {
  padding: 1.25rem 2rem;
  border-top: 2px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--cream);
}

/* Detail View Layout in Modal */
.detail-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.detail-img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: 2px;
}

.detail-meta-row {
  display: flex;
  gap: 2rem;
  padding: 1rem;
  background: var(--cream);
  border-radius: 2px;
  border: 1px solid var(--border);
}

.detail-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-meta-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  color: var(--bark);
  text-transform: uppercase;
}

.detail-meta-val {
  font-family: 'Spectral', serif;
  font-size: 0.95rem;
  font-weight: bold;
  color: var(--ink);
}

.detail-section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  color: var(--stone);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
}

.detail-list {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.detail-list li {
  line-height: 1.6;
  color: var(--ink);
  font-family: 'Spectral', serif;
}

.detail-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  list-style: none;
}

.detail-step-item {
  display: flex;
  gap: 1rem;
}

.detail-step-number {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: rgba(100, 80, 50, 0.08);
  border: 1px solid var(--border);
  color: var(--bark);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-weight: 500;
  font-size: 0.75rem;
}

.detail-step-text {
  color: var(--ink);
  line-height: 1.6;
  padding-top: 0.1rem;
  font-family: 'Spectral', serif;
}

/* Forms styling inside modals */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.form-group label {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--bark);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.list-editor {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.list-editor-item {
  display: flex;
  gap: 0.5rem;
}

/* Empty states */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--bark);
  gap: 1rem;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  stroke: var(--bark);
  opacity: 0.6;
}

.empty-state h3 {
  color: var(--stone);
  font-size: 1.8rem;
}

/* Custom Alert Banner (Toast) */
.alert-banner {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 1rem 1.5rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  display: none;
  align-items: center;
  gap: 0.75rem;
  z-index: 200;
  animation: slideInUp 0.3s ease;
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--stone);
}

.alert-banner.success {
  border-left: 4px solid var(--sage);
}

.alert-banner.error {
  border-left: 4px solid var(--ember);
}

/* Scrollbars styling */
::-webkit-scrollbar {
  width: 6px;
}

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

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

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

/* Keyframe Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInUp {
  from { transform: translateY(100px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Responsive Overrides */
@media (max-width: 1024px) {
  .shopping-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 2px solid var(--border);
    padding: 1.5rem;
  }
  
  .brand-section {
    margin-bottom: 1.5rem;
    justify-content: space-between;
  }
  
  .nav-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    gap: 0.5rem;
  }
  
  .nav-item {
    padding: 0.5rem 0.85rem;
    font-size: 0.7rem;
    white-space: nowrap;
  }
  
  .nav-footer {
    display: none;
  }
  
  .main-content {
    padding: 2rem 1.5rem;
  }
  
  .planner-day-row {
    grid-template-columns: 1fr;
  }
  
  .planner-day-label {
    padding-top: 1rem;
  }
  
  .modal-container {
    width: 95%;
  }
}
