/* Variables de colores */
:root {
  --primary: #ff7f00;
  --primary-dark: #e67200;
  --primary-light: rgba(255, 127, 0, 0.1);
  --secondary: #4caf50;
  --dark: #333333;
  --light: #f8f9fa;
  --gray: #6c757d;
  --white: #ffffff;
  --error: #f44336;
  --warning: #ff9800;
  --background: #f5f5f5;
  --shadow-light: 0 2px 5px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 4px 8px rgba(0, 0, 0, 0.15);
  --shadow-heavy: 0 8px 16px rgba(0, 0, 0, 0.2);
  --border-radius: 10px;
  --transition: all 0.2s ease;
}

/* Reset y estilos base móviles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  line-height: 1.5;
  color: var(--dark);
  background-color: var(--background);
  padding-bottom: env(safe-area-inset-bottom);
  font-size: 16px;
  overflow-x: hidden;
}

.container {
  width: 100%;
  padding: 0 15px;
  margin: 0 auto;
}

/* Header móvil mejorado */
.header {
  background-color: var(--white);
  box-shadow: var(--shadow-light);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  height: 60px;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  font-size: 1.2rem;
  font-weight: 700;
}

.logo img {
  width: 42px;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.95)); /* Sombra alrededor del logo */
}

/* AI Toggle Button */
.ai-toggle-btn {
  position: relative;
  font-size: 1.4rem;
  color: var(--primary);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--primary-light);
  border: none;
  margin-left: 8px;
}

.ai-toggle-btn:hover {
  background: var(--primary);
  color: var(--white);
  transform: scale(1.05);
}

.ai-toggle-btn:active {
  transform: scale(0.95);
}

/* Mejoras en el menú hamburguesa para móviles */
.menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 201;
}

.menu-toggle span {
  width: 100%;
  height: 3px;
  background: var(--dark);
  border-radius: 2px;
  transition: var(--transition);
  transform-origin: center;
}

.menu-toggle.active span:first-child {
  transform: rotate(45deg) translate(7px, 7px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
  transform: translateX(20px);
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Menú móvil optimizado */
.mobile-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 85%;
  max-width: 300px;
  height: 100vh;
  background: var(--white);
  z-index: 200;
  transition: var(--transition);
  padding: 70px 20px 30px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-menu.active {
  right: 0;
}

.mobile-menu ul {
  list-style: none;
}

.mobile-menu li {
  margin-bottom: 15px;
  opacity: 0;
  transform: translateX(30px);
  transition: var(--transition);
}

.mobile-menu.active li {
  opacity: 1;
  transform: translateX(0);
}

.mobile-menu.active li:nth-child(1) {
  transition-delay: 0.1s;
}
.mobile-menu.active li:nth-child(2) {
  transition-delay: 0.2s;
}
.mobile-menu.active li:nth-child(3) {
  transition-delay: 0.3s;
}

.mobile-menu a {
  display: block;
  padding: 14px 18px;
  font-weight: 500;
  color: var(--dark);
  border-radius: var(--border-radius);
  transition: var(--transition);
  font-size: 1.1rem;
}

.mobile-menu a:hover,
.mobile-menu a.active {
  background-color: var(--primary-light);
  color: var(--primary);
}

.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 1;
  backdrop-filter: blur(3px);
}

.menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

.close-menu {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--dark);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary-light);
}
.cart-notification {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--secondary);
  color: white;
  padding: 12px 20px;
  border-radius: 25px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 2000; /* Aumenta el z-index significativamente */
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-medium);
  cursor: pointer;
  pointer-events: none; /* Inicialmente deshabilitado */
}

.cart-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto; /* Habilitar clicks cuando se muestra */
}

.cart-notification:hover {
  background: var(--primary-dark);
  transform: translateX(-50%) translateY(0) scale(1.05);
}

.cart-notification i {
  font-size: 1rem;
}

/* Estados de carga y error optimizados para móvil */
.status-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  min-height: 60vh;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--primary-light);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

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

.error-icon {
  font-size: 40px;
  color: var(--error);
  margin-bottom: 20px;
}

.status-container h2 {
  margin-bottom: 12px;
  color: var(--dark);
  font-size: 1.4rem;
}

.status-container p {
  color: var(--gray);
  margin: 0 auto 20px;
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 100%;
}

.btn {
  display: inline-block;
  padding: 14px 28px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 30px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  min-width: 140px;
  text-align: center;
}

.btn:active {
  transform: scale(0.98);
}

/* Información del restaurante para móviles */
.restaurant-info {
  text-align: center;
  padding: 20px 0;
  margin: 10px 0 20px;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-light);
}

