:root {
  box-sizing: border-box;

  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #f0f0f0;
  --text-tertiary: #e0e0e0;

  /* Glass Theme System */
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);

  --solid-bg: #ffffff;
  --solid-text: #333333;

  /* Functional Colors */
  --primary: #ffffff;
  --highlight-teal: #585563;
  --highlight-yellow: #fdcb6e;

  --card-border: var(--glass-border);
  --btn-bg: rgba(255, 255, 255, 0.2);
  --btn-hover-bg: rgba(255, 255, 255, 0.3);
}

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

/* Custom Scrollbar for sleek look */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* In glass mode, make scrollbar lighter */
body.glass-mode ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
}

body.glass-mode ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}




.material-symbols-outlined {
  font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24
}

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(146deg, #574c93, #990835, #c6ac00);
  background-attachment: fixed;
  color: var(--text-primary);
  margin: 0;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.9rem;
  min-height: 100vh;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  /* color: var(--primary); */
  color: var(--text-primary);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.title h1 {
  margin: 0;
  font-size: 1.6rem;
  text-align: center;
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.title p {
  margin-top: -0.5rem;
  margin-bottom: 0.1rem;
  margin-left: 0rem;
  font-size: 0.85rem;
  /* font-weight: bold; */
  color: var(--text-tertiary);
}

.container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: 100%;
  max-width: 1100px;
}

.container.expanded {
  grid-template-columns: 25rem 1fr;
  max-width: none;
}


@media (min-width: 900px) {
  .container {
    grid-template-columns: 1fr 1fr;
  }
}

.card {
  position: relative;
  z-index: 1;
  background-color: transparent;
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  height: 43rem;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: inherit;
}

.card h2 {
  margin-top: 0;
  margin-bottom: -0.1rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.muted {
  color: var(--text-tertiary);
  /* font-size: 0.8rem; */
  margin-top: 0.1rem;
  margin-bottom: 0.5rem;
}

.suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  flex-grow: 1;
}

.suggestion {
  display: flex;
  align-items: center;
  padding: 0;
  background-color: var(--solid-bg);
  color: var(--solid-text);
  border: 1px solid #eee;
  border-radius: 6px;
  transition: background-color 0.2s, border-color 0.2s;
  flex-shrink: 0;
  height: 65px;
  overflow: hidden;
}

.suggestion-info {
  flex: 1;
  padding: 0 0.75rem;
  display: flex;
  align-items: center;
  height: 100%;
  overflow: hidden;
}

.suggestion-action {
  padding-right: 0.75rem;
  display: flex;
  align-items: center;
  height: 100%;
}

.suggestion .meal-name {
  font-size: 0.95rem;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}

@keyframes shake {

  0%,
  100% {
    transform: translateY(0);
  }

  25% {
    transform: translateY(-4px);
  }

  50% {
    transform: translateY(0);
  }

  75% {
    transform: translateY(4px);
  }
}

@keyframes thunk {
  0% {
    opacity: 0;
    transform: scale(1.05);
  }

  70% {
    transform: scale(0.99);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.app-header,
.container {
  animation: thunk 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.suggestion.drag-over {
  background-color: transparent;
  border: 2px dashed var(--primary);
  animation: shake 0.5s infinite;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.8rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 400;
  transition: background-color 0.2s;
  font-size: 0.85rem;
  text-decoration: none;
  color: white;
  /* Default for glass buttons */
}

.btn:hover .button-text {
  text-decoration: underline;
}

.calendar-btn:hover .calendar-text {
  text-decoration: underline;
}

.btn.highlight-teal,
.btn.highlight-teal:hover {
  background-color: var(--highlight-teal);
  color: white;
}

.btn.highlight-yellow,
.btn.highlight-yellow:hover {
  background-color: var(--highlight-yellow);
  color: var(--text-primary);
}

.controls.footer {
  margin-top: auto;
  padding-top: 0.4rem;
  border-top: 1px solid var(--card-border);
  /* display: flex; */
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
  flex-shrink: 0;
}

.actions-right {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
  justify-content: flex-start;
  align-self: flex-end;
  margin-top: 0.25rem;
}

.actions-right .btn {
  padding: 0.32rem 0.5rem;
  font-size: 0.82rem;
  border-radius: 6px;
  gap: 0.25rem;
  min-width: 90px;
}

.want-different p {
  font-weight: 600;
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

.days-and-randomise {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.days-options {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn.small {
  padding: 0.28rem 0.45rem;
  font-size: 0.82rem;
  min-width: 84px;
}

.days-options label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  font-size: 0.85rem;

  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  flex-direction: row;
  align-content: stretch;
}

.db-controls {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  align-items: center;
}

#search-input,
#tag-filter {
  padding: 0.5rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  background-color: rgba(255, 255, 255, 0.9);
  color: #333;
  font-size: 0.85rem;
}

#search-input::placeholder {
  color: #666;
}

.db-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.5rem;
  flex-grow: 1;
}

.container.expanded .db-list {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
}

.meal-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.6rem;
  background-color: var(--solid-bg);
  border: 1px solid #ddd;
  color: var(--solid-text);
  border-radius: 6px;
  flex-shrink: 0;
  position: relative;

}

.container.expanded .meal-card {
  width: 12.5rem;
  min-height: 7rem;
}

.meal-card:hover {
  cursor: grab;
  border: 1px solid var(--primary);
  transform: scale(0.98);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Hidden edit button by default */
.meal-card .edit-btn {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out, background-color 0.2s, color 0.2s;
}

/* Show on hover */
.meal-card:hover .edit-btn {
  opacity: 1;
  pointer-events: auto;
}

.meal-name {
  font-weight: 700;
}

.meal-meta {
  font-size: 0.75rem;
  color: #666;
  margin-top: 0.4rem;
  flex-wrap: wrap;
  display: flex;
  gap: 4px;
}

.tag {
  background-color: #f0f0f0;
  color: #333;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  margin-left: 0.3rem;
  cursor: pointer;
}

.tag.active {
  background-color: #333;
  color: #fff;
  font-weight: 600;
}


.meal-card .right {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  /* Override default column direction if needed, or set to row in JS/HTML */
}

.db-actions {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--card-border);
  text-align: center;
}

.show-dates {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}


.plan-and-set-date {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.set-date {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}


#start-date-input {
  border: none;
  font-size: 0;
  opacity: 0;
  cursor: inherit;
  /* input is hidden and not selectable */
}

.show-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.footer-actions {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.export-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.export-controls select {
  padding: 0.5rem;
  border: 1px solid var(--card-border);
  border-radius: 4px;
  font-size: 0.85rem;
  background-color: white;
  cursor: pointer;
}

.link-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 0.2s;
  text-decoration: none;
}

.link-btn:hover .button-text {
  color: var(--text-primary);
  text-decoration: underline;
}

.link-btn:hover .button-text {
  color: var(--primary);
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: var(--solid-bg);
  color: var(--solid-text);
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.modal-description {
  margin: 0 0 1.5rem;
  color: #666;
  font-size: 0.9rem;
}

#meal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#meal-form label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-weight: 600;
}

#meal-form input,
#meal-form select {
  padding: 0.8rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  background-color: #f9f9f9;
  color: #333;
}

.modal-actions {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background-color: #258292;
  color: white;
  padding: 0.8rem 1.2rem;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 2000;
}

.suggestion-date {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  justify-content: center;
  background-color: var(--highlight-teal);
  color: white;
  font-weight: 700;
  width: 4.5rem;
  height: 100%;
  border-radius: 0;
  padding: 0;
  flex-shrink: 0;
}

.suggestion-date .day {
  font-size: 1.5rem;
  line-height: 1;
}

.suggestion-date .month-day {
  font-size: 0.75rem;
  line-height: 2;
}

.shopping-list-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.shopping-list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: background-color 0.2s;
}

