/* CSS Variables for theming */
:root {
  --primary-color: #3C2415;
  --secondary-color: #6F4E37;
  --accent-color: #A67B5B;
  --light-accent: #C4915C;
  --background-color: #E6D5AA;
  --text-color: #3C2415;
  --text-light: #6F4E37;
  --white: #FFFFFF;
  --shadow: rgba(60, 36, 21, 0.1);
  --shadow-dark: rgba(60, 36, 21, 0.2);
  --border-radius: 12px;
  --transition: all 0.3s ease;
  --max-width: 1200px;
  --header-height: 80px;
}

/* Dark theme variables */
[data-theme="dark"] {
  --primary-color: #E6D5AA;
  --secondary-color: #C4915C;
  --accent-color: #A67B5B;
  --light-accent: #6F4E37;
  --background-color: #2C1810;
  --text-color: #E6D5AA;
  --text-light: #C4915C;
  --white: #3C2415;
  --shadow: rgba(230, 213, 170, 0.1);
  --shadow-dark: rgba(230, 213, 170, 0.2);
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
  transition: var(--transition);
  overflow-x: hidden;
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.header {
  background: var(--white);
  box-shadow: 0 2px 20px var(--shadow);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-height);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
}

.logo-image {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
}

.logo-text {
  font-weight: 700;
}

.logo-icon {
  font-size: 2rem;
}

/* Navigation */
.nav {
  display: flex;
  align-items: center;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  width: 25px;
  height: 3px;
  background: var(--primary-color);
  margin: 3px 0;
  transition: var(--transition);
  border-radius: 3px;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-link {
  color: var(--text-light);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  transition: var(--transition);
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary-color);
  background: var(--background-color);
}

/* Header Controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.theme-toggle,
.language-toggle {
  background: var(--background-color);
  border: none;
  padding: 0.35rem 0.65rem;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 600;
  color: var(--primary-color);
  transition: var(--transition);
  min-width: 40px;
  min-height: 32px;
}

.theme-toggle:hover,
.language-toggle:hover {
  background: var(--accent-color);
  color: var(--white);
  transform: translateY(-2px);
}

.theme-icon,
.language-text {
  font-size: 0.9rem;
}

.text-success {
  color: #27ae60;
}

.text-warning {
  color: #d35400;
}

/* Privacy page layout */
.policy-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-start;
  margin: 0 0 1.5rem 0;
  color: var(--text-light);
  flex-wrap: wrap;
}

.badge {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: var(--white);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 4px 12px var(--shadow);
}

.policy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.policy-card {
  background: var(--white);
  padding: 1.25rem;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 18px var(--shadow);
  display: grid;
  gap: 0.5rem;
}

.policy-card h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-color);
  font-size: 1.05rem;
}

.policy-card p {
  color: var(--text-light);
}

.policy-list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.35rem;
  color: var(--text-color);
}

.policy-contact {
  margin-top: 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.policy-contact .secondary-button {
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  width: 100%;
  max-width: 320px;
}

.faq-category {
  margin-bottom: 1.5rem;
}

/* Main Content */
.main {
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

.section {
  display: none;
  padding: 2rem 0;
  min-height: calc(100vh - var(--header-height) - 100px);
}

.section.active {
  display: block;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-title {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-weight: 700;
}

.section-description {
  font-size: 1.1rem;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto;
}

/* Hero Section */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  padding: 3rem 0;
  min-height: 500px;
}

.hero-content {
  animation: fadeInUp 0.8s ease-out;
}

.hero-title {
  font-size: 3rem;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.hero-description {
  font-size: 1.2rem;
  color: var(--text-light);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.cta-button {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: var(--white);
  border: none;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 15px var(--shadow);
}

.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px var(--shadow-dark);
}

.hero-image {
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero-placeholder {
  width: 300px;
  height: 300px;
  background: linear-gradient(135deg, var(--accent-color), var(--light-accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px var(--shadow);
}

.hero-icon {
  font-size: 6rem;
  filter: drop-shadow(0 4px 8px var(--shadow));
}

.hero-logo {
  width: 65%;
  max-width: 220px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px var(--shadow));
}

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 4rem;
}

.feature-card {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--border-radius);
  text-align: center;
  box-shadow: 0 4px 20px var(--shadow);
  transition: var(--transition);
  animation: fadeInUp 0.8s ease-out;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px var(--shadow-dark);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.feature-card p {
  color: var(--text-light);
  line-height: 1.6;
}

/* Info / UX helper sections */
.info-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
}

.info-card {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 1.75rem;
  box-shadow: 0 4px 20px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-card-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.info-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--background-color);
  font-size: 1.35rem;
}

.info-subtitle {
  color: var(--text-light);
  font-size: 0.95rem;
}

.steps-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-left: 0;
}

.steps-list li {
  background: var(--background-color);
  padding: 0.8rem 1rem;
  border-radius: var(--border-radius);
  color: var(--text-color);
  box-shadow: inset 0 0 0 1px var(--shadow);
}

.tips-list {
  list-style: disc;
  padding-left: 1.2rem;
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.info-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.secondary-button {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: var(--white);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  box-shadow: 0 4px 12px var(--shadow);
  text-decoration: none;
}

.secondary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px var(--shadow-dark);
}

.ghost-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: var(--border-radius);
  transition: var(--transition);
}

