:root {
  --primary-color: #00796b;
  --secondary-color: #546e7a;
  --bg-color: #f5f5f5;
  --card-bg: #ffffff;
  --text-color: #333;
}

body {
  font-family: "Roboto", "Segoe UI", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

main {
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header */
.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.logo {
  width: 40px;
  height: 40px;
}
h1 {
  margin: 0;
  font-size: 1.8rem;
  color: var(--primary-color);
}
.tagline {
  font-size: 0.9rem;
  color: var(--secondary-color);
  text-align: center;
  margin-bottom: 24px;
}

/* Buttons & Hints */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  margin-bottom: 15px;
}

button {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--primary-color);
  color: white;
}

.hint-text {
  font-size: 0.75rem;
  color: #777;
  text-align: center;
  margin-bottom: 10px;
  display: block;
}

/* Inputs */
textarea {
  width: 100%;
  height: 80px;
  padding: 12px;
  margin: 10px 0 5px 0;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

.helper-text {
  font-size: 0.8rem;
  color: #666;
  width: 100%;
  text-align: left;
  margin-bottom: 10px;
  font-style: italic;
}

/* Product Name Row */
.scan-row {
  display: flex;
  width: 100%;
  gap: 10px;
  margin-bottom: 15px;
}

#product-name {
  flex: 1;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
}

/* Only Add Button remains (hidden by default) */
#add-list-btn {
  flex: 0.4; /* Takes up less space than input */
  background-color: #f57c00;
  display: none;
  margin-top: 0;
}

/* Shopping List */
.shopping-list-container {
  width: 100%;
  margin-top: 30px;
  border-top: 2px solid #eee;
  padding-top: 15px;
}

.list-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.list-header-row h3 {
  font-size: 1.2rem;
  color: var(--secondary-color);
  margin: 0;
}

.list-instruction {
  font-size: 0.8rem;
  color: #666;
  font-style: italic;
  margin-bottom: 15px;
  display: block;
  width: 100%;
}

.list-actions {
  display: flex;
  gap: 10px;
}

.icon-btn {
  background: none;
  border: 1px solid #ccc;
  padding: 5px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.1rem;
  color: #555;
  width: auto;
}

.list-item {
  background: #fafafa;
  border: 1px solid #eee;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.delete-btn {
  background: none;
  border: none;
  color: #d32f2f;
  font-size: 1.2rem;
  cursor: pointer;
  width: auto;
  padding: 0 5px;
}

/* Scanner Window */
#reader {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 10px;
  display: none;
  border: 2px solid var(--primary-color);
}

/* Result Card Styles */
#results {
  width: 100%;
  margin-top: 10px;
}
.results-card {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background-color: #fff;
}
.results-header {
  background-color: #d32f2f;
  color: white;
  padding: 12px;
  font-weight: bold;
  text-align: center;
}
.results-header.safe {
  background-color: #388e3c;
}
.results-table-header {
  display: flex;
  background-color: #f5f5f5;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #666;
  border-bottom: 1px solid #eee;
}
.results-table-header span:first-child {
  flex: 1;
}
.results-table {
  display: flex;
  flex-direction: column;
}
.results-row {
  display: flex;
  padding: 12px;
  border-bottom: 1px solid #eee;
  gap: 10px;
}
.results-row:last-child {
  border-bottom: none;
}
.ingredient-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.ingredient-name {
  font-weight: bold;
  color: #d32f2f;
}
.ingredient-match {
  font-size: 0.8rem;
  color: #888;
}
.org-tags {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}
.org-tag {
  background-color: #eceff1;
  color: #455a64;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  white-space: nowrap;
}

/* Disclaimer & Footer */
.disclaimer {
  padding: 10px;
  background-color: #fafafa;
  font-size: 0.8rem;
  color: #666;
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid #eee;
  cursor: pointer;
}
.disclaimer-icon {
  background-color: #b0bec5;
  color: white;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

/* Full Expanded Disclaimer */
.full-disclaimer {
  display: none; /* Hidden by default */
  background-color: #f9f9f9;
  padding: 15px;
  border-top: 1px solid #eee;
  font-size: 0.85rem;
  color: #555;
  line-height: 1.4;
}
.full-disclaimer p {
  margin-bottom: 10px;
  margin-top: 0;
}
.policy-title {
  font-weight: bold;
  margin: 10px 0 5px 0;
  color: #333;
}
.policy-link {
  display: flex;
  align-items: center;
  padding: 8px;
  background: white;
  border: 1px solid #eee;
  border-radius: 6px;
  margin-bottom: 6px;
  text-decoration: none;
  color: #333;
}
.policy-link .num {
  background: #eee;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  margin-right: 10px;
}
.policy-link .external-icon {
  margin-left: auto;
  color: #999;
  font-size: 0.8rem;
}

.desktop-only-msg {
  background-color: #e3f2fd;
  color: #0277bd;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: 15px;
  border: 1px solid #b3e5fc;
}
button:disabled {
  background-color: #e0e0e0 !important;
  color: #9e9e9e !important;
  cursor: not-allowed;
}
