/* ============================================
   animations.css — ComVida Institucional
   Loading Screen, Scroll Reveal, Hover Animations, Chat Widget
   ============================================ */

/* ============================================
   1. LOADING SCREEN
   ============================================ */

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: #ffffff;
  transition: opacity 600ms ease, visibility 600ms ease;
}

.loading-content {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
}

.loading-logo {
  width: 45px;
  height: auto;
  position: absolute;
}

.loading-spinner {
  width: 76px;
  height: 76px;
  border: 3px solid rgba(34, 58, 102, 0.15);
  border-top-color: #223a66;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Loading screen fade-out when loaded */
.loading-screen.loaded {
  opacity: 0;
  visibility: hidden;
  transition: opacity 600ms ease, visibility 600ms ease;
}

/* Prevent scroll while loading */
body.no-scroll {
  overflow: hidden;
}

/* ============================================
   2. SCROLL REVEAL
   ============================================ */

.scroll-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 900ms ease-out, transform 900ms ease-out;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered delays via data-reveal-delay attribute */
[data-reveal-delay="100"] {
  transition-delay: 150ms;
}

[data-reveal-delay="200"] {
  transition-delay: 300ms;
}

[data-reveal-delay="300"] {
  transition-delay: 450ms;
}

[data-reveal-delay="400"] {
  transition-delay: 600ms;
}

[data-reveal-delay="500"] {
  transition-delay: 750ms;
}

/* ============================================
   3. HOVER ANIMATIONS
   ============================================ */

/* Feature items hover — lift up */
.feature-item {
  transition: transform 300ms ease-out, box-shadow 300ms ease-out;
}

.feature-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Buttons — btn-main and btn-main-2 */
.btn-main,
.btn-main-2 {
  transition: box-shadow 200ms ease-out, transform 200ms ease-out, background 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}

.btn-main:hover,
.btn-main-2:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: scale(1.03);
}

/* Service items */
.service-item {
  transition: box-shadow 250ms ease-out, transform 250ms ease-out, border 250ms ease-out;
  border: 2px solid transparent;
}

.service-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-4px);
  border: 2px solid #223a66;
}

/* Service blocks (service.html grid) */
.service-block {
  transition: box-shadow 250ms ease-out, transform 250ms ease-out;
}

.service-block:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-4px);
}

/* Navbar link underline animation */
#navbarmain .nav-link {
  position: relative;
}

#navbarmain .nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background-color: #00A6D6;
  transition: width 250ms ease-out;
}

#navbarmain .nav-link:hover::after {
  width: 100%;
}

#navbarmain .nav-cta-btn::after {
  display: none !important;
}

/* Footer social icons */
.footer-socials li a {
  transition: transform 200ms ease-out, background-color 200ms ease-out;
}

.footer-socials li a:hover {
  transform: scale(1.15);
  background-color: #00A6D6;
}

/* ============================================
   3.5 HIGHLIGHT BOX (About Section)
   ============================================ */

.highlight-box {
  background-color: rgba(252, 180, 60, 0.1);
  border: 1px solid rgba(252, 180, 60, 0.3);
  border-left: 4px solid #FCB43C;
  border-radius: 8px;
  padding: 16px 20px;
  margin-top: 24px;
}

.highlight-box p {
  color: #0B2B3A;
  font-size: 15px;
  font-weight: 600;
}

.highlight-box i {
  color: #FCB43C;
}

/* ============================================
   4. CHAT WIDGET
   ============================================ */

.chat-float-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #223a66;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 200ms ease-out, box-shadow 200ms ease-out;
}

.chat-float-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.chat-float-btn .chat-close-icon {
  display: none;
}

.chat-float-btn.active .icofont-ui-messaging {
  display: none;
}

.chat-float-btn.active .chat-close-icon {
  display: inline-block;
}

.chat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  height: 520px;
  max-height: 70vh;
  z-index: 9997;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.9);
  transition: opacity 300ms ease, transform 300ms ease, visibility 300ms ease;
}

.chat-panel.chat-open {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

/* ============================================
   4.5 CHAT WIDGET INNER STYLES
   ============================================ */

.chat-header {
  background: linear-gradient(135deg, #223a66, #1a2d50);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-header-info strong {
  font-size: 13px;
  display: block;
}

.chat-header-info small {
  font-size: 10px;
  opacity: 0.8;
}

.chat-avatar, .chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.chat-msg-avatar {
  background: #223a66;
  width: 26px;
  height: 26px;
  font-size: 9px;
}

.chat-close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.8;
}

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

.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-anchor: none;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-msg-bot { justify-content: flex-start; }
.chat-msg-user { justify-content: flex-end; }

.chat-msg-bubble {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 12px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-msg-bot .chat-msg-bubble {
  background: #f0fafe;
  color: #123844;
  border-bottom-left-radius: 4px;
}

.chat-msg-user .chat-msg-bubble {
  background: #223a66;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 4px 34px;
}

.chat-option-btn {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  border: 2px solid #223a66;
  border-radius: 20px;
  background: #fff;
  color: #223a66;
  cursor: pointer;
  transition: all 200ms ease;
}

.chat-option-btn:hover {
  background: #f0f4fa;
  transform: translateY(-1px);
}

.chat-list-section {
  padding: 4px 0 4px 34px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-list-title {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  font-weight: 600;
  padding: 0 4px;
}

.chat-list-item {
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 200ms ease;
}

.chat-list-item:hover {
  border-color: #223a66;
  background: #f0f4fa;
}

.chat-list-item-title {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #123844;
}

.chat-list-item-desc {
  display: block;
  font-size: 10px;
  color: #64748b;
  margin-top: 2px;
}

.chat-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.chat-input-field {
  flex: 1;
  padding: 8px 14px;
  font-size: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  background: #f8fdff;
  outline: none;
  transition: border-color 200ms;
}

.chat-input-field:focus {
  border-color: #223a66;
}

.chat-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #223a66;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 200ms;
}

.chat-send-btn:hover { background: #1a2d50; }

/* Typing dots animation */
.typing-dots {
  display: flex;
  gap: 3px;
  padding: 4px 0;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #223a66;
  animation: typingBounce 1.2s infinite;
}

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

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Chat panel layout fix */
.chat-panel {
  display: flex;
  flex-direction: column;
}

/* ============================================
   5. ACCESSIBILITY — prefers-reduced-motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .loading-screen {
    transition: none;
  }

  .loading-spinner {
    animation: none;
  }

  .scroll-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .scroll-reveal.revealed {
    transition: none;
  }

  [data-reveal-delay="100"],
  [data-reveal-delay="200"],
  [data-reveal-delay="300"],
  [data-reveal-delay="400"],
  [data-reveal-delay="500"] {
    transition-delay: 0ms;
  }

  .btn-main,
  .btn-main-2 {
    transition: none;
  }

  .btn-main:hover,
  .btn-main-2:hover {
    transform: none;
  }

  .service-item {
    transition: none;
  }

  .service-item:hover {
    transform: none;
  }

  .service-block {
    transition: none;
  }

  .service-block:hover {
    transform: none;
  }

  .feature-item {
    transition: none;
  }

  .feature-item:hover {
    transform: none;
  }

  #navbarmain .nav-link::after {
    transition: none;
  }

  .footer-socials li a {
    transition: none;
  }

  .footer-socials li a:hover {
    transform: none;
  }

  .chat-float-btn {
    transition: none;
  }

  .chat-float-btn:hover {
    transform: none;
  }

  .chat-panel {
    transition: none;
  }
}
