/* ============================================================================
   DPH WIDGETS - Centralized Widget Styles
   ============================================================================ */

/* Vertical Text for Book Service Button */
.vertical-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 20px, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.5s ease-out forwards;
}

/* Chat Window - Simple show/hide, NO transforms that cause glitches */
#chatWindow {
  display: none;
  /* Fix keyboard overlap on mobile */
  bottom: 80px !important;
}

#chatWindow.active {
  display: flex !important;
}

/* Mobile: Full-width chat window with proper containment */
@media (max-width: 640px) {
  #chatWindow {
    /* Position relative to viewport */
    position: fixed !important;
    bottom: 80px !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    max-width: calc(100vw - 24px) !important;

    /* Height constraints to prevent overflow */
    height: auto !important;
    max-height: min(400px, calc(100vh - 180px)) !important;
    min-height: 300px !important;

    /* Ensure flex layout works correctly */
    display: none;
    flex-direction: column !important;
    overflow: hidden !important;

    /* Prevent layout glitches */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }

  #chatWindow.active {
    display: flex !important;
  }

  /* Messages area should scroll, not the window */
  #chatWindow #chatMessages {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    min-height: 0 !important;
    /* Critical for flex scroll */
  }

  /* Input area stays at bottom inside container */
  #chatWindow>div:last-child {
    flex: 0 0 auto !important;
    position: relative !important;
    z-index: 10;
  }

  /* Prevent input bounce/zoom on iOS */
  #chatInput {
    font-size: 16px !important;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    touch-action: manipulation;
  }

  /* Ensure send button stays inside */
  #chatSendBtn {
    flex-shrink: 0 !important;
    min-width: 44px !important;
    min-height: 44px !important;
  }
}

/* Book Service Modal Active States */
#bookCallDrawer.active {
  display: flex !important;
}

#bookCallDrawer.active #drawerOverlay {
  opacity: 1;
}

#bookCallDrawer.active #drawerContent {
  transform: scale(1);
  opacity: 1;
}

/* Prevent iOS zoom on input focus - CRITICAL */
input,
textarea,
select {
  font-size: 16px !important;
  -webkit-text-size-adjust: 100%;
}

/* Global mobile padding fix */
@media (max-width: 640px) {
  .container {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }

  section {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}