.ghost-link:hover {
  background: var(--background-color);
}

.hint-text {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* Search Bar */
.search-bar {
  display: flex;
  max-width: 500px;
  margin: 2rem auto;
  position: relative;
}

.search-input {
  flex: 1;
  padding: 1rem 1.5rem;
  border: 2px solid var(--accent-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  background: var(--white);
  color: var(--text-color);
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--shadow);
}

.search-button {
  background: var(--primary-color);
  color: var(--white);
  border: none;
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius);
  margin-left: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.search-button:hover {
  background: var(--secondary-color);
}

/* Category Filters */
.category-filters {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.category-btn {
  background: var(--white);
  color: var(--text-color);
  border: 2px solid var(--accent-color);
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.category-btn:hover,
.category-btn.active {
  background: var(--primary-color);
  color: var(--white);
  border-color: var(--primary-color);
}

/* Recipe Grid */
.recipes-grid,
.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.recipe-card {
  background: var(--white);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.recipe-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 32px var(--shadow-dark);
}

.recipe-image {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, var(--accent-color), var(--light-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--white);
  position: relative;
}

.recipe-content {
  padding: 1.1rem 1.25rem 1.25rem;
}

.recipe-title {
  font-size: 1.15rem;
  color: var(--primary-color);
  margin-bottom: 0.35rem;
  font-weight: 600;
  line-height: 1.3;
}

.recipe-category {
  display: inline-block;
  background: var(--background-color);
  color: var(--primary-color);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.recipe-description {
  color: var(--text-light);
  margin-bottom: 0.9rem;
  line-height: 1.45;
}

.recipe-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-light);
}

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

.favorite-btn {
  background: none;
  border: none;
  font-size: 1.35rem;
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease;
  padding: 0.25rem;
}

.favorite-btn:hover {
  transform: scale(1.1);
}

.favorite-btn.active {
  color: #e74c3c;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;

}

.modal-content {
  background: var(--white);
  border-radius: var(--border-radius);
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease-out;
  padding: 0.5rem;
}

/* Espaço extra ao final do modal para respiro em telas ativas */
.modal.active .modal-content {
  padding-bottom: 120px;
}

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

.modal-title {
  font-size: 1.5rem;
  color: var(--primary-color);
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--text-light);
  transition: var(--transition);
}

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

.modal-body {
  padding: 1.5rem 1.75rem 1.75rem;
}

.recipe-details {
  display: grid;
  gap: 1rem;
}

.ingredients-section,
.instructions-section,
.nutrition-section {
  background: var(--background-color);
  padding: 1.25rem;
  border-radius: var(--border-radius);
}

.recipe-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.recipe-meta-info {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.recipe-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: var(--text-light);
}

.recipe-stats span i {
  margin-right: 0.35rem;
}

.ingredients-list {
  list-style: none;
}

.ingredient-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--accent-color);
}

.ingredient-item:last-child {
  border-bottom: none;
}

