/* ===== BRIEF BOT - DESIGN MINIMALISTA Y FUNCIONAL ===== */

/* Variables */
:root {
  /* Colores IMAQUINUA - Planos */
  --yellow: #F9DE1D;
  --cyan: #4fd7f7;
  --coral: #fe8464;
  
  /* Grises */
  --white: #ffffff;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;
  
  /* Espaciado */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Fuentes */
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Sombras */
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  
  /* Transiciones */
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--white);
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* ===== HEADER ===== */
.header {
  background: var(--yellow);
  padding: var(--space-8) 0;
  text-align: center;
}

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


.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

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

.brand-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-800);
}

/* Floating Logo Navigation */
.floating-logo {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  transition: all 0.3s ease;
}

.floating-logo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: var(--white);
  border-radius: 50%;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  text-decoration: none;
  transition: all 0.3s ease;
  border: 3px solid transparent;
  position: relative;
  overflow: hidden;
}

.floating-logo-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
  text-decoration: none;
}

.floating-logo-btn img {
  width: 35px;
  height: 35px;
  object-fit: contain;
  transition: all 0.3s ease;
}

.floating-logo-btn:hover img {
  transform: scale(1.1);
}

/* Floating logo tooltip */
.floating-logo-btn::before {
  content: "Volver al Inicio";
  position: absolute;
  right: 70px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--gray-800);
  color: var(--white);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
}

.floating-logo-btn::after {
  content: "";
  position: absolute;
  right: 62px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid var(--gray-800);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.floating-logo-btn:hover::before,
.floating-logo-btn:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Pulse animation */
.floating-logo-btn {
  animation: floating-pulse 3s infinite;
}

@keyframes floating-pulse {
  0% {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  }
  50% {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), 0 0 0 8px rgba(249, 222, 29, 0.3);
  }
  100% {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .floating-logo {
    top: 15px;
    right: 15px;
  }
  
  .floating-logo-btn {
    width: 50px;
    height: 50px;
  }
  
  .floating-logo-btn img {
    width: 28px;
    height: 28px;
  }
  
  .floating-logo-btn::before {
    display: none;
  }
  
  .floating-logo-btn::after {
    display: none;
  }
  
  .brand-title {
    font-size: 1.25rem;
  }
}

.logo-img {
  height: 50px;
  width: auto;
}

.header-title {
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: var(--space-2);
}

.header-subtitle {
  font-size: 1.125rem;
  color: var(--gray-600);
  margin-bottom: var(--space-8);
}

/* Progress Bar */
.progress-container {
  background: var(--white);
  padding: var(--space-4);
  border-radius: 12px;
  border: 2px solid var(--gray-200);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: var(--space-2);
}

.progress-fill {
  height: 100%;
  background: var(--cyan);
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-weight: 500;
  color: var(--gray-600);
  font-size: 0.875rem;
}

/* ===== MAIN CONTENT ===== */
.main {
  padding: var(--space-8) 0;
  background: var(--gray-50);
}

.form {
  max-width: 100%;
}

/* Question Cards */
.question-card {
  background: var(--white);
  border-radius: 12px;
  padding: var(--space-8);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.question-header {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.question-number {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: var(--coral);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.125rem;
}

.question-content {
  flex: 1;
}

.question-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: var(--space-2);
}

.question-desc {
  color: var(--gray-500);
  font-size: 0.875rem;
}

/* Form Inputs */
.input-group {
  position: relative;
}

.label {
  display: block;
  font-weight: 500;
  margin-bottom: var(--space-2);
  color: var(--gray-700);
  font-size: 0.875rem;
}

.input {
  width: 100%;
  padding: var(--space-4);
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font-family);
  background: var(--white);
  transition: border-color var(--transition);
  resize: vertical;
}

.input:focus {
  outline: none;
  border-color: var(--cyan);
}

.input:invalid {
  border-color: var(--coral);
}

.input::placeholder {
  color: var(--gray-400);
}

.error-msg {
  position: absolute;
  top: 100%;
  left: 0;
  font-size: 0.75rem;
  color: var(--coral);
  margin-top: var(--space-1);
  display: none;
}

.input:invalid + .error-msg {
  display: block;
}

/* Contact Section */
.contact-section {
  background: var(--white);
  border-radius: 12px;
  padding: var(--space-8);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  border-top: 4px solid var(--yellow);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: var(--space-2);
  text-align: center;
}

.section-desc {
  color: var(--gray-500);
  text-align: center;
  margin-bottom: var(--space-6);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-4);
}

.contact-grid .input {
  height: 48px;
}

/* Submit Section */
.submit-section {
  text-align: center;
  padding: var(--space-8) 0;
}

