/* Estilos base */
:root {
  --primary-color: #25D366;
  --secondary-color: #0066cc;
  --text-color: #333;
  --bg-light: #f8f9fa;
  --border-radius: 8px;
  --shadow: 0 2px 4px rgba(0,0,0,0.1);
  --mockup1-width: 350px; /* Reducido ligeramente para asegurar que se vea completo */
  --iphone-aspect-ratio: 0.53; /* Relación de aspecto de la imagen del iPhone (ancho/alto) */
}

html, body {
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  color: var(--text-color);
}

/* Layout principal */
.container {
  display: grid;
  grid-template-columns: var(--mockup1-width) 1fr; /* Columna 1 fija, columna 2 flexible */
  grid-template-rows: 1fr;
  grid-template-areas:
    "mockup1 mockup2";
  height: calc(100vh - 70px); /* Altura para permitir la navegación abajo */
  box-sizing: border-box;
  overflow: hidden;
  padding: 10px;
}

/* Estilos generales */
html, body {
  height: 100%;
  margin: 0;
  font-family: 'Inter', sans-serif;
  color: var(--text-color);
}

/* Mockups */
.mockup1, .mockup2 {
  background-color: var(--bg-light);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mockup1 {
  grid-area: mockup1;
  width: 100%;
  max-width: var(--mockup1-width);
  justify-content: center;
  align-items: center;
  padding: 10px;
  overflow-y: auto;
  max-height: calc(100vh - 90px); /* Asegura que cabe verticalmente */
}

.mockup2 {
  grid-area: mockup2;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto; /* Mantenemos el scroll vertical */
}

/* Navegación */
.navigation {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--bg-light);
  padding: 15px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
  scrollbar-color: var(--secondary-color) var(--bg-light);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  z-index: 100;
  height: 70px; /* Altura fija para la navegación */
  box-sizing: border-box;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 10px;
}

.navigation::-webkit-scrollbar {
  height: 6px;
}

.navigation::-webkit-scrollbar-track {
  background: var(--bg-light);
  border-radius: 3px;
}

.navigation::-webkit-scrollbar-thumb {
  background-color: var(--secondary-color);
  border-radius: 3px;
}

/* Grupos de navegación */
.nav-group {
  display: inline-flex;
  gap: 10px;
  padding: 0 5px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  min-width: auto;
  background-color: rgba(0, 102, 204, 0.1);
  border: 1px solid rgba(0, 102, 204, 0.2);
  color: var(--secondary-color);
  border-radius: var(--border-radius);
  transition: all 0.3s ease;
  font-size: 14px;
  white-space: nowrap;
}

.nav-btn:hover {
  background-color: var(--secondary-color);
  color: white;
  transform: translateY(-2px);
}

.nav-btn .icon {
  font-size: 18px;
  margin-right: 8px;
}

/* Eliminamos el área CTA separada y lo integramos en mockup1 */
.message-input-area {
  position: absolute;
  bottom: 3%;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  background-color: transparent;
}

.cta-button {
  display: inline-block;
  padding: 12px 24px;
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: var(--border-radius);
  font-weight: 600;
  transition: all 0.3s ease;
  width: 80%;
  text-align: center;
  font-size: 14px;
}

.cta-button:hover {
  background-color: #1fab54;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

/* Chat y mensajes */
.chat-wrapper {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 10px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  flex-shrink: 0;
}

.chat-container {
  flex: 1;
  padding: 2px;
  overflow-y: auto;
  background-color: #e5e5e5;
  position: relative;
}

button {
  padding: 12px 24px;
  cursor: pointer;
  background-color: #0066cc;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: #0052a3;
}

.welcome-content {
  padding: 40px;
  text-align: center;
}

.welcome-content h1 {
  color: #0066cc;
  font-size: 2.5em;
  margin-bottom: 20px;
}

.welcome-content p {
  color: #666;
  font-size: 1.1em;
  line-height: 1.6;
  margin-bottom: 15px;
}

/* Responsive design */
@media (max-width: 1024px) {
  .container {
    grid-template-columns: 1fr 2fr; /* Ajuste para tablets */
  }
  
  .mockup1 {
    max-width: 330px; /* Ligeramente más pequeño en tabletas */
  }
}

@media (max-width: 768px) {
  html, body {
    height: 100%;
    overflow: auto;
  }
  
  .container {
    height: auto;
    min-height: calc(100vh - 70px); /* Resta la altura de la navegación */
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "mockup1"
      "mockup2";
    overflow: auto;
    padding: 10px;
  }

  .mockup1, .mockup2 {
    height: auto;
  }

  .mockup1 {
    width: 100%;
    max-width: 320px; /* Ancho específico para móviles */
    margin: 0 auto; /* Centrado horizontal */
    padding: 5px;
  }

  .mockup2 {
    padding: 15px;
    margin: 20px 0;
  }

  .navigation {
    padding: 10px 5px;
  }

  .welcome-content h1 {
    font-size: 2em;
  }

  .navigation button {
    padding: 8px 16px;
  }

  .mockup2 {
    gap: 15px;
  }

  .agent-info,
  .agent-benefits {
    padding: 15px;
  }

  .benefits-list li {
    padding: 6px 0 6px 20px;
  }

  .nav-btn {
    min-width: auto;
    padding: 8px 12px;
    font-size: 12px;
  }

  .chat-placeholder {
    margin: 4px;
    padding: 4px;
  }

  .chat-placeholder h3 {
    font-size: 1.2em;
  }

  .chat-placeholder p {
    font-size: 0.9em;
  }

  .benefits-list,
  .features-list {
    grid-template-columns: 1fr;
  }

  .iphone-container {
    max-width: 320px;
  }
}

/* Mantener el resto de estilos sin cambios */
.loading {
  text-align: center;
  padding: 40px;
  color: #666;
}

.loading::after {
  content: '';
  display: block;
  width: 40px;
  height: 40px;
  margin: 20px auto;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #0066cc;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.error-message {
  text-align: center;
  padding: 40px;
  color: #dc3545;
  background-color: #fff;
  border-radius: 8px;
}

.error-message button {
  margin-top: 20px;
  background-color: #dc3545;
}

.error-message button:hover {
  background-color: #bd2130;
}

.error-toast {
  position: fixed;
  bottom: 90px; /* Ajustado para no solapar con la navegación */
  right: 20px;
  background-color: #dc3545;
  color: white;
  padding: 15px 25px;
  border-radius: 6px;
  animation: slideIn 0.3s ease-out;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  z-index: 101;
}

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

.loading-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #666;
  text-align: center;
  font-size: 1.1em;
}

