/* CSS Variables & Theme */
:root {
  --primary: #E65100;
  --primary-light: #FF9800;
  --primary-subtle: #FFF3E0;
  --primary-dark: #BF360C;

  --secondary: #2E7D32;
  --secondary-subtle: #E8F5E9;

  --accent-canh: #0288D1;
  --accent-canh-bg: #E1F5FE;
  --accent-man: #D84315;
  --accent-man-bg: #FBE9E7;
  --accent-xao: #388E3C;
  --accent-xao-bg: #E8F8F5;

  --bg-page: #FBF9F5;
  --bg-card: #FFFFFF;
  --bg-card-subtle: #F6F3EE;

  --text-main: #212529;
  --text-muted: #6C757D;
  --text-light: #8E9A9D;

  --border-color: #EBDDCB;
  --border-light: #F0EAE1;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 12px 32px rgba(230, 81, 0, 0.12);

  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #FFF8E1 0%, #FFE0B2 100%);
  border-bottom: 2px solid var(--border-color);
  padding: 24px 0 20px;
  text-align: center;
}

.header-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary-dark);
}

.app-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.5px;
}

.app-title span {
  color: var(--primary);
}

.app-subtitle {
  color: #5D4037;
  font-size: 1.05rem;
  max-width: 600px;
}

.date-today {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #8D6E63;
  margin-top: 4px;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 28px 0 40px;
}

/* Form Card */
.filter-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  margin-bottom: 32px;
}

.form-header {
  margin-bottom: 20px;
  text-align: center;
}

.form-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}

.form-header p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-label .icon {
  font-size: 1.15rem;
}

.options-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Custom Option Radio/Pill */
.pill-radio {
  flex: 1;
  min-width: 70px;
  position: relative;
}

.pill-radio input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.pill-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 10px;
  border-radius: var(--radius-md);
  background-color: var(--bg-card-subtle);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  text-align: center;
}

.pill-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
}

.pill-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.pill-radio input:checked + .pill-label {
  background-color: var(--primary-subtle);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.pill-radio input:checked + .pill-label .pill-title {
  color: var(--primary-dark);
}

.pill-radio input:checked + .pill-label .pill-desc {
  color: var(--primary);
  font-weight: 600;
}

.pill-radio:hover .pill-label {
  border-color: #FFB74D;
}

/* Action Area */
.form-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border: none;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 14px 36px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(230, 81, 0, 0.35);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(230, 81, 0, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: white;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-card-subtle);
  border-color: #BDBDBD;
}

/* Results Section */
.results-section {
  animation: fadeIn 0.4s ease-out;
}

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

.menu-summary-bar {
  background: white;
  border-radius: var(--radius-md);
  padding: 16px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.summary-info h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.summary-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.summary-tag {
  background: var(--bg-card-subtle);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

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

/* Dishes Grid */
.dishes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

/* Dish Card */
.dish-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dish-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.dish-image-wrapper {
  position: relative;
  width: 100%;
  height: 200px;
  background-color: #E0E0E0;
  overflow: hidden;
}

.dish-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.dish-card:hover .dish-image {
  transform: scale(1.05);
}

.dish-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.badge-canh {
  background: #E1F5FE;
  color: #0277BD;
}

.badge-man {
  background: #FBE9E7;
  color: #C2410C;
}

.badge-xao {
  background: #E8F5E9;
  color: #2E7D32;
}

.dish-meta-chips {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
}

.meta-chip {
  background: rgba(0, 0, 0, 0.65);
  color: white;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  backdrop-filter: blur(4px);
}

.dish-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.dish-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.dish-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

.btn-reroll-dish {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-reroll-dish:hover {
  background: var(--primary-subtle);
  color: var(--primary);
  border-color: var(--primary);
  transform: rotate(90deg);
}

.dish-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.ingredients-box {
  background: var(--bg-card-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: auto;
  border: 1px dashed var(--border-color);
}

.ingredients-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.scale-hint {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-light);
}

.ingredients-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ingredient-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
}

.ingredient-name {
  color: var(--text-main);
  font-weight: 500;
}

.ingredient-amount {
  font-weight: 700;
  color: var(--primary-dark);
  background: white;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  white-space: nowrap;
}

/* Master Shopping List Section */
.shopping-section {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
}

.shopping-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.shopping-title-group h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.shopping-title-group p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.shopping-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.shopping-group-card {
  background: var(--bg-card-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border-light);
}

.group-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 6px;
}

.checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.check-item.done span {
  text-decoration: line-through;
  color: var(--text-light);
}

/* Empty State / Initial Hero */
.hero-intro {
  text-align: center;
  padding: 40px 20px;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-color);
  margin-bottom: 24px;
}

.hero-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  display: inline-block;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.hero-intro h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.hero-intro p {
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto 20px;
}

/* Toast Message */
.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #333;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1000;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all 0.3s ease;
}

.toast-msg.show {
  opacity: 1;
  transform: translateY(0);
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 24px 16px;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-muted);
  background: white;
}

/* Responsive Styles for Mobile */
@media (max-width: 768px) {
  .app-title {
    font-size: 1.8rem;
  }

  .filter-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .filter-card {
    padding: 18px 16px;
  }

  .btn-primary {
    width: 100%;
    padding: 14px;
  }

  .menu-summary-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .summary-actions {
    width: 100%;
  }

  .summary-actions button {
    flex: 1;
  }

  .dishes-grid {
    grid-template-columns: 1fr;
  }

  .shopping-header {
    flex-direction: column;
    align-items: stretch;
  }

  .shopping-header button {
    width: 100%;
  }
}