.restaurant-logo {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 12px;
  border: 2px solid var(--primary);
}

.restaurant-name {
  font-size: 1.4rem;
  color: var(--dark);
  margin-bottom: 5px;
  padding: 0 10px;
  font-weight: 700;
  line-height: 1.3;
}

/* Selector de categorías optimizado para móviles */
.category-selector {
  display: block;
  width: 100%;
  padding: 14px 18px;
  margin-bottom: 20px;
  border: 1px solid #e0e0e0;
  border-radius: var(--border-radius);
  background-color: var(--white);
  font-size: 1rem;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff7f00' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 16px;
}

/* Productos para móviles */
.products-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 30px;
}

.product-card {
  background: var(--white);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-light);
  transition: var(--transition);
  position: relative; /* Added for positioning overlay */
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.product-image {
  width: 100%;
  height: 200px; /* Increased height for better image display */
  object-fit: cover;
  object-position: center; /* Center the image for better composition */
}

.product-info {
  padding: 16px;
}

.product-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.product-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.3;
  margin-right: 10px;
}

.product-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.product-description {
  color: var(--gray);
  margin-bottom: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.product-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.tag {
  padding: 5px 10px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tag.gluten {
  background: rgba(255, 152, 0, 0.15);
  color: var(--warning);
}

.tag.vegan {
  background: rgba(76, 175, 80, 0.15);
  color: var(--secondary);
}

.add-to-cart-btn {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  margin-top: 8px;
}

.add-to-cart-btn:active {
  transform: scale(0.98);
}

/* Enhanced button animation for better feedback */
.add-to-cart-btn.adding {
  background: var(--secondary);
  transform: scale(1.05);
}

/* Productos inactivos */
.product-card.inactive {
  opacity: 0.6;
  position: relative; /* Ensure relative positioning for overlay */
}

.product-card.inactive::after {
  content: "No disponible";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.8); /* Darker background for better visibility */
  color: white;
  padding: 8px 16px; /* Increased padding */
  border-radius: 20px; /* More rounded corners */
  font-weight: bold;
  font-size: 0.9rem; /* Slightly larger font */
  z-index: 10; /* Ensure overlay appears above content */
  white-space: nowrap; /* Prevent text wrapping */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); /* Add shadow for better visibility */
}

/* New styles for better image handling on different screen sizes */
@media (max-width: 480px) {
  .product-image {
    height: 180px; /* Slightly smaller on very small screens */
  }
}

@media (min-width: 481px) and (max-width: 767px) {
  .product-image {
    height: 220px; /* Larger on medium mobile screens */
  }
}

/* Carrito optimizado para móviles */
.cart-icon {
  position: relative;
  font-size: 1.4rem;
  color: var(--dark);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  z-index: 150;
  pointer-events: auto;
}

.cart-count {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  transition: var(--transition);
}

/* Enhanced cart count animation */
.cart-count.updated {
  animation: cartBounce 0.6s ease;
}

@keyframes cartBounce {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
    background: var(--secondary);
  }
  100% {
    transform: scale(1);
  }
}

.cart-container {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 100%;
  height: 100vh;
  background: var(--white);
  z-index: 1000;
  transition: var(--transition);
  padding: 70px 20px 30px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.cart-container.active {
  right: 0;
}

.cart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 999;
}

.cart-overlay.active {
  opacity: 1;
  visibility: visible;
}

.close-cart {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--dark);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary-light);
}

.cart-title {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: var(--dark);
  font-weight: 700;
}

.cart-items {
  margin-bottom: 20px;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #f0f0f0;
}

.item-info {
  flex: 2;
  padding-right: 12px;
}

