* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #10b981;
  --background: #ffffff;
  --surface: #f8fafc;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--background);
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.header {
  background-color: var(--background);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 16px 0;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo h1 {
  font-size: 1.5rem;
  color: var(--primary-color);
  margin: 0;
}

.nav {
  display: flex;
  gap: 24px;
}

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary-color);
  background-color: var(--surface);
}

/* <CHANGE> Added header-right for auth button styling */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-auth {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-auth:hover {
  background-color: var(--primary-hover);
}

.btn-auth.logout {
  background-color: #ef4444;
}

.btn-auth.logout:hover {
  background-color: #dc2626;
}

.nav-toggle {
  display: none;
}

.hamburger {
  display: block;
  position: relative;
}

.hamburger,
.hamburger::before,
.hamburger::after {
  background: var(--primary-color);
  width: 2em;
  height: 3px;
  border-radius: 1em;
  transition: transform 250ms ease-in-out;
}

.page {
  display: none;
  padding: 48px 0;
  min-height: calc(100vh - 200px);
}

.page.active {
  display: block;
}

.hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 80px 0;
  text-align: center;
  border-radius: 16px;
  margin-bottom: 48px;
}

.hero-title {
  font-size: 3rem;
  margin-bottom: 16px;
  font-weight: 700;
}

.hero-subtitle {
  font-size: 1.25rem;
  margin-bottom: 32px;
  opacity: 0.95;
}

