/* ==========================================
   CSS VARIABLES & THEMES
   ========================================== */
:root {
  --bg-color: #f4f4f4;
  --text-color: #333;
  --card-bg: white;
  --header-bg: #ff7f50;
  --header-text: white;
  --accent-color: #ff7f50;
  --meta-bg: #f9f9f9;
  --description-color: #666;
  --shadow: rgba(0, 0, 0, 0.1);
  --hover-shadow: rgba(0, 0, 0, 0.15);
  --white-overlay-light: rgba(255, 255, 255, 0.1);
  --white-overlay-medium: rgba(255, 255, 255, 0.2);
  --white-overlay-heavy: rgba(255, 255, 255, 0.3);
  --white-overlay-border: rgba(255, 255, 255, 0.8);
  --focus-shadow: rgba(255, 255, 255, 0.3);
  --accent-focus-shadow: rgba(255, 127, 80, 0.3);
  --accent-tip-bg: rgba(255, 154, 128, 0.15);
}

/* Dark mode variables */
[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --text-color: #e0e0e0;
  --card-bg: #2d2d2d;
  --header-bg: #333;
  --header-text: #e0e0e0;
  --accent-color: #ff9a80;
  --meta-bg: #3a3a3a;
  --description-color: #b0b0b0;
  --shadow: rgba(0, 0, 0, 0.3);
  --hover-shadow: rgba(0, 0, 0, 0.4);
  --white-overlay-light: rgba(255, 255, 255, 0.05);
  --white-overlay-medium: rgba(255, 255, 255, 0.1);
  --white-overlay-heavy: rgba(255, 255, 255, 0.15);
  --white-overlay-border: rgba(255, 255, 255, 0.4);
  --focus-shadow: rgba(255, 255, 255, 0.2);
  --accent-focus-shadow: rgba(255, 154, 128, 0.3);
  --accent-tip-bg: rgba(255, 154, 128, 0.1);
}

/* ==========================================
   BASE STYLES
   ========================================== */
html {
  background: var(--bg-color);
  transition: background-color 0.3s ease;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg-color);
  color: var(--text-color);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ==========================================
   HEADER STYLES
   ========================================== */
header {
  background-color: var(--header-bg);
  color: var(--header-text);
  padding: 1rem;
  text-align: center;
  transition: background-color 0.3s ease;
}

/* Header layout */
.header-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.header-top h1 {
  margin: 0;
  text-align: center;
  grid-column: 2;
}

/* Header controls */
.language-controls {
  display: flex;
  align-items: center;
  justify-self: start;
  position: relative;
}

.theme-controls {
  display: flex;
  align-items: center;
  justify-self: end;
}

/* Language selector */
#language-selector {
  position: relative;
  border: 2px solid var(--header-text);
  border-radius: 50%;
  background: var(--white-overlay-medium);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--header-text);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 45px;
  height: 45px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Custom dropdown arrow */
#language-selector::after {
  content: '';
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 0;
  height: 0;
  border-left: 2px solid transparent;
  border-right: 2px solid transparent;
  border-top: 3px solid var(--header-text);
  transition: all 0.3s ease;
  pointer-events: none;
  opacity: 0.7;
}

#language-selector:hover {
  background: var(--white-overlay-heavy);
  transform: scale(1.1);
}

#language-selector:hover::after {
  border-top-color: var(--header-text);
  opacity: 1;
  transform: rotate(180deg);
}

#language-selector:focus {
  outline: none;
  background: var(--white-overlay-heavy);
}

#language-selector:active {
  transform: scale(1);
}

/* Styles pour la liste déroulante du sélecteur de langue */
#language-selector option {
  background: var(--card-bg);
  color: var(--text-color);
  padding: 12px 16px;
  border: none;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.2s ease;
}

#language-selector option:hover,
#language-selector option:focus {
  background: var(--accent-color);
  color: white;
}

#language-selector option:checked {
  background: var(--accent-color);
  color: white;
  font-weight: 600;
}

/* Style pour la liste ouverte (pour les navigateurs qui le supportent) */
#language-selector[aria-expanded="true"] {
  border-radius: 12px 12px 0 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

#language-selector[aria-expanded="true"]::after {
  transform: rotate(180deg);
  opacity: 1;
}

/* Custom dropdown container pour un meilleur style */
.language-controls {
  position: relative;
}

.language-controls::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(to bottom, var(--white-overlay-medium), transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1;
}

#language-selector:focus + .language-controls::before {
  opacity: 1;
}

/* Theme toggle button */
.theme-toggle {
  background: var(--white-overlay-medium);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid var(--header-text);
  color: var(--header-text);
  border-radius: 50%;
  width: 45px;
  height: 45px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background-color: var(--white-overlay-light);
  transform: scale(1.1);
}

/* Search input */
#search {
  margin-top: 10px;
  padding: 0.5rem;
  width: 80%;
  max-width: 400px;
  font-size: 16px;
  background: var(--card-bg);
  color: var(--text-color);
  border: 2px solid var(--accent-color);
  border-radius: 5px;
  transition: all 0.3s ease;
}

#search:focus {
  outline: none;
  box-shadow: 0 0 10px var(--accent-focus-shadow);
}

/* ==========================================
   RECIPE CARD STYLES
   ========================================== */
.recipe-card {
  background: var(--card-bg);
  margin: 1rem auto;
  padding: 1rem;
  max-width: 600px;
  border-radius: 8px;
  box-shadow: 0 0 10px var(--shadow);
  transition: all 0.3s ease;
}