.item-name {
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.item-price {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
}

.item-quantity {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quantity-btn {
  background: #f5f5f5;
  border: 1px solid #ddd;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quantity-display {
  min-width: 26px;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.remove-item {
  color: var(--error);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  margin-left: 8px;
  padding: 4px;
}

.cart-total {
  font-size: 1.2rem;
  font-weight: bold;
  margin: 20px 0;
  text-align: right;
  color: var(--dark);
  padding: 15px 0;
  border-top: 1px solid #eee;
}

.checkout-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 16px;
  border-radius: var(--border-radius);
  cursor: pointer;
  width: 100%;
  font-size: 1rem;
  font-weight: 600;
  transition: var(--transition);
}

.checkout-btn:active {
  transform: scale(0.98);
}

.empty-cart-msg {
  text-align: center;
  color: var(--gray);
  padding: 30px 0;
  font-size: 1rem;
}

/* Mode Selection Modal */
.mode-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.mode-modal-content {
  background: var(--white);
  border-radius: 20px;
  padding: 30px;
  max-width: 500px;
  width: 100%;
  text-align: center;
  animation: slideUp 0.3s ease;
  box-shadow: var(--shadow-heavy);
}

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

.mode-modal-content h2 {
  font-size: 1.8rem;
  color: var(--dark);
  margin-bottom: 10px;
  font-weight: 700;
}

.mode-modal-content > p {
  color: var(--gray);
  margin-bottom: 30px;
  font-size: 1rem;
}

.mode-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
}

.mode-option-btn {
  background: var(--white);
  border: 2px solid #e0e0e0;
  border-radius: 15px;
  padding: 25px 20px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.mode-option-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

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

.mode-option-btn i {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 12px;
  display: block;
}

.mode-option-btn h3 {
  font-size: 1.2rem;
  color: var(--dark);
  margin-bottom: 8px;
  font-weight: 600;
}

.mode-option-btn p {
  font-size: 0.9rem;
  color: var(--gray);
  margin: 0;
  line-height: 1.4;
}

/* AI Chat Container */
.ai-chat-container {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 100%;
  height: 100%;
  z-index: 800;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-heavy);
  animation: slideInFromBottom 0.3s ease;
  pointer-events: auto; /* Asegura que los eventos del mouse funcionen */
}

@keyframes slideInFromBottom {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.ai-chat-header {
  background: var(--primary);
  color: var(--white);
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-light);
}

.ai-chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 600;
}

.ai-chat-title i {
  font-size: 1.3rem;
}

.close-ai-chat {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--white);
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: var(--transition);
}

.close-ai-chat:hover {
  background: rgba(255, 255, 255, 0.3);
}

.close-ai-chat:active {
  transform: scale(0.95);
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8f9fa;
  -webkit-overflow-scrolling: touch;
}

.ai-message,
.user-message {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  animation: messageSlideIn 0.3s ease;
}

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

.user-message {
  flex-direction: row-reverse;
}

.ai-avatar,
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}

.ai-avatar {
  background: var(--primary-light);
  color: var(--primary);
}

.user-avatar {
  background: var(--secondary);
  color: var(--white);
}

.ai-message-content,
.user-message-content {
  background: var(--white);
  padding: 12px 16px;
  border-radius: 15px;
  max-width: 75%;
  line-height: 1.5;
  font-size: 0.95rem;
  box-shadow: var(--shadow-light);
}

.user-message-content {
  background: var(--primary);
  color: var(--white);
}
/* Diseño mejorado para tarjetas de productos en el chat - Imagen arriba */
.product-recommendation {
  margin: 12px 0;
  border-radius: 16px;
  overflow: hidden;
  transition: var(--transition);
  background: var(--white);
  box-shadow: var(--shadow-light);
  border: 1px solid #e8e8e8;
}

.product-recommendation:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-medium);
  border-color: var(--primary-light);
}

.recommended-product-card {
  display: flex;
  flex-direction: column;
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 0;
  box-shadow: none;
  gap: 0;
  align-items: stretch;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  position: relative;
  overflow: hidden;
}

.recommended-product-img-container {
  width: 100%;
  height: 160px;
  position: relative;
  overflow: hidden;
}

.recommended-product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  transition: var(--transition);
}

.recommended-product-card:hover .recommended-product-img {
  transform: scale(1.05);
}

.recommended-product-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.recommended-product-info h4 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--dark);
  font-weight: 700;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recommended-product-desc {
  margin: 0;
  font-size: 0.9rem;
  color: var(--gray);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
}

.recommended-product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
}

.recommended-product-price {
  font-weight: 800;
  color: var(--primary);
  font-size: 1.2rem;
  letter-spacing: -0.5px;
}

.add-to-cart-from-chat {
  background: var(--primary);
  color: var(--white);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(255, 127, 0, 0.3);
}

.add-to-cart-from-chat:hover {
  background: var(--primary-dark);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(255, 127, 0, 0.4);
}

.add-to-cart-from-chat:active {
  transform: scale(0.95);
}

/* Badge para productos destacados */
.recommended-product-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--primary);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Estados de éxito al agregar productos */
.add-to-cart-from-chat.added {
  background: var(--secondary);
  transform: scale(1);
}

/* Mejoras específicas para el contenedor de mensajes AI */
.ai-message-content .product-recommendation {
  margin-left: 0;
  margin-right: 0;
  max-width: 280px;
}

