/* Live chat — mobile layout (max-width: 768px) */

@media (max-width: 768px) {
  .live-chat-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1190;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .live-chat-backdrop[hidden] {
    display: none !important;
  }

  .live-chat-backdrop:not([hidden]) {
    opacity: 1;
    visibility: visible;
  }

  body.live-chat-open {
    overflow: hidden;
    touch-action: none;
  }

  body.live-chat-open .topbar,
  body.live-chat-open .header {
    visibility: hidden;
    pointer-events: none;
  }

  .live-chat-launcher {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    width: 54px;
    height: 54px;
    font-size: 1.3rem;
    box-shadow: 0 10px 28px rgba(192, 57, 43, 0.35);
  }

  body.live-chat-open .live-chat-launcher {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(0.9);
  }

  .live-chat-panel {
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: min(100dvh, 100vh);
    max-height: min(100dvh, 100vh);
    border-radius: 0;
    box-shadow: 0 -12px 40px rgba(16, 24, 40, 0.18);
    z-index: 1200;
  }

  .live-chat-panel.open {
    animation: liveChatSheetUp 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  }

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

  .live-chat-sheet-handle {
    display: none;
  }

  .live-chat-head {
    padding: max(10px, env(safe-area-inset-top)) 16px 12px;
    gap: 10px;
  }

  .live-chat-avatar {
    width: 38px;
    height: 38px;
    font-size: 0.95rem;
  }

  .live-chat-head-brand > div {
    min-width: 0;
  }

  .live-chat-head strong {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .live-chat-head span {
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .live-chat-wa,
  .live-chat-close {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  .live-chat-wa {
    font-size: 1.1rem;
  }

  .live-chat-welcome {
    padding: 20px 18px 24px;
    align-items: stretch;
    text-align: left;
  }

  .live-chat-welcome-icon {
    align-self: center;
    width: 56px;
    height: 56px;
    font-size: 1.4rem;
    margin-bottom: 14px;
  }

  .live-chat-welcome h3 {
    font-size: 1.08rem;
    text-align: center;
  }

  .live-chat-welcome > p {
    font-size: 0.84rem;
    max-width: none;
    text-align: center;
    margin-bottom: 20px;
  }

  .live-chat-start input {
    font-size: 16px;
    padding: 13px 14px;
    border-radius: 12px;
  }

  .live-chat-start-btn {
    padding: 14px 16px;
    font-size: 0.94rem;
    min-height: 48px;
  }

  .live-chat-waiting {
    padding: 12px 14px;
    gap: 12px;
  }

  .live-chat-messages {
    padding: 14px 14px 10px;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
  }

  .live-chat-msg {
    max-width: 88%;
  }

  .live-chat-bubble {
    font-size: 0.9rem;
    padding: 10px 13px;
  }

  .live-chat-compose {
    padding: 10px 14px max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid #e8edf3;
    background: #fff;
  }

  .live-chat-compose-inner {
    border-radius: 14px;
    padding: 6px 6px 6px 12px;
  }

  .live-chat-compose textarea {
    font-size: 16px;
    line-height: 1.4;
    max-height: 100px;
  }

  .live-chat-send {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 12px;
  }

  .live-chat-compose-hint {
    display: none;
  }

  .live-chat-closed-actions {
    padding: 14px 16px max(14px, env(safe-area-inset-bottom));
  }

  .live-chat-new-btn {
    min-height: 48px;
  }

  .live-chat-error {
    font-size: 0.78rem;
    padding: 10px 14px;
  }

  body.live-chat-open #back-to-top {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none;
  }
}

@media (max-width: 480px) {
  .live-chat-head strong {
    font-size: 0.86rem;
  }

  .live-chat-msg {
    max-width: 92%;
  }
}

@media (min-width: 769px) {
  .live-chat-backdrop {
    display: none !important;
  }
}
