/* ===========================================================
   IssaTech 3D — style.css
   Hoja de estilos principal. Usa variables CSS para soportar
   modo claro/oscuro (ver body.dark-mode más abajo).
   =========================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #f5f5f7;
  --bg-secondary: rgba(255, 255, 255, 0.95);
  --bg-card: rgba(255, 255, 255, 0.6);
  --text-primary: #333;
  --text-secondary: #0066cc;
  --accent: linear-gradient(90deg, #0066cc, #0099ff);
  --border-color: #ddd;
  --navbar-bg: rgba(255, 255, 255, 0.9);
  --navbar-scrolled: rgba(255, 255, 255, 0.95);
  --shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
  --hero-overlay: rgba(255, 255, 255, 0.8);

  /* Glassmorphism */
  --glass-blur: 20px;
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow-ambient: 0 12px 40px rgba(31, 38, 135, 0.10);
  --glass-shadow-contact: 0 1px 3px rgba(0, 0, 0, 0.05);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.7);

  --success-color: #00aa00;
  --error-color: #ff0000;
  --chat-bubble-user: linear-gradient(90deg, #0066cc, #0099ff);
  --chat-bubble-bot: rgba(0, 0, 0, 0.06);
}

body.dark-mode {
  --bg-primary: #0a0a0a;
  --bg-secondary: rgba(30, 30, 30, 0.95);
  --bg-card: rgba(255, 255, 255, 0.05);
  --text-primary: #fff;
  --text-secondary: #00e5ff;
  --accent: linear-gradient(90deg, #ff00cc, #00e5ff);
  --border-color: #333;
  --navbar-bg: rgba(255, 255, 255, 0.05);
  --navbar-scrolled: rgba(0, 0, 0, 0.95);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  --hero-overlay: rgba(0, 0, 0, 0.7);

  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow-ambient: 0 12px 40px rgba(0, 0, 0, 0.5);
  --glass-shadow-contact: 0 1px 3px rgba(0, 0, 0, 0.35);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --chat-bubble-bot: rgba(255, 255, 255, 0.08);
}

body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  scroll-behavior: smooth;
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Foco visible para accesibilidad de teclado */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--text-secondary);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ===========================================================
   Utilidad de glassmorphism — reutilizada por tarjetas, paneles
   y formularios en toda la página.
   =========================================================== */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-ambient), var(--glass-shadow-contact), var(--glass-highlight);
}

.background-logo {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('images/logo.png') center/contain no-repeat;
  opacity: 0.85;
  filter: blur(1px) invert(30%);
  z-index: -1;
  pointer-events: none;
  transition: opacity 0.3s, filter 0.3s;
}

body.dark-mode .background-logo {
  opacity: 1;
  filter: blur(0) invert(0);
}

/* ===========================================================
   Barra de progreso de scroll
   =========================================================== */
.progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: transparent;
  z-index: 1001;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}

/* ===========================================================
   Navbar
   =========================================================== */
header.navbar {
  position: sticky;
  top: 0;
  width: 100%;
  backdrop-filter: blur(15px);
  background: var(--navbar-bg);
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 30px;
  z-index: 1000;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

header.navbar.scrolled {
  background: var(--navbar-scrolled);
}

.logo-container {
  display: flex;
  align-items: center;
}

.logo-img {
  height: 50px;
  width: auto;
  transition: all 0.3s ease;
}

.navbar nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  flex: 1;
}

.navbar nav a {
  margin: 0 12px;
  font-weight: 500;
  font-size: 0.97rem;
  transition: all 0.3s ease;
  position: relative;
  white-space: nowrap;
}

.navbar nav a:hover {
  color: var(--text-secondary);
  transform: scale(1.1);
}

.navbar nav a::after {
  content: '';
  display: block;
  height: 2px;
  background: var(--text-secondary);
  width: 0;
  position: absolute;
  bottom: -5px;
  left: 0;
  transition: width 0.3s;
}

.navbar nav a:hover::after,
.navbar nav a.active::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1001;
}