/* Mejoras responsivas para las tarjetas en el chat */
@media (max-width: 480px) {
  .ai-message-content .product-recommendation {
    max-width: 100%;
  }
  
  .recommended-product-img-container {
    height: 140px;
  }
  
  .recommended-product-info {
    padding: 14px;
  }
  
  .recommended-product-info h4 {
    font-size: 1rem;
  }
  
  .recommended-product-desc {
    font-size: 0.85rem;
  }
  
  .recommended-product-price {
    font-size: 1.1rem;
  }
  
  .add-to-cart-from-chat {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

/* Animación suave al aparecer las recomendaciones */
.ai-message .product-recommendation {
  animation: slideInUp 0.4s ease-out;
}

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

/* Separación visual entre múltiples productos */
.product-recommendation + .product-recommendation {
  margin-top: 12px;
}

/* Efecto de overlay en hover para la imagen */
.recommended-product-img-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.03);
  opacity: 0;
  transition: var(--transition);
}

.recommended-product-card:hover .recommended-product-img-container::after {
  opacity: 1;
}

/* Tags dentro de la tarjeta */
.recommended-product-tags {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.recommended-product-tag {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.recommended-product-tag.gluten {
  background: rgba(255, 152, 0, 0.15);
  color: var(--warning);
}

.recommended-product-tag.vegan {
  background: rgba(76, 175, 80, 0.15);
  color: var(--secondary);
}

.ai-chat-input-container {
  display: flex;
  gap: 10px;
  padding: 15px 20px;
  background: var(--white);
  border-top: 1px solid #e0e0e0;
}

.ai-chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 25px;
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.ai-chat-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.ai-send-btn {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
  flex-shrink: 0;
}

.ai-send-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.ai-send-btn:active {
  transform: scale(0.95);
}

.ai-send-btn:disabled {
  background: var(--gray);
  cursor: not-allowed;
  transform: none;
}

.ai-loading {
  padding: 10px 20px;
  text-align: center;
}

.ai-loading-dots {
  display: inline-flex;
  gap: 5px;
}

.ai-loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: dotPulse 1.4s infinite ease-in-out;
}

.ai-loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.ai-loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes dotPulse {
  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Responsive adjustments for AI chat */
@media (min-width: 768px) {
  .ai-chat-container {
    width: 400px;
    height: 600px;
    bottom: 20px;
    right: 20px;
    border-radius: 15px;
    max-height: calc(100vh - 100px);
  }

  .mode-options {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 992px) {
  .ai-chat-container {
    width: 450px;
    height: 650px;
  }
}

/* Media queries for tablets */
@media (min-width: 768px) {
  .container {
    max-width: 720px;
  }

  .products-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .product-image {
    height: 200px; /* Consistent height for tablets */
  }

  .restaurant-logo {
    width: 80px;
    height: 80px;
  }

  .restaurant-name {
    font-size: 1.6rem;
  }

  .category-selector {
    display: none;
  }

  .cart-container {
    max-width: 380px;
  }
}

/* Media queries for desktop */
@media (min-width: 992px) {
  .container {
    max-width: 960px;
  }

  .products-container {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }

  .header {
    padding: 15px 0;
  }

  .logo {
    font-size: 1.4rem;
  }

  .logo img {
    height: 32px;
  }

  .menu-toggle {
    display: none;
  }

  .mobile-menu {
    position: static;
    width: auto;
    height: auto;
    max-width: none;
    box-shadow: none;
    padding: 0;
    background: transparent;
    display: block;
    right: 0;
  }

  .close-menu {
    display: none;
  }

  .mobile-menu ul {
    display: flex;
    gap: 10px;
  }

  .mobile-menu li {
    margin-bottom: 0;
    opacity: 1;
    transform: none;
  }

  .mobile-menu a {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.95rem;
  }

  .menu-overlay {
    display: none;
  }

  .product-image {
    height: 220px; /* Slightly larger for desktop */
  }

  .cart-icon {
    font-size: 1.5rem;
  }

  .ai-toggle-btn {
    display: none;
  }

  .ai-chat-container {
    width: 450px;
    height: 650px;
    bottom: 20px;
    right: 20px;
    border-radius: 15px;
    max-height: calc(100vh - 100px);
  }

  .ai-chat-header {
    padding: 20px 25px;
  }

  .ai-chat-title {
    font-size: 1.2rem;
  }

  .ai-chat-title i {
    font-size: 1.4rem;
  }

  .close-ai-chat {
    width: 40px;
    height: 40px;
  }

  .ai-chat-messages {
    padding: 25px;
  }

  .ai-message,
  .user-message {
    gap: 15px;
  }

  .ai-avatar,
  .user-avatar {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .ai-message-content,
  .user-message-content {
    padding: 15px 20px;
    border-radius: 20px;
    max-width: 80%;
  }

  .product-recommendation {
    padding: 15px;
    margin-top: 20px;
  }

  .product-recommendation h4 {
    font-size: 1.1rem;
  }

  .product-recommendation p {
    font-size: 0.9rem;
  }

  .product-recommendation .price {
    font-size: 1.1rem;
  }

  .ai-chat-input-container {
    padding: 20px 25px;
  }

  .ai-chat-input {
    padding: 15px 20px;
    border-radius: 30px;
    font-size: 1rem;
  }

  .ai-send-btn {
    width: 50px;
    height: 50px;
    font-size: 1.1rem;
  }
}

/* Soporte para dispositivos con muescas (notch) */
@supports (padding: max(0px)) {
  .header {
    padding-left: max(15px, env(safe-area-inset-left));
    padding-right: max(15px, env(safe-area-inset-right));
  }

  .mobile-menu,
  .cart-container,
  .ai-chat-container,
  .product-modal {
    padding-top: max(70px, env(safe-area-inset-top));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-bottom: max(30px, env(safe-area-inset-bottom));
  }
}

/* Mejoras de rendimiento para móviles */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Product Modal Styles */
.product-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.product-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

.product-modal-content {
  position: relative;
  background: var(--white);
  border-radius: 20px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1;
  animation: modalSlideUp 0.3s ease;
  box-shadow: var(--shadow-heavy);
}

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

.close-product-modal {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: var(--white);
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: var(--transition);
  z-index: 2;
}

.close-product-modal:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.1);
}

.modal-product-image {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 20px 20px 0 0;
}

.modal-product-info {
  padding: 25px;
}

.modal-product-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 10px;
  line-height: 1.3;
}

.modal-product-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 15px;
}

