* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #fff;
}

nav {
  background-color: #f8f1e9;
  padding: 1rem;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  border-bottom: 1px solid #e0d5c9;
  gap: 20px;
}

.logo {
  width: 200px;
  height: 70px;
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.search-bar {
  padding: 0.5rem;
  border: 1px solid #d4c3b5;
  border-radius: 4px;
  width: 300px;
}

.auth-buttons {
  margin-left: auto;
  margin-right: 20px;
  color: #6b4423;
  text-decoration: none;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
}

.user-icon {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  object-fit: cover;
  background-color: #e0d5c9;
  padding: 2px;
}

#user-name {
  font-size: 1rem;
  color: #6b4423;
}

.menu-icon {
  cursor: pointer;
}

main {
  flex: 1;
  padding: 2rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.breadcrumb {
  margin: 1rem 0;
  color: #666;
  font-size: 0.9rem;
}

.breadcrumb a {
  color: #6b4423;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.recipe-title {
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 15px;
}

.recipe-title h1 {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* Estilos para la valoración junto al título */
.recipe-rating {
  font-size: 1.2rem;
  color: #6b4423;
  /* Color marrón oscuro para el texto */
  background-color: #f8f1e9;
  /* Fondo beige claro */
  padding: 5px 10px;
  border-radius: 5px;
  font-weight: normal;
}

/* Nueva estructura de 3 columnas */
.recipe-main-content {
  display: grid;
  grid-template-columns: 400px 1fr 400px;
  gap: 20px;
  margin-bottom: 2rem;
}

/* Columna izquierda: foto principal y carrusel */
.recipe-left-column {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.recipe-photo {
  width: 100%;
  position: relative;
}

.recipe-photo a {
  display: block;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.recipe-photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 1024 / 576;
  object-fit: cover;
  display: block;
}

/* Columna central: información de la receta */
.recipe-center-column {
  padding: 0 10px;
}

.recipe-info {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.recipe-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.tag {
  background-color: #f8f1e9;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
}

.recipe-actions {
  display: flex;
  gap: 1rem;
}

.recipe-description {
  margin-top: 20px;
  line-height: 1.6;
  color: #333;
}

/* Columna derecha: video */
.recipe-right-column {
  display: flex;
  align-items: flex-start;
}

.recipe-video {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background-color: #0066cc;
  /* Fondo azul para el video */
  border: 1px solid #add8e6;
}

.recipe-video iframe {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  border: none;
}

/* Estilos para el carrusel de imágenes */
.image-carousel-container {
  background-color: #f8f1e9;
  /* Fondo beige claro para el carrusel */
  border-radius: 8px;
  padding: 15px;
}

.image-thumbnails {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 5px 0;
}

.thumbnail {
  width: 80px;
  height: 45px;
  /* Mantiene la proporción 16:9 (1024:576) */
  flex-shrink: 0;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.thumbnail.active {
  border-color: #6b4423;
  /* Color marrón oscuro para el borde activo */
}

.thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.button {
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.favorite-btn {
  background-color: #fff;
  border: 2px solid #ff4b4b;
  color: #ff4b4b;
}

.favorite-btn:hover {
  background-color: #ff4b4b;
  color: #fff;
}

.favorito-activo {
  background-color: #ff4b4b;
  color: #fff;
}

.rate-btn {
  background-color: #fff;
  border: 2px solid #ffd700;
  color: #ffd700;
}

.rate-btn:hover {
  background-color: #ffd700;
  color: #fff;
}

.recipe-container {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2.5rem;
  margin-top: 2rem;
}

.recipe-ingredients,
.recipe-steps {
  background-color: #f8f1e9;
  padding: 2rem;
  border-radius: 8px;
}

.recipe-ingredients h2,
.recipe-steps h2 {
  margin-bottom: 1rem;
}

.recipe-ingredients ul {
  list-style-position: inside;
}

.recipe-ingredients li {
  margin-bottom: 0.5rem;
}

.recipe-steps ol {
  list-style-position: outside;
  padding-left: 1.2rem;
}

.recipe-steps li {
  margin-bottom: 1rem;
}

.hidden {
  display: none;
}

footer {
  background-color: #6b4423;
  color: #fff;
  text-align: center;
  padding: 1rem;
  margin-top: auto;
}

.rating span {
  font-size: 2rem;
  cursor: pointer;
  color: #ccc;
}

.rating span:hover,
.rating span:hover ~ span {
  color: #f39c12;
}

textarea {
  width: 100%;
  height: 100px;
  margin-top: 10px;
  border-radius: 4px;
  border: 1px solid #ddd;
  padding: 10px;
  font-size: 1rem;
}

button#submitComment {
  margin-top: 10px;
  padding: 10px 20px;
  background-color: #6b4423;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

button#submitComment:hover {
  background-color: #5a3a1d;
}

#commentsList {
  margin-top: 20px;
  font-style: italic;
  color: #666;
}

#commentsSection {
  margin-top: 20px;
  padding: 20px;
  background-color: #f9f9f9;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.comentario {
  margin-bottom: 2rem;
  /* 32px de espacio entre comentarios */
  padding: 1.5rem;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.comentario-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  /* 12px de espacio después del header */
}

.comentario-valoracion {
  margin: 0.75rem 0;
  /* 12px de espacio arriba y abajo de las estrellas */
}

.comentario-texto {
  margin-top: 0.75rem;
  /* 12px de espacio antes del texto */
  line-height: 1.5;
}

#commentsList {
  margin-top: 2rem;
  /* 32px de espacio antes de la lista de comentarios */
}

/* Asegurar que el último comentario no tenga margen inferior */
.comentario:last-child {
  margin-bottom: 0;
}

/* Estilos adicionales para los comentarios */
.comentario {
  margin-bottom: 20px;
  padding: 15px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.comentario-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.comentario-fecha {
  color: #888;
  font-size: 0.9rem;
}

.comentario-valoracion {
  margin-bottom: 8px;
}

.estrella-activa {
  color: #f39c12;
}

.estrella-inactiva {
  color: #ccc;
}

.comentario-texto {
  line-height: 1.5;
}

/* Nuevos estilos para el sistema de respuestas */
.comentario-acciones {
  margin-top: 8px;
  text-align: right;
}

.responder-btn {
  background: none;
  border: none;
  color: #6b4423;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
  text-decoration: underline;
}

.responder-btn:hover {
  color: #8b5933;
}

/* Actualizar estilos para las respuestas */
.respuestas-container {
  margin-top: 10px;
  margin-left: 20px;
  border-left: 3px solid #6b4423;
  /* Borde más grueso y del color principal */
  padding-left: 15px;
}

.respuesta {
  margin-bottom: 10px;
  padding: 15px;
  background-color: #f8f1e9;
  /* Fondo ligeramente diferente para distinguirlas */
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: relative;
  /* Para posicionar el indicador de respuesta */
}

.respuesta::before {
  content: "↪";
  /* Flecha que indica respuesta */
  position: absolute;
  left: -25px;
  top: 15px;
  color: #6b4423;
  font-size: 1.2rem;
  font-weight: bold;
}

.respuesta-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.respuesta-fecha {
  color: #888;
  font-size: 0.9rem;
}

.respuesta-texto {
  line-height: 1.5;
  margin-top: 0.75rem;
}

.respuesta-acciones {
  margin-top: 8px;
  text-align: right;
}

.replying-to {
  background-color: #f8f1e9;
  padding: 8px;
  margin-bottom: 8px;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #6b4423;
}

#cancelReply {
  margin-left: 8px;
  padding: 10px 20px;
  background-color: #ccc;
  color: #333;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#cancelReply:hover {
  background-color: #bbb;
}

.comment-buttons {
  display: flex;
  margin-top: 10px;
}

/* Responsive */
@media (max-width: 1200px) {
  .recipe-main-content {
    grid-template-columns: 1fr 1fr;
  }

  .recipe-right-column {
    grid-column: span 2;
    margin-top: 20px;
  }
}

@media (max-width: 768px) {
  .recipe-main-content {
    grid-template-columns: 1fr;
  }

  .recipe-right-column,
  .recipe-center-column {
    grid-column: 1;
  }

  .recipe-container {
    grid-template-columns: 1fr;
  }

  .menu-icon {
    display: block;
  }

  .search-bar {
    display: none;
  }
}

/* Make sure images are responsive by default */
img {
  max-width: 100%;
  height: auto;
}

/* Responsive layout for recipe-main-content */
@media screen and (max-width: 1200px) {
  .recipe-main-content {
    grid-template-columns: 1fr 1fr;
  }

  .recipe-right-column {
    grid-column: span 2;
    margin-top: 20px;
  }
}

@media screen and (max-width: 768px) {
  .recipe-main-content {
    grid-template-columns: 1fr;
  }

  .recipe-right-column,
  .recipe-center-column {
    grid-column: 1;
  }

  .recipe-container {
    grid-template-columns: 1fr;
  }

  .recipe-ingredients,
  .recipe-steps {
    padding: 1.5rem;
  }

  .recipe-photo img {
    height: auto;
  }

  /* Improve navigation on mobile */
  nav {
    flex-wrap: wrap;
    gap: 10px;
  }

  .logo {
    width: 150px;
    height: 50px;
  }

  .search-bar {
    width: 100%;
    order: 3;
    margin-top: 10px;
  }

  .auth-buttons {
    margin-left: auto;
    margin-right: 10px;
  }

  /* Improve image carousel on mobile */
  .image-thumbnails {
    gap: 5px;
  }

  .thumbnail {
    width: 60px;
    height: 34px;
  }

  /* Improve comments section on mobile */
  #commentsSection {
    padding: 15px;
  }

  .comment-buttons {
    flex-direction: column;
    gap: 10px;
  }

  #submitComment,
  #cancelReply {
    width: 100%;
  }
}