.ingredient-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.instructions-list {
  list-style: none;
  counter-reset: step-counter;
}

.instruction-item {
  counter-increment: step-counter;
  padding: 0.9rem;
  margin-bottom: 0.9rem;
  background: var(--white);
  border-radius: var(--border-radius);
  position: relative;
  padding-left: 4rem;
}

.instruction-item::before {
  content: counter(step-counter);
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary-color);
  color: var(--white);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.nutrition-item {
  background: var(--white);
  padding: 1rem;
  border-radius: var(--border-radius);
  text-align: center;
}

.nutrition-value {
  font-size: 1.35rem;
  font-weight: bold;
  color: var(--primary-color);
}

.modal-favorite-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
}

@media (min-width: 900px) {
  .recipe-details {
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1.25rem;
  }

  .recipe-header {
    grid-column: 1 / -1;
  }

  .nutrition-section {
    grid-column: 1 / -1;
  }
}

.nutrition-label {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-light);
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  margin-bottom: 1rem;
  color: var(--primary-color);
}

/* Loading */
.loading {
  display: none;
  text-align: center;
  padding: 2rem;
}

.loading.active {
  display: block;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--background-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + 1rem);
  right: 1rem;
  z-index: 3000;
}

.toast {
  background: var(--white);
  color: var(--text-color);
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 20px var(--shadow);
  margin-bottom: 1rem;
  animation: toastSlideIn 0.3s ease-out;
  max-width: 300px;
}

.toast.success {
  border-left: 4px solid #27ae60;
}

.toast.error {
  border-left: 4px solid #e74c3c;
}

.toast.info {
  border-left: 4px solid #3498db;
}

/* Footer */
.footer {
  background: var(--primary-color);
  color: var(--white);
  text-align: center;
  padding: 2rem 0;
  margin-top: 4rem;
}

.footer-text {
  font-size: 0.9rem;
}

.footer-text a {
  color: var(--light-accent);
  text-decoration: none;
  transition: var(--transition);
}

.footer-text a:hover {
  color: var(--background-color);
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .section-title {
    font-size: 2rem;
  }
  
  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    flex-direction: column;
    padding: 1rem;
    box-shadow: 0 4px 20px var(--shadow);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
  }
  
  .nav-menu.active {
    display: flex;
  }
  
  /* Reordenar header em telas pequenas: logo -> toggles -> hambúrguer */
  .header-content {
    gap: 0.5rem;
  }

  .logo {
    order: 1;
  }

  .header-controls {
    order: 2;
    margin-left: auto;
    gap: 0.3rem;
  }

  .nav {
    order: 3;
  }

  .nav-toggle {
    margin-left: 0.5rem;
  }

  .nav-toggle {
    display: flex;
  }
  
  .nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  
  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
  }
  
  .modal-body {
    padding: 1.25rem 1.25rem 1.5rem;
  }
  
  .modal-header {
    padding: 1rem 1.25rem;
  }

  .policy-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

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

  .policy-card {
    padding: 1rem;
  }

  .faq-category {
    margin-bottom: 1rem;
  }
  
  .category-filters {
    flex-direction: column;
    align-items: center;
  }
  
  .recipes-grid,
  .favorites-grid {
    grid-template-columns: 1fr;
  }
  
  .modal-content {
    margin: 0.5rem;
    max-height: calc(100vh - 2rem);
  }
  
  .hero-placeholder {
    width: 200px;
    height: 200px;
  }
  
  .hero-icon {
    font-size: 4rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 0.5rem;
  }
  
  .header-content {
    padding: 0 1rem;
  }
  
  .hero-title {
    font-size: 1.5rem;
  }
  
  .section-title {
    font-size: 1.5rem;
  }
  
  .feature-card {
    padding: 1.5rem;
  }
  
  .toast-container {
    right: 0.5rem;
    left: 0.5rem;
  }
  
  .toast {
    max-width: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-dark: rgba(0, 0, 0, 0.5);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print styles */
@media print {
  .header,
  .footer,
  .modal,
  .toast-container {
    display: none !important;
  }
  
  .main {
    margin-top: 0;
  }
  
  .section {
    display: block !important;
    page-break-inside: avoid;
  }
}