.chat-demo {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 400px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: #25D366;
    color: white;
    border-radius: 16px 16px 0 0;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1em;
}

.close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-container {
    overflow-y: auto;
    padding: 10px;
    background: #E5DDD5;
    flex: 1;
    border-radius: 0 0 16px 16px;
}

.show-demo-btn {
    position: absolute;
    bottom: 90px; /* Ajustado para no solapar con la navegación */
    right: 20px;
    padding: 12px 24px;
    background-color: #25D366;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s ease;
    z-index: 99;
}

.show-demo-btn:hover {
    background-color: #128C7E;
}

/* Estilos para el overlay cuando el chat está abierto */
.chat-demo::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: -1;
}

.chat-placeholder {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #666;
}

.chat-placeholder h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: #25D366;
}

.agent-info {
    flex: 1;
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-y: auto; /* Añadir scroll al contenido interno */
    height: 50%;
}

.agent-benefits {
    flex: 1;
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-y: auto; /* Añadir scroll al contenido interno */
    height: 50%;
}

.agent-features {
    flex: 1;
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-y: auto; /* Añadir scroll al contenido interno */
    height: 50%;
    margin-bottom: 20px;
}

.agent-benefits h3,
.agent-features h3 {
    color: #0066cc;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.agent-benefits h4,
.agent-benefits p {
    display: none;
}

.benefits-content p,
.features-content p {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
}

.benefits-list,
.features-list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 16px;
    margin-top: 10px;
}

.benefits-list li,
.features-list li {
    padding: 6px 0 6px 20px;
    position: relative;
    color: #444;
    font-size: 14px;
}

.benefits-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #25D366;
    font-weight: bold;
}

.features-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #0066cc;
    font-weight: bold;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 15px;
    position: relative;
    clear: both;
    animation: messageAppear 0.3s ease-out;
}

.message.left {
    float: left;
    background-color: white;
    color: #333;
}

.message.right {
    float: right;
    background-color: #DCF8C6;
    color: #333;
}

.chat-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.chat-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 15px 0;
    clear: both;
    width: 100%;
}

.chat-option-btn {
    background-color: white;
    color: #128C7E;
    border: 1px solid #128C7E;
    padding: 10px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
    text-align: left;
    max-width: 80%;
    margin-left: auto;
    margin-right: 10px;
}

.chat-option-btn:hover {
    background-color: #128C7E;
    color: white;
    transform: translateX(-5px);
}

.chat-option-btn:active {
    transform: translateX(-5px) scale(0.98);
}

/* Indicador de escritura */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 15px;
    background-color: #E5E5E5;
    border-radius: 15px;
    width: fit-content;
    margin-bottom: 10px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: #666;
    border-radius: 50%;
    animation: typing 1s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

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

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

/* iPhone container específico para asegurar que no se pierde el formato */
.iphone-container {
  background-image: url('../images/background-iphone-mockup.png');
  background-size: contain; /* Cambiado a contain para asegurar que se ve completo */
  background-repeat: no-repeat;
  background-position: center;
  width: 100%;
  max-width: var(--mockup1-width);
  height: 0;
  padding-bottom: calc(100% / var(--iphone-aspect-ratio)); /* Mantiene la proporción */
  display: flex;
  flex-direction: column;
  position: relative;
  margin: 0 auto;
}

.whatsapp-screen {
  background-color: #e5ddd5; /* Fondo de WhatsApp */
  position: absolute;
  width: 73%; /* Porcentaje del ancho del contenedor */
  height: 80%; /* Porcentaje del alto del contenedor */
  left: 11%; /* Centrado horizontal dentro del iPhone */
  top: 8%; /* Posicionado desde la parte superior */
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  border-radius: 20px; /* Bordes redondeados para simular la pantalla del iPhone */
}

/* Solo para la vista responsive extremadamente pequeña */
@media (max-width: 400px) {
  .mockup1 {
    max-width: 280px; /* Más pequeño para pantallas muy pequeñas */
    padding: 0;
  }
  
  .iphone-container {
    max-width: 280px;
  }
  
  .container {
    padding: 5px;
  }
  
  .whatsapp-screen {
    width: 78%;
    height: 78%;
    left: 11%;
    top: 12%;
  }
  
  .message-input-area {
    bottom: 4%;
  }
  
  .cta-button {
    padding: 10px 20px;
    font-size: 12px;
  }
}

.agent-features {
  position: relative;
  padding: 1rem;
  overflow: hidden;
}

.agent-floating-img {
  position: absolute;
  top: 0;
  right: 0;
  max-width: 150px;
  height: auto;
  z-index: 10;
  pointer-events: none; /* Para que no interfiera con clics */
}

/* Ocultar en pantallas pequeñas */
@media (max-width: 767px) {
  .agent-floating-img {
    display: none;
  }
}