.submit-btn {
  position: relative;
  background: var(--cyan);
  color: var(--white);
  border: none;
  padding: var(--space-4) var(--space-8);
  border-radius: 50px;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  min-width: 180px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.submit-btn:hover {
  background: #2ac7f0;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-text {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.btn-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  align-items: center;
  gap: var(--space-2);
}

.submit-btn.loading .btn-text {
  opacity: 0;
}

.submit-btn.loading .btn-loading {
  display: flex;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.submit-note {
  margin-top: var(--space-4);
  color: var(--gray-500);
  font-size: 0.875rem;
}

/* ===== FOOTER ===== */
.footer {
  background: var(--gray-800);
  color: var(--white);
  padding: var(--space-8) 0 var(--space-4);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.footer-brand h4 {
  color: var(--yellow);
  font-size: 1.25rem;
  margin-bottom: var(--space-2);
}

.footer-brand p {
  color: var(--gray-300);
  font-size: 0.875rem;
}

.footer-contact {
  text-align: right;
}

.footer-contact p {
  margin-bottom: var(--space-1);
  font-size: 0.875rem;
}

.footer-contact a {
  color: var(--cyan);
  text-decoration: none;
}

.footer-contact a:hover {
  text-decoration: underline;
}

.footer-bottom {
  text-align: center;
  padding-top: var(--space-4);
  border-top: 1px solid var(--gray-700);
  color: var(--gray-400);
  font-size: 0.75rem;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--white);
  border-radius: 16px;
  padding: var(--space-8);
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  position: relative;
  margin-bottom: var(--space-6);
}

.success-icon {
  font-size: 4rem;
  color: var(--yellow);
  margin-bottom: var(--space-4);
}

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

.modal-close {
  position: absolute;
  top: -10px;
  right: -10px;
  background: var(--gray-200);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}

.modal-close:hover {
  background: var(--gray-300);
}

.modal-body {
  margin-bottom: var(--space-6);
  color: var(--gray-600);
}

.modal-btn {
  background: var(--yellow);
  color: var(--gray-800);
  border: none;
  padding: var(--space-3) var(--space-6);
  border-radius: 50px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.modal-btn:hover {
  background: #e6c71a;
  transform: translateY(-1px);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  background: var(--white);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  opacity: 0;
  transition: opacity 0.3s ease;
  border: 1px solid var(--gray-200);
}

.toast.bg-danger {
  background: var(--coral) !important;
  color: var(--white);
}

.toast.bg-success {
  background: #28a745 !important;
  color: var(--white);
}

.toast .d-flex {
  display: flex;
  align-items: center;
}

.toast .toast-body {
  padding: 12px 16px;
  flex: 1;
}

.toast .btn-close {
  background: none;
  border: none;
  color: inherit;
  padding: 8px;
  cursor: pointer;
  opacity: 0.7;
}

.toast .btn-close:hover {
  opacity: 1;
}

/* ===== DIALOGFLOW MESSENGER ===== */
df-messenger {
  --df-messenger-bot-message: var(--cyan);
  --df-messenger-button-titlebar-color: var(--yellow);
  --df-messenger-chat-background-color: var(--white);
  --df-messenger-font-color: var(--gray-800);
  --df-messenger-send-icon: var(--coral);
  --df-messenger-user-message: var(--coral);
  --df-messenger-chat-border-radius: 16px;
  --df-messenger-message-border-radius: 12px;
  position: fixed !important;
  bottom: 20px !important;
  right: 20px !important;
  z-index: 999;
}

/* Evitar desbordamiento en todos los elementos del chat */
df-messenger * {
  box-sizing: border-box !important;
}

/* Asegurar que la ventana del chat sea responsive */
df-messenger df-messenger-chat {
  max-width: calc(100vw - 40px) !important;
  max-height: calc(100vh - 100px) !important;
}

/* Específicamente para el input del usuario */
df-messenger df-messenger-user-input,
df-messenger df-messenger-user-input input,
df-messenger df-messenger-user-input textarea {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}

/* Prevenir scroll horizontal */
df-messenger df-messenger-chat-wrapper {
  overflow-x: hidden !important;
  max-width: 100% !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-3);
  }
  
  .header {
    padding: var(--space-6) 0;
  }
  
  .header-content {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }
  
  .header-title {
    font-size: 2rem;
  }
  
  .header-subtitle {
    font-size: 1rem;
  }
  
  .question-header {
    flex-direction: column;
    text-align: center;
    gap: var(--space-3);
  }
  
  .question-number {
    align-self: center;
  }
  
  .question-card {
    padding: var(--space-6);
  }
  
  .contact-grid {
    grid-template-columns: 1fr;
  }
  
  .footer-content {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }
  
  .footer-contact {
    text-align: center;
  }
  
  .brand-title {
    font-size: 1.5rem;
  }
  
  .logo-img {
    height: 40px;
  }
  
  /* Dialogflow mobile optimizado */
  df-messenger {
    bottom: 16px !important;
    right: 16px !important;
    left: auto !important;
    width: auto !important;
    max-width: calc(100vw - 32px) !important;
  }
  
  df-messenger df-messenger-chat-bubble {
    width: 56px !important;
    height: 56px !important;
  }
  
  /* Optimizar el chat window en móvil */
  df-messenger df-messenger-chat {
    width: calc(100vw - 32px) !important;
    max-width: 350px !important;
    height: 400px !important;
    max-height: calc(100vh - 100px) !important;
  }
  
  /* Asegurar que el input del chat no se salga */
  df-messenger df-messenger-chat df-messenger-user-input {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  df-messenger df-messenger-chat df-messenger-user-input input {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 480px) {
  .main {
    padding: var(--space-6) 0;
  }
  
  .question-card {
    padding: var(--space-4);
    margin-bottom: var(--space-4);
  }
  
  .contact-section {
    padding: var(--space-6);
  }
  
  .submit-btn {
    padding: var(--space-3) var(--space-6);
    font-size: 1rem;
    min-width: 160px;
    height: 48px;
  }
  
  .header-title {
    font-size: 1.75rem;
  }
  
  .question-title {
    font-size: 1.125rem;
  }
  
  /* Dialogflow para pantallas muy pequeñas */
  df-messenger {
    bottom: 12px !important;
    right: 12px !important;
    max-width: calc(100vw - 24px) !important;
  }
  
  df-messenger df-messenger-chat {
    width: calc(100vw - 24px) !important;
    max-width: 320px !important;
    height: 350px !important;
    max-height: calc(100vh - 80px) !important;
  }
  
  df-messenger df-messenger-chat-bubble {
    width: 50px !important;
    height: 50px !important;
  }
  
  /* Forzar que el contenido del chat sea responsive */
  df-messenger df-messenger-chat * {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}