.shopping-list-item:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.shopping-list-item input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.shopping-list-item input[type="checkbox"]:checked+span {
  text-decoration: line-through;
  color: #999;
}

.shopping-list-item span {
  flex: 1;
}

/* Admin Modal Styles */
.admin-section {
  background-color: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.admin-section h4 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid #ddd;
  padding-bottom: 0.3rem;
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 500;
}

/* Glassmorphism overrides removed, now default */

/* Form inputs in Modals */
body.glass-mode .modal-content input,
body.glass-mode .modal-content select {
  background-color: #f9f9f9;
  color: #333;
  border: 1px solid #ccc;
}


/* Button text color inside solid containers (modals, meal cards) */
.modal-content .btn,
.meal-card .btn {
  color: #333;
}

.modal-content .btn:hover,
.meal-card .btn:hover {
  color: #000;
}

.btn.highlight-teal,
.btn.highlight-yellow {
  color: inherit;
}

.btn.highlight-teal {
  color: white;
}

/* Link Icon Button Styling */
.link-btn-icon {
  background: transparent;
  padding: 0.2rem;
  color: #999;
  border-radius: 50%;
  transition: all 0.2s;
}

.link-btn-icon:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--primary);
}

.link-btn-icon .material-symbols-outlined {
  font-size: 1.2rem;
}

/* Specific adjustment for suggestion action to align nicely */
.suggestion-action .link-btn-icon {
  margin-right: 0.2rem;
}

/* Glass Tint Highlight for Drag Drop */
.card.drag-active::before {
  background-color: rgba(0, 0, 0, 0.4);
}

.card::before {
  transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
}