.modal-product-description {
  color: var(--gray);
  line-height: 1.6;
  margin-bottom: 15px;
  font-size: 1rem;
}

.modal-product-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.modal-add-to-cart-btn {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 15px;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

.modal-add-to-cart-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.modal-add-to-cart-btn:active {
  transform: translateY(0);
}

/* Improved chat product cards with better image aspect ratio */
.recommended-product-card {
  display: flex;
  background: var(--white);
  border-radius: 12px;
  padding: 15px; /* Increased padding for better spacing */
  margin: 10px 0;
  box-shadow: var(--shadow-light);
  gap: 15px; /* Increased gap between image and content */
  align-items: flex-start;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid #e0e0e0; /* Added border for better definition */
}

.recommended-product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
  border-color: var(--primary); /* Highlight border on hover */
}

.recommended-product-img {
  width: 110px; /* Increased from 100px */
  height: 110px; /* Increased from 100px */
  border-radius: 10px; /* Slightly larger radius */
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #e0e0e0; /* Added border to image */
}

.recommended-product-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px; /* Increased gap between elements */
}

.recommended-product-info h4 {
  margin: 0;
  font-size: 1.05rem; /* Increased from 1rem */
  color: var(--dark);
  font-weight: 600;
  line-height: 1.3;
}

.recommended-product-desc {
  margin: 0;
  font-size: 0.9rem; /* Increased from 0.85rem */
  color: var(--gray);
  line-height: 1.5; /* Increased line height for readability */
  max-height: 3em; /* Show 2 lines instead of cutting off */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.recommended-product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 6px; /* Increased padding */
}

.recommended-product-price {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.1rem; /* Increased from 1rem */
}

.add-to-cart-from-chat {
  background: var(--primary);
  color: var(--white);
  border: none;
  width: 38px; /* Increased from 36px */
  height: 38px; /* Increased from 36px */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1.05rem; /* Increased icon size */
  flex-shrink: 0;
}

.add-to-cart-from-chat:hover {
  background: var(--primary-dark);
  transform: scale(1.1);
}

.add-to-cart-from-chat:active {
  transform: scale(0.95);
}

/* 💬 Estilo compacto para móviles */
.product-img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  margin-right: 10px;
}

.product-info {
  flex: 1;
  font-size: 0.85rem;
}

.product-info h4 {
  margin: 0;
  font-size: 0.9rem;
}

.product-info p {
  margin: 4px 0;
  color: #555;
}

.price {
  font-weight: bold;
  color: var(--primary, #ff7f00);
}

/* Estilos para descripciones largas */
.product-description {
  position: relative;
  line-height: 1.4;
  max-height: 3.6em; /* 3 líneas aproximadamente */
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.product-description.expanded {
  max-height: none;
}

.read-more-toggle {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  margin-top: 5px;
  display: inline-block;
  background: none;
  border: none;
  padding: 0;
}

.read-more-toggle:hover {
  text-decoration: underline;
}