.btn-primary {
  background-color: white;
  color: #667eea;
  border: none;
  padding: 12px 32px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.btn-primary.btn-full {
  width: 100%;
  background-color: var(--primary-color);
  color: white;
}

.btn-primary.btn-full:hover {
  background-color: var(--primary-hover);
}

.btn-primary.btn-save {
  background-color: var(--primary-color);
  color: white;
  margin-top: 24px;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 32px;
  margin-top: 48px;
}

.feature-card {
  background: var(--surface);
  padding: 32px;
  border-radius: 12px;
  text-align: center;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-size: 1.5rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.feature-card p {
  color: var(--text-secondary);
}

.page-title {
  font-size: 2.5rem;
  margin-bottom: 16px;
  color: var(--text-primary);
  text-align: center;
}

.page-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 1.125rem;
  margin-bottom: 48px;
}

.search-section {
  display: flex;
  gap: 16px;
  max-width: 600px;
  margin: 0 auto 48px;
}

.search-input {
  flex: 1;
  padding: 12px 20px;
  font-size: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  transition: border-color 0.3s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.search-section .btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.search-section .btn-primary:hover {
  background-color: var(--primary-hover);
}

/* <CHANGE> Added dietary profile styles */
.dietary-container {
  max-width: 800px;
  margin: 0 auto;
}

.dietary-section {
  background: var(--surface);
  padding: 32px;
  border-radius: 12px;
  margin-bottom: 32px;
  border: 1px solid var(--border-color);
}

.dietary-section h3 {
  color: var(--primary-color);
  margin-bottom: 20px;
  font-size: 1.25rem;
}

.diet-options,
.allergy-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.diet-checkbox {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
}

.diet-checkbox:hover {
  background-color: rgba(37, 99, 235, 0.05);
}

.diet-checkbox input {
  display: none;
}

.diet-checkbox input:checked + .checkmark {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.diet-checkbox input:checked + .checkmark::after {
  display: block;
}

.checkmark {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  margin-right: 12px;
  position: relative;
  transition: all 0.3s ease;
}

.checkmark::after {
  content: '';
  display: none;
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.nutrition-goals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.goal-item {
  display: flex;
  flex-direction: column;
}

.goal-item label {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.goal-item input {
  padding: 10px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.goal-item input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.profile-message {
  text-align: center;
  margin-top: 16px;
  padding: 12px;
  border-radius: 6px;
  min-height: 20px;
}

.profile-message.success {
  background-color: #d1fae5;
  color: #065f46;
}

.profile-message.error {
  background-color: #fee2e2;
  color: #991b1b;
}

.loading {
  text-align: center;
  padding: 48px;
}

.spinner {
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.recipe-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid var(--border-color);
}

.recipe-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.recipe-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.recipe-content {
  padding: 20px;
}

.recipe-title {
  font-size: 1.25rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.recipe-meta {
  display: flex;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 12px;
}

.recipe-description {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
}

.about-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
  margin-top: 48px;
}

.about-text h3 {
  color: var(--primary-color);
  margin: 24px 0 12px;
  font-size: 1.5rem;
}

.about-text p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 16px;
}

.about-text ul {
  list-style-position: inside;
  color: var(--text-secondary);
  line-height: 2;
}

.about-image img {
  width: 100%;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

.contact-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 48px;
  margin-top: 48px;
}

.contact-form {
  background: var(--surface);
  padding: 32px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-group textarea {
  resize: vertical;
}

.contact-form .btn-primary {
  background-color: var(--primary-color);
  color: white;
  width: 100%;
}

.contact-info {
  background: var(--surface);
  padding: 32px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.contact-info h3 {
  color: var(--primary-color);
  margin-bottom: 24px;
}

.info-item {
  margin-bottom: 24px;
}

.info-item strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.info-item p {
  color: var(--text-secondary);
  line-height: 1.6;
}

/* <CHANGE> Added auth modal styles */
.auth-modal-content {
  max-width: 400px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border-color);
}

.auth-tab-btn {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: none;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
}

.auth-tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.timer-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 320px;
  z-index: 1000;
  border: 1px solid var(--border-color);
}

.timer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px 12px 0 0;
}

.timer-header h3 {
  margin: 0;
  font-size: 1.125rem;
}

.timer-toggle {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.timer-toggle:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.timer-content {
  padding: 20px;
}

.timer-widget.collapsed .timer-content {
  display: none;
}

.timer-display {
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 16px;
  font-family: 'Courier New', monospace;
}

.timer-inputs {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.timer-inputs input {
  width: 60px;
  padding: 8px;
  text-align: center;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
}

.timer-inputs span {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.timer-controls {
  display: flex;
  gap: 8px;
}

.btn-timer {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.875rem;
}

.btn-start {
  background-color: var(--secondary-color);
  color: white;
}

.btn-start:hover {
  background-color: #059669;
}

.btn-pause {
  background-color: #f59e0b;
  color: white;
}

.btn-pause:hover {
  background-color: #d97706;
}

.btn-reset {
  background-color: #ef4444;
  color: white;
}

.btn-reset:hover {
  background-color: #dc2626;
}

.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  overflow-y: auto;
}

.modal.active {
  display: block;
}

.modal-content {
  background-color: white;
  margin: 48px auto;
  padding: 32px;
  border-radius: 12px;
  max-width: 800px;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.close {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.3s ease;
}

.close:hover {
  color: var(--text-primary);
}

.modal-recipe-image {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 24px;
}

.modal-recipe-title {
  font-size: 2rem;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.modal-recipe-meta {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--border-color);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.nutrition-badge {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 4px;
}

.modal-section {
  margin-bottom: 32px;
}

.modal-section h3 {
  color: var(--primary-color);
  margin-bottom: 16px;
  font-size: 1.5rem;
}

.modal-section ul {
  list-style-position: inside;
  color: var(--text-secondary);
  line-height: 2;
}

.modal-section ol {
  padding-left: 20px;
  color: var(--text-secondary);
  line-height: 2;
}

.nutrition-info {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border-radius: 8px;
}

.nutrition-item {
  text-align: center;
}

.nutrition-item strong {
  display: block;
  font-size: 1.5rem;
  color: var(--primary-color);
}

.nutrition-item span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.footer {
  background-color: var(--text-primary);
  color: white;
  padding: 48px 0 24px;
  margin-top: 80px;
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 32px;
}

.footer-section h3 {
  margin-bottom: 16px;
  font-size: 1.25rem;
}

.footer-section h4 {
  margin-bottom: 16px;
  font-size: 1.125rem;
}

.footer-section p {
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.8;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 8px;
}

.footer-section ul li a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-section ul li a:hover {
  color: white;
}

.social-links {
  display: flex;
  gap: 16px;
}

.social-link {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.3s ease;
}

.social-link:hover {
  color: white;
}

@media (max-width: 768px) {
  .header .container {
    justify-content: space-between;
  }

  .nav {
    position: fixed;
    background: var(--background);
    color: var(--text-primary);
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    transform: translateX(100%);
    transition: transform 250ms cubic-bezier(0.5, 0, 0.5, 1);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
  }

  .nav--visible {
    transform: translateX(0);
  }

  .nav-toggle {
    display: block;
    cursor: pointer;
    background: transparent;
    border: 0;
    padding: 0.5em;
    position: absolute;
    z-index: 9999;
    right: 1rem;
    top: 1rem;
  }

  .hamburger::before,
  .hamburger::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
  }

  .hamburger::before {
    top: 6px;
  }
  .hamburger::after {
    bottom: 6px;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .features {
    grid-template-columns: 1fr;
  }

  .about-content,
  .contact-content,
  .footer-content {
    grid-template-columns: 1fr;
  }

  .search-section {
    flex-direction: column;
  }

  .recipes-grid {
    grid-template-columns: 1fr;
  }

  .timer-widget {
    width: calc(100% - 32px);
    left: 16px;
    right: 16px;
  }

  .page-title {
    font-size: 2rem;
  }

  .nutrition-info {
    grid-template-columns: repeat(2, 1fr);
  }

  .diet-options,
  .allergy-options {
    grid-template-columns: 1fr;
  }

  .modal-recipe-meta {
    flex-direction: column;
    gap: 12px;
  }
}