@media screen and (max-width: 480px) {
  .recipe-title h1 {
    font-size: 1.5rem;
  }

  .recipe-tags {
    flex-direction: column;
    gap: 0.5rem;
  }

  .tag {
    width: 100%;
    text-align: center;
  }

  .recipe-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .button {
    width: 100%;
  }

  .recipe-ingredients h2,
  .recipe-steps h2 {
    font-size: 1.2rem;
  }

  .recipe-ingredients,
  .recipe-steps {
    padding: 1rem;
  }

  /* Improve user info display on mobile */
  .user-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  /* Ensure the menu icon is visible and properly sized */
  .menu-icon {
    font-size: 1.5rem;
    margin-left: auto;
  }
}

/* Ensure the overlay menu is responsive */
.overlay-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: none;
  overflow-y: auto;
}

.overlay-content {
  position: relative;
  top: 0;
  width: 100%;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 2rem;
  color: white;
  cursor: pointer;
}

.menu-section {
  margin-bottom: 2rem;
}

.menu-section h3 {
  color: white;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.menu-section ul {
  list-style: none;
  padding: 0;
}

.menu-section li {
  margin-bottom: 0.5rem;
}

.menu-section a {
  color: #f8f1e9;
  text-decoration: none;
  font-size: 1rem;
  transition: color 0.3s ease;
}

.menu-section a:hover {
  color: #fff;
  text-decoration: underline;
}

@media screen and (max-width: 768px) {
  .overlay-content {
    padding: 1rem;
  }

  .menu-section {
    margin-bottom: 1.5rem;
  }

  .menu-section h3 {
    font-size: 1.1rem;
  }

  .menu-section a {
    font-size: 0.9rem;
  }
}

/* Fix for the rating stars on mobile */
.rating {
  display: flex;
  justify-content: center;
  margin: 10px 0;
}

.rating span {
  font-size: 2rem;
  cursor: pointer;
  color: #ccc;
  margin: 0 5px;
}

@media screen and (max-width: 480px) {
  .rating span {
    font-size: 1.5rem;
    margin: 0 2px;
  }
}

/* Ensure the breadcrumb is responsive */
.breadcrumb {
  white-space: normal;
  word-wrap: break-word;
}

/* Fix for footer on small screens */
@media screen and (max-width: 480px) {
  footer {
    padding: 0.75rem;
    font-size: 0.8rem;
  }
}
