
/* Chatbot Styles */
:root {
    --chatbot-primary: #002C6C;
    --chatbot-accent: #D83F0E;
  }

  #chatbot-container {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
  }

  .chatbot-toggle {
    position: fixed;
    bottom: 90px;
    right: 55px;
    width: 60px;
    height: 60px;
    background-color: var(--chatbot-accent);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(216, 63, 14, 0.35);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
  }

  .chatbot-toggle:hover {
    background-color: #bf3609;
    transform: scale(1.08);
  }

  .chatbot-toggle img {
    width: 35px;
    height: 35px;
  }

  .chatbot-window {
    position: fixed;
    bottom: 155px;
    right: 20px;
    width: 350px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 44, 108, 0.22);
    display: none;
    flex-direction: column;
    z-index: 9999;
    /* Not hidden: it would clip the country dropdown. The rounded corners are
       applied to the first/last children instead. */
    overflow: visible;
  }

  .chatbot-header {
    background: var(--chatbot-primary);
    color: white;
    font-weight: bold;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: 14px 14px 0 0;
  }

  .chatbot-starters {
    border-radius: 0 0 14px 14px;
  }

  .chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .chatbot-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: var(--chatbot-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .chatbot-avatar img {
    width: 26px;
    height: 26px;
  }

  .chatbot-header-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
  }

  .chatbot-title {
    font-size: 18px;
    font-weight: 700;
  }

  .chatbot-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
  }

  .chatbot-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #2ecc71;
    display: inline-block;
  }

  .chatbot-close {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0.85;
    transition: opacity 0.3s ease;
  }

  .chatbot-close:hover {
    opacity: 1;
  }

  .chatbot-header {
    z-index: 3;
  }

  /* Close confirmation modal */
  .chatbot-close-modal {
    position: absolute;
    inset: 0;
    background: rgba(0, 44, 108, 0.35);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 2;
  }

  .chatbot-close-card {
    position: relative;
    background: white;
    border-radius: 16px;
    padding: 26px 22px 22px;
    width: 100%;
    max-width: 300px;
    text-align: center;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  }

  .chatbot-close-card-x {
    position: absolute;
    top: 14px;
    right: 14px;
    color: #9aa0a6;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
  }

  .chatbot-close-card-x:hover {
    color: #495057;
  }

  .chatbot-close-icon {
    width: 62px;
    height: 62px;
    margin: 4px auto 16px;
    border-radius: 14px;
    background: #fdece3;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .chatbot-close-title {
    font-size: 19px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 8px;
  }

  .chatbot-close-text {
    font-size: 13.5px;
    line-height: 1.55;
    color: #6c757d;
    margin: 0 0 22px;
  }

  .chatbot-close-actions {
    display: flex;
    gap: 12px;
  }

  .chatbot-modal-btn {
    flex: 1;
    padding: 11px 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    transition: background 0.3s ease, color 0.3s ease;
  }

  .chatbot-modal-btn.cancel {
    background: #f1f3f5;
    color: #1a1a2e;
  }

  .chatbot-modal-btn.cancel:hover {
    background: #e6e9ec;
  }

  .chatbot-modal-btn.confirm {
    background: var(--chatbot-accent);
    color: white;
  }

  .chatbot-modal-btn.confirm:hover {
    background: #bf3609;
  }
  
  /* Pre-chat form */
  .chatbot-form {
    display: none;
    padding: 22px 20px 24px;
    background: white;
    overflow-y: auto;
    max-height: calc(100vh - 260px);
  }

  .chatbot-form-title {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 20px;
  }

  .chatbot-field {
    margin-bottom: 16px;
  }

  .chatbot-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    margin-bottom: 7px;
  }

  .chatbot-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    background: white;
    transition: border-color 0.2s ease;
    overflow: hidden;
  }

  .chatbot-input-wrap:focus-within {
    border-color: var(--chatbot-accent);
  }

  .chatbot-input-wrap.has-error {
    border-color: #dc3545;
  }

  .chatbot-input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 12px;
    color: #adb5bd;
    flex-shrink: 0;
  }

  .chatbot-form input[type="text"],
  .chatbot-form input[type="email"],
  .chatbot-form input[type="tel"] {
    flex: 1;
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    padding: 11px 12px;
    font-size: 14px;
    color: #212529;
    height: 44px;
  }

  .chatbot-form input::placeholder {
    color: #adb5bd;
  }

  /* Chrome paints autofilled fields with its own blue background and ignores
     background-color; an inset shadow is the only way to override it. */
  .chatbot-form input:-webkit-autofill,
  .chatbot-form input:-webkit-autofill:hover,
  .chatbot-form input:-webkit-autofill:focus,
  .chatbot-form input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    box-shadow: 0 0 0 1000px #ffffff inset !important;
    -webkit-text-fill-color: #212529 !important;
    caret-color: #212529;
    transition: background-color 9999s ease-in-out 0s;
  }

  .chatbot-form input:focus,
  .chatbot-form input:focus-visible {
    outline: none;
    box-shadow: none;
  }

  .chatbot-field-error {
    display: block;
    font-size: 12px;
    color: #dc3545;
    margin-top: 5px;
    min-height: 1px;
  }

  .chatbot-start-btn {
    width: 100%;
    border: none;
    border-radius: 10px;
    background: var(--chatbot-accent);
    color: white;
    font-size: 15px;
    font-weight: 600;
    padding: 14px;
    margin-top: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.3s ease, opacity 0.3s ease;
  }

  .chatbot-start-btn:hover:not(:disabled) {
    background: #bf3609;
  }

  .chatbot-start-btn:disabled {
    background: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
  }

  /* intl-tel-input overrides */
  .chatbot-input-wrap.phone {
    padding: 0;
    /* Must not clip: the country dropdown/search would be cut down to the
       height of the field, hiding the flag list. */
    overflow: visible;
  }

  .chatbot-input-wrap.phone .iti {
    width: 100%;
  }

  .chatbot-input-wrap.phone .iti__flag-container {
    border-right: 1px solid #dee2e6;
  }

  .chatbot-input-wrap.phone .iti--separate-dial-code .iti__selected-flag {
    background-color: transparent;
    border-radius: 10px 0 0 10px;
    padding: 0 8px 0 12px;
  }

  .chatbot-input-wrap.phone .iti__selected-dial-code {
    font-size: 14px;
    color: #212529;
  }

  /* The dropdown is appended to <body>, so these can't be nested under the
     widget. It must clear the chat window's z-index (9999). */
  .iti--container,
  .iti__dropdown-content {
    z-index: 10050;
  }

  .iti--container .iti__country-list,
  .iti__dropdown-content .iti__country-list {
    max-height: 220px;
    overflow-y: auto;
  }

  .iti__search-input {
    width: 100%;
    padding: 9px 12px;
    border: none;
    border-bottom: 1px solid #e9ecef;
    outline: none;
    font-size: 14px;
  }

  .chatbot-status.connecting .chatbot-status-dot {
    background-color: #4da3ff;
  }

  .chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8f9fa;
    min-height: 0;
    max-height: calc(500px - 52px - 124px);
  }
  
  .message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
  }
  
  .message.user {
    align-items: end;
  }
  
  .message-content {
    /* max-width: 80%; */
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.5;
  }

  .message.user .message-content {
    background: var(--chatbot-accent);
    color: white;
    border-bottom-right-radius: 5px;
  }

  .message.bot .message-content {
    background: #f1f3f5;
    color: #212529;
    border-bottom-left-radius: 5px;
    /* max-width: 100%; */
  }

  .message p {
    font-size: 11px;
    color: #9aa0a6;
    margin: 4px 6px 0 6px;
  }
  
  .chatbot-starters {
    padding: 15px 15px 8px 15px;
    border-top: 1px solid #e0e0e0;
    background: white;
    flex-shrink: 0;
    position: relative;
  }
  
  .starter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
  }
  
  .starter-btn {
    background: #F0F0F0;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 12px;
    color: var(--chatbot-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
  }

  .starter-btn:hover {
    background: var(--chatbot-primary);
    color: white;
    border-color: var(--chatbot-primary);
  }
  
  .chatbot-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  
  .chatbot-input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 10px 15px;
    outline: none;
    font-size: 14px;
    height: 41px;
    transition: border-color 0.3s ease;
  }

  .chatbot-input:focus {
    border-color: var(--chatbot-accent);
  }
  
  .emoji-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.3s ease;
    line-height: 15px;
  }
  
  .emoji-btn:hover {
    background: #f8f9fa;
  }
  
  .send-btn {
    background: var(--chatbot-accent);
    border: none;
    border-radius: 50%;
    width: 41px;
    height: 41px;
    min-width: 41px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
  }

  .send-btn:hover {
    background: #bf3609;
  }
  
  .emoji-picker {
    position: absolute;
    bottom: 60px;
    right: 50px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    max-width: 250px;
    z-index: 1001;
  }
  
  .emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
  }
  
  .emoji-item {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background 0.3s ease;
  }
  
  .emoji-item:hover {
    background: #f8f9fa;
  }
  
  .typing-indicator {
    display: none;
    align-items: center;
    gap: 5px;
    padding: 10px 15px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    max-width: 80px;
  }
  
  .typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
  }
  
  .typing-dot:nth-child(1) {
    animation-delay: -0.32s;
  }
  
  .typing-dot:nth-child(2) {
    animation-delay: -0.16s;
  }
  
  @keyframes typing {
    0%,
    80%,
    100% {
      transform: scale(0);
    }
  
    40% {
      transform: scale(1);
    }
  }
  
  /* Mobile Responsiveness */
  @media (max-width: 768px) {
    .chatbot-window {
      width: calc(100vw - 40px);
      /* height: calc(100vh - 180px); */
      bottom: 155px;
      right: 20px;
      left: 20px;
    }
  
    .chatbot-messages {
      max-height: calc(100vh - 140px - 125px - 124px);
    }
  
    .starter-buttons {
      /* flex-direction: column; */
    }
  
    .starter-btn {
      /* width: 100%; */
      text-align: center;
    }
  
    .emoji-picker {
      right: 10px;
      left: 10px;
      max-width: none;
    }
  }
  
  @media (max-width: 480px) {
    .chatbot-window {
      width: calc(100vw - 20px);
      /* height: calc(100vh - 180px); */
      /* bottom: 80px; */
      right: 10px;
      left: 10px;
    }
  
    .chatbot-messages {
      /* max-height: calc(100vh - 120px - 125px - 124px); */
      max-height: 300px;
    }
  
    .message-content {
      max-width: 90%;
      font-size: 14px;
    }
  
    .chatbot-input {
      font-size: 16px;
      /* Prevents zoom on iOS */
    }
  }
  
  /* iOS specific fixes */
  @supports (-webkit-touch-callout: none) {
    .chatbot-input {
      font-size: 16px;
      -webkit-appearance: none;
      border-radius: 25px;
    }
  }
  
  /* Android specific fixes */
  @media screen and (-webkit-min-device-pixel-ratio: 0) {
    .chatbot-input:focus {
      outline: none;
      border-color: var(--chatbot-accent);
    }
  }
  
  .chaty-i-trigger .chaty-channel {
    right: 30px !important;
  }
  
  .on-hover-text {
    display: none !important;
  }
  
  .chatbot-toggle .popover {
    background-color: rgba(0, 0, 0, 0.85);
    border-radius: 10px;
    bottom: 65px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 10px;
    left: -50px;
    padding: 4px 8px;
    position: absolute;
    z-index: 4;
    white-space: nowrap;
    /* display: none; */
  }
  
  .chatbot-toggle .popover:before {
    border-top: 7px solid rgba(0, 0, 0, 0.85);
    border-right: 7px solid transparent;
    border-left: 7px solid transparent;
    bottom: -6px;
    content: "";
    display: block;
    left: 50%;
    margin-left: -7px;
    position: absolute;
  }
  
  .chatbot-toggle:hover .popover {
    /*display: block;*/
    /* -webkit-animation: fade-in .3s linear 1, move-up .3s linear 1;
      -moz-animation: fade-in .3s linear 1, move-up .3s linear 1;
      -ms-animation: fade-in .3s linear 1, move-up .3s linear 1; */
  }
  
  @-webkit-keyframes fade-in {
    from {
      opacity: 0;
    }
  
    to {
      opacity: 1;
    }
  }
  
  @-moz-keyframes fade-in {
    from {
      opacity: 0;
    }
  
    to {
      opacity: 1;
    }
  }
  
  @-ms-keyframes fade-in {
    from {
      opacity: 0;
    }
  
    to {
      opacity: 1;
    }
  }
  
  @-webkit-keyframes move-up {
    from {
      bottom: 30px;
    }
  
    to {
      bottom: 42px;
    }
  }
  
  @-moz-keyframes move-up {
    from {
      bottom: 30px;
    }
  
    to {
      bottom: 42px;
    }
  }
  
  @-ms-keyframes move-up {
    from {
      bottom: 30px;
    }
  
    to {
      bottom: 42px;
    }
  }
  