.navbar-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.theme-toggle, .language-toggle {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.theme-toggle:hover, .language-toggle:hover {
  background: var(--bg-card);
  transform: scale(1.1);
}

.language-selector {
  position: relative;
  display: inline-block;
}

.language-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  display: none;
  z-index: 1000;
  min-width: 120px;
  border: 1px solid var(--border-color);
}

.language-dropdown.show {
  display: block;
}

.language-option {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 5px;
  transition: background 0.3s;
}

.language-option:hover {
  background: var(--bg-card);
}

.language-option img {
  width: 20px;
  height: 15px;
  margin-right: 8px;
  object-fit: cover;
}

/* ===========================================================
   Hero
   =========================================================== */
.hero {
  height: 90vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 20px;
  background: linear-gradient(var(--hero-overlay), var(--hero-overlay)), url('images/hero-bg.jpg') center/cover no-repeat;
  position: relative;
  overflow: hidden;
}

.hero h2.title {
  font-size: 3rem;
  background: var(--accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 20px;
  animation: fadeInDown 1s ease-out forwards;
}

.hero p {
  font-size: 1.3rem;
  margin-bottom: 30px;
  opacity: 0;
  animation: fadeInUp 1s ease-out 0.5s forwards;
}

.btn {
  padding: 12px 28px;
  font-size: 1.1rem;
  border: none;
  border-radius: 50px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: all 0.4s ease, transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--text-secondary);
  color: var(--text-secondary);
  box-shadow: none;
}

.btn-outline:hover {
  background: var(--text-secondary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.btn-small {
  padding: 8px 18px;
  font-size: 0.9rem;
}

/* ===========================================================
   Secciones genéricas
   =========================================================== */
section {
  padding: 80px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

section h2 {
  font-size: 2.5rem;
  margin-bottom: 16px;
  text-align: center;
  background: var(--accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-subtitle {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 40px;
  opacity: 0.85;
}

/* ===========================================================
   Servicios
   =========================================================== */
.services-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 25px;
  padding: 20px 0;
}

.card {
  flex: 1 1 300px;
  max-width: 350px;
  padding: 25px;
  border-radius: 20px;
  transition: all 0.4s ease;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(30px);
}

.card:hover {
  transform: translateY(-10px) scale(1.03);
  box-shadow: var(--glass-shadow-ambient), 0 14px 35px rgba(0, 0, 0, 0.18), var(--glass-highlight);
}

.card i.card-icon {
  font-size: 1.8rem;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.card h3 {
  font-size: 1.5rem;
  margin-bottom: 15px;
  color: var(--text-secondary);
}

/* ===========================================================
   Visor 3D
   =========================================================== */
.viewer-layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 25px;
  align-items: stretch;
}

.viewer-stage {
  border-radius: 20px;
  padding: 20px;
  opacity: 0;
  transform: translateY(30px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

model-viewer {
  width: 100%;
  height: 380px;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 30%, rgba(0, 102, 204, 0.08), transparent 70%);
  --poster-color: transparent;
}

.stl-preview-canvas {
  width: 100%;
  height: 380px;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 30%, rgba(0, 102, 204, 0.08), transparent 70%);
  overflow: hidden;
}

.stl-preview-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  border-radius: 14px;
}

.viewer-stage-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.viewer-stage-footer .viewer-caption {
  margin: 0;
  text-align: left;
  flex: 1;
}

.viewer-caption {
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.75;
}

.viewer-upload {
  border-radius: 20px;
  padding: 30px 20px;
  opacity: 0;
  transform: translateY(30px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  border-style: dashed;
  border-width: 2px;
  transition: border-color 0.3s, background 0.3s;
  cursor: pointer;
}

.viewer-upload.dragover {
  border-color: var(--text-secondary);
  background: var(--bg-card);
}

.viewer-upload i.upload-icon {
  font-size: 2.2rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.viewer-upload h3 {
  font-size: 1.2rem;
}

.viewer-upload-status {
  font-size: 0.85rem;
  min-height: 1.2em;
  color: var(--text-secondary);
}

@media (max-width: 900px) {
  .viewer-layout {
    grid-template-columns: 1fr;
  }
}

/* ===========================================================
   Dashboard / Pedidos + Calculadora de cotización
   =========================================================== */
.dashboard {
  border-radius: 20px;
  padding: 40px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(30px);
}

.order-tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  align-items: start;
  margin-top: 30px;
}

.quote-calculator {
  border-radius: 16px;
  padding: 25px;
  text-align: left;
}

.quote-calculator h3 {
  font-size: 1.3rem;
  color: var(--text-secondary);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 14px 0 6px;
  opacity: 0.85;
}

.quote-calculator select,
.quote-calculator input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.95rem;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-row input[type="range"] {
  flex: 1;
  accent-color: var(--text-secondary);
}

.range-row span {
  min-width: 42px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
}

.radio-row {
  display: flex;
  gap: 18px;
  font-size: 0.9rem;
  margin-top: 4px;
}

.radio-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.quote-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 22px;
  padding: 16px;
  border-radius: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.quote-result span {
  font-size: 0.9rem;
  opacity: 0.8;
}

.quote-result strong {
  font-size: 1.6rem;
  background: var(--accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.quote-disclaimer {
  font-size: 0.78rem;
  opacity: 0.65;
  margin-top: 10px;
  line-height: 1.4;
}

#quote-use-btn {
  width: 100%;
  margin-top: 14px;
}

.order-form-wrapper .order-form {
  border-radius: 16px;
  padding: 25px;
}

.order-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0 auto;
}

.order-form input,
.order-form textarea,
.order-form select,
.contact form input,
.contact form textarea {
  width: 100%;
  padding: 12px 15px;
  margin-bottom: 18px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1rem;
}

.order-form button,
.contact form button {
  align-self: center;
  margin-top: 5px;
}

.form-message {
  text-align: center;
  margin-top: 20px;
  padding: 10px;
  border-radius: 8px;
  display: none;
}

.success {
  background-color: rgba(0, 200, 0, 0.1);
  color: var(--success-color);
  display: block;
  border: 1px solid rgba(0, 200, 0, 0.2);
}

.error {
  background-color: rgba(255, 0, 0, 0.1);
  color: var(--error-color);
  display: block;
  border: 1px solid rgba(255, 0, 0, 0.2);
}

@media (max-width: 900px) {
  .order-tools-grid {
    grid-template-columns: 1fr;
  }
}

/* ===========================================================
   Seguimiento de pedido (timeline)
   =========================================================== */
.order-timeline {
  text-align: center;
  opacity: 0;
  transform: translateY(30px);
}

.timeline-track {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-radius: 20px;
  padding: 40px 25px 30px;
  position: relative;
}

.timeline-track::before {
  content: '';
  position: absolute;
  top: 65px;
  left: 12%;
  right: 12%;
  height: 3px;
  background: var(--border-color);
  z-index: 0;
}

.timeline-step {
  flex: 1;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 6px;
}

.timeline-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  font-size: 1.2rem;
  color: var(--text-primary);
  opacity: 0.55;
  margin-bottom: 14px;
  transition: all 0.4s ease;
}

.timeline-step h4 {
  font-size: 0.95rem;
  margin-bottom: 6px;
  opacity: 0.6;
  transition: opacity 0.4s ease;
}

.timeline-step p {
  font-size: 0.78rem;
  opacity: 0.5;
  max-width: 160px;
  transition: opacity 0.4s ease;
}

.timeline-step.completed .timeline-icon {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  opacity: 1;
}

.timeline-step.completed h4,
.timeline-step.completed p {
  opacity: 0.9;
}

.timeline-step.active .timeline-icon {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  opacity: 1;
  box-shadow: 0 0 0 6px rgba(0, 102, 204, 0.18);
  animation: pulseRing 1.8s ease-out infinite;
}

.timeline-step.active h4,
.timeline-step.active p {
  opacity: 1;
}

.timeline-demo {
  margin-top: 35px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.timeline-demo label {
  display: block;
  font-size: 0.85rem;
  opacity: 0.75;
  margin-bottom: 10px;
}

.timeline-demo input[type="range"] {
  width: 100%;
  accent-color: var(--text-secondary);
}

@media (max-width: 768px) {
  .timeline-track {
    flex-direction: column;
    align-items: flex-start;
    gap: 28px;
  }

  .timeline-track::before {
    display: none;
  }

  .timeline-step {
    flex-direction: row;
    text-align: left;
    align-items: center;
    gap: 16px;
  }

  .timeline-step h4,
  .timeline-step p {
    max-width: none;
  }

  .timeline-icon {
    margin-bottom: 0;
    flex-shrink: 0;
  }
}

/* ===========================================================
   Galería
   =========================================================== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  justify-items: center;
}

.gallery-item {
  overflow: hidden;
  border-radius: 15px;
  transition: transform 0.5s ease, box-shadow 0.5s ease;
  opacity: 0;
  transform: translateY(30px);
  height: 250px;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, filter 0.5s ease;
}

.gallery-item:hover {
  box-shadow: var(--glass-shadow-ambient), 0 20px 40px rgba(0, 0, 0, 0.2);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* ===========================================================
   Timelapse
   =========================================================== */
.timelapse {
  text-align: center;
  opacity: 0;
  transform: translateY(30px);
}

.timelapse-container {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 15px;
  box-shadow: var(--shadow);
}

.timelapse-slider {
  display: flex;
  transition: transform 0.5s ease;
}

.timelapse-slide {
  min-width: 100%;
  position: relative;
}

.timelapse-slide video {
  width: 100%;
  height: auto;
  max-height: 450px;
  border-radius: 15px;
  background: #000;
}

.timelapse-controls {
  display: flex;
  justify-content: center;
  margin-top: 20px;
  gap: 10px;
}

.timelapse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.3s ease;
}

.timelapse-dot.active {
  background: var(--text-secondary);
  transform: scale(1.2);
}

.timelapse-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
}

.timelapse-nav:hover {
  background: rgba(0, 0, 0, 0.8);
}

.timelapse-prev {
  left: 15px;
}

.timelapse-next {
  right: 15px;
}

/* ===========================================================
   Nosotros
   =========================================================== */
.about {
  text-align: center;
  opacity: 0;
  transform: translateY(30px);
}

.about p {
  font-size: 1.2rem;
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.8;
}

/* ===========================================================
   Mapa
   =========================================================== */
.map-container {
  height: 400px;
  border-radius: 15px;
  overflow: hidden;
  margin: 0 auto;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(30px);
}

.map-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  filter: grayscale(30%) contrast(90%);
}

body.dark-mode .map-container iframe {
  filter: grayscale(30%) invert(90%) contrast(85%);
}

/* ===========================================================
   Novedades / redes sociales
   =========================================================== */
.social-news {
  border-radius: 15px;
  padding: 40px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(30px);
}

.social-feeds {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 25px;
  margin-top: 30px;
}

.social-feed {
  flex: 1 1 300px;
  max-width: 500px;
  min-height: 400px;
  border-radius: 15px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.social-feed iframe {
  width: 100%;
  height: 100%;
  min-height: 400px;
  border: none;
  border-radius: 15px;
}

.social-placeholder {
  padding: 20px;
  text-align: center;
}

.social-placeholder i {
  font-size: 3rem;
  margin-bottom: 20px;
  color: var(--text-secondary);
}

.social-placeholder h3 {
  font-size: 1.5rem;
  margin-bottom: 15px;
  color: var(--text-secondary);
}

.social-placeholder p {
  margin-bottom: 20px;
}

.social-link {
  display: inline-block;
  padding: 10px 20px;
  background: var(--accent);
  border-radius: 50px;
  color: white;
  transition: all 0.3s ease;
}

.social-link:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* ===========================================================
   Contacto
   =========================================================== */
.contact {
  border-radius: 15px;
  padding: 40px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(30px);
}

.contact form {
  display: flex;
  flex-direction: column;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

/* ===========================================================
   Footer
   =========================================================== */
footer {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  text-align: center;
  padding: 50px 20px;
  opacity: 0;
  transform: translateY(30px);
  border-top: 1px solid var(--border-color);
}

footer p {
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.social-icons {
  margin-top: 25px;
}

.social-icons a {
  margin: 0 12px;
  font-size: 1.8rem;
  color: var(--text-primary);
  transition: transform 0.3s, color 0.3s;
  display: inline-block;
}

.social-icons a:hover {
  transform: scale(1.2);
  color: var(--text-secondary);
}

/* ===========================================================
   Asistente virtual (chat flotante)
   =========================================================== */
.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

.chat-toggle-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.chat-toggle-btn:hover {
  transform: scale(1.08);
}

.chat-window {
  width: 340px;
  max-width: calc(100vw - 48px);
  height: 460px;
  max-height: 70vh;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-color);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-header-info strong {
  display: block;
  font-size: 0.95rem;
}

.chat-header-info small {
  display: block;
  font-size: 0.75rem;
  opacity: 0.7;
}

.chat-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2ecc71;
  box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.25);
  flex-shrink: 0;
}

.chat-close-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-close-btn:hover {
  background: var(--bg-card);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-message {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.chat-message.bot {
  align-self: flex-start;
  background: var(--chat-bubble-bot);
  border-bottom-left-radius: 4px;
}

.chat-message.user {
  align-self: flex-end;
  background: var(--chat-bubble-user);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-message.typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 16px;
}

.chat-message.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  animation: typingBlink 1.2s infinite ease-in-out;
}

.chat-message.typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-message.typing span:nth-child(3) { animation-delay: 0.4s; }

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--border-color);
}

.chat-input-row input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 50px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.chat-input-row button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}


.chat-window[hidden] {
  display: none !important;
}

@media (max-width: 480px) {
  .chat-widget {
    right: 14px;
    bottom: 14px;
  }

  .chat-window {
    width: calc(100vw - 28px);
  }
}

/* ===========================================================
   Animaciones
   =========================================================== */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-50px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(50px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(0, 102, 204, 0.35); }
  70% { box-shadow: 0 0 0 10px rgba(0, 102, 204, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 102, 204, 0); }
}

@keyframes typingBlink {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===========================================================
   Responsive
   =========================================================== */
@media (max-width: 992px) {
  .hero h2.title { font-size: 2.5rem; }
  section { padding: 70px 20px; }
  .logo-img { height: 45px; }
  .social-feeds { flex-direction: column; align-items: center; }
  .social-feed { width: 100%; }
}

@media (max-width: 768px) {
  .navbar { padding: 10px 20px; flex-wrap: wrap; }
  .logo-img { height: 40px; }
  .nav-toggle { display: block; }

  .navbar nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    margin-top: 15px;
  }

  .navbar nav.active { display: flex; }
  .navbar nav a { margin: 10px 0; font-size: 1.1rem; }
  .navbar-controls { margin-left: auto; margin-right: 15px; }

  .hero { height: 85vh; }
  .hero h2.title { font-size: 2.2rem; }
  .hero p { font-size: 1.1rem; }

  section { padding: 60px 15px; }
  section h2 { font-size: 2.2rem; margin-bottom: 12px; }

  .card { flex: 1 1 100%; max-width: 100%; margin-bottom: 20px; }
  .dashboard, .contact, .social-news { padding: 30px 20px; }

  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 15px; }
  .gallery-item { height: 200px; }
  .map-container { height: 300px; }
  .timelapse-nav { width: 35px; height: 35px; }
}

@media (max-width: 576px) {
  .logo-img { height: 35px; }
  .navbar-controls { gap: 8px; }
  .theme-toggle, .language-toggle { width: 35px; height: 35px; font-size: 1rem; }
  .hero h2.title { font-size: 1.8rem; }
  .hero p { font-size: 1rem; }
  .btn { padding: 10px 22px; font-size: 1rem; }
  section h2 { font-size: 1.9rem; }
  .card h3 { font-size: 1.3rem; }
  footer p { font-size: 0.95rem; }
  .social-icons a { font-size: 1.5rem; margin: 0 8px; }
  .map-container { height: 250px; }
  .social-feed { min-height: 350px; }
  .timelapse-nav { width: 30px; height: 30px; font-size: 0.8rem; }
  model-viewer { height: 280px; }
}