.recipe-card h2 {
  margin-top: 0;
  color: var(--text-color);
}

.recipe-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.recipe-title {
  margin-bottom: 5px;
  color: var(--text-color);
}

.recipe-prep-info {
  margin-top: 0;
  margin-bottom: 10px;
  color: var(--description-color);
}

.recipe-thumbnail {
  /* max-width: 100%; */
  width: 80%;
  max-width: 430px;
  max-height: 350px;
  object-fit: cover;
  display: block;
  margin: 15px auto;
  border-radius: 12px;
  transition: all 0.3s ease;
}

/* Clickable recipe card styles */
.recipe-card.clickable {
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
}

.recipe-card.clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--hover-shadow);
}

.click-hint {
  color: var(--accent-color);
  font-style: italic;
  text-align: right;
  margin-top: 10px;
  font-size: 0.9em;
}

/* ==========================================
   RECIPE DETAIL PAGE STYLES
   ========================================== */

/* Back button */
.back-btn {
  color: var(--header-text);
  text-decoration: none;
  background-color: var(--white-overlay-medium);
  padding: 8px 16px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 10px;
  transition: background-color 0.2s ease;
}

.back-btn:hover {
  background-color: var(--white-overlay-heavy);
}

/* Recipe detail card */
.recipe-detail-card {
  background: var(--card-bg);
  margin: 1rem auto;
  padding: 2rem;
  max-width: 800px;
  border-radius: 8px;
  box-shadow: 0 0 10px var(--shadow);
  transition: all 0.3s ease;
}

.recipe-detail-card h1 {
  color: var(--accent-color);
  margin-top: 0;
  border-bottom: 2px solid var(--accent-color);
  padding-bottom: 10px;
}

.recipe-detail-card h3 {
  color: var(--accent-color);
  margin-top: 0;
  margin-bottom: 15px;
}

.recipe-description {
  font-size: 1.1em;
  color: var(--description-color);
  font-style: italic;
  margin-bottom: 25px;
}

/* Recipe meta information */
.recipe-meta {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  padding: 15px;
  background-color: var(--meta-bg);
  border-radius: 5px;
  transition: background-color 0.3s ease;
}

.recipe-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 15px 0;
  padding: 15px;
  background-color: var(--meta-bg);
  border-radius: 8px;
  border: 1px solid var(--meta-bg);
  transition: all 0.3s ease;
}

.recipe-meta-item {
  text-align: center;
  padding: 8px;
  color: var(--text-color);
}

/* Recipe images */
/* .recipe-main-image {
  width: 100%;
  max-width: 400px;
  height: 250px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 2px solid var(--meta-bg);
  transition: border-color 0.3s ease;
} */

/* Lists */
.ingredients-list, .equipment-list {
  line-height: 1.6;
}

.ingredients-list li, .equipment-list li {
  margin-bottom: 8px;
}

/* ==========================================
   RECIPE STEPS STYLES
   ========================================== */
.steps-container {
  margin-top: 20px;
}

.step-item {
  margin-bottom: 25px;
  padding: 15px;
  border-left: 4px solid var(--accent-color);
  background-color: var(--meta-bg);
  border-radius: 0 8px 8px 0;
  transition: all 0.3s ease;
}

.step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 10px;
}

.step-title {
  margin: 0;
  color: var(--accent-color);
  font-size: 1.1em;
}

.step-time {
  color: var(--description-color);
  font-size: 14px;
  font-weight: bold;
  background-color: var(--bg-color);
  padding: 4px 8px;
  border-radius: 12px;
  border: 1px solid var(--accent-color);
}

.step-instruction {
  margin: 10px 0;
  line-height: 1.6;
  color: var(--text-color);
}

.step-tip {
  background-color: var(--accent-tip-bg);
  padding: 10px;
  border-radius: 5px;
  border-left: 3px solid var(--accent-color);
  margin-top: 10px;
  transition: all 0.3s ease;
}

.step-tip strong {
  color: var(--accent-color);
}

/* Step images */
.step-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 10px 0;
}

.step-image {
  width: 100%;
  max-width: 300px;
  height: auto;
  /* max-height: 200px; */
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--meta-bg);
  transition: all 0.3s ease;
  flex: 1 1 250px;
}

.step-image:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px var(--shadow);
}

/* ==========================================
   BON APPETIT SECTION
   ========================================== */
.bon-appetit {
  background: linear-gradient(135deg, var(--accent-color), var(--bg-color));
  color: var(--text-color);
  text-align: center;
  padding: 30px 20px;
  margin: 30px 0;
  border-radius: 12px;
  box-shadow: 0 4px 15px var(--shadow);
  transition: all 0.3s ease;
}

.bon-appetit h2 {
  margin: 0 0 10px 0;
  font-size: 2em;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.bon-appetit p {
  margin: 0;
  font-size: 1.2em;
  /* font-style: italic; */
  opacity: 0.9;
}

.bon-appetit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--hover-shadow);
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */
@media (max-width: 768px) {
  .step-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .step-time {
    align-self: flex-end;
  }
  
  /* .recipe-main-image {
    max-width: 100%;
    height: 200px;
  } */
  
  .step-images {
    flex-direction: column;
    align-items: center;
  }
  
  .step-image {
    /* max-width: 100%; */
    /* max-height: 150px; */
    flex: none;
  }
}
