   /* Reset and Base Styles */
   * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  }

  html, body {
    overflow: hidden;
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    position: relative;
    touch-action: none;
  }

  /* Mobile-specific: prevent any scrolling outside chat-box */
  @media screen and (max-width: 480px) {
    html, body {
      position: relative;
      overflow: hidden !important;
    }

    /* Hide help button on mobile when chat is open */
    body:has(.chat-box:not(.hidden)) #helpButton {
      display: none !important;
      visibility: hidden !important;
      pointer-events: none !important;
    }
  }

  /* Animations */
  @keyframes typingAnimation {

    0%,
    100% {
      transform: translateY(0);
      opacity: 0.4;
    }

    50% {
      transform: translateY(-4px);
      opacity: 0.8;
    }
  }

  @keyframes messageAppear {
    from {
      transform: translateY(10px);
      opacity: 0;
    }

    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
    }

    to {
      opacity: 1;
    }
  }

  @keyframes pulse {
    0% {
      transform: scale(1);
      opacity: 1;
    }

    50% {
      transform: scale(1.2);
      opacity: 0.7;
    }

    100% {
      transform: scale(1);
      opacity: 1;
    }
  }

  /* Container for the chat box (always visible) */
  .chat-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    border-radius: 0;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    -webkit-user-select: none; /* Prevent text selection on iOS */
    user-select: none;
    transform: translateZ(0); /* iOS fix: Enable hardware acceleration */
    -webkit-transform: translateZ(0);
    pointer-events: auto;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  /* When hidden, don't block pointer events and ensure display is none */
  .chat-box.hidden {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }

  /* Chat Header */
  .chat-header {
    min-height: 72px;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    background: linear-gradient(180deg, #FFFBF8 0%, #ffffff 100%);
    border-bottom: 1px solid rgba(234, 97, 61, 0.15);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
    width: 100%;
    box-sizing: border-box;
    gap: 12px;
  }

  .back-button {
    margin-right: 15px;
    cursor: pointer;
    color: #495057;
  }

  .bot-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }

  .bot-avatar {
    padding: 5px;
  }

  .bot-status {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    line-height: 1.3;
  }

  .header-role-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 0 8px;
  }

  .header-logo {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #EA613D;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(234, 97, 61, 0.2);
  }

  .header-logo img {
    width: 26px;
    height: 26px;
    object-fit: contain;
  }

  .role-select {
    font-size: 12px;
    font-weight: 600;
    color: #EA613D;
    background: #FFF5F2;
    border: 1px solid #EA613D;
    border-radius: 20px;
    padding: 6px 28px 6px 12px;
    cursor: pointer;
    width: 100%;
    max-width: 140px;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23EA613D' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
  }

  .role-select:hover {
    background-color: #FFEDE8;
  }

  .role-select:focus {
    border-color: #c94d2a;
    box-shadow: 0 0 0 2px rgba(234, 97, 61, 0.2);
  }

  .close-btn-header:hover {
    background-color: #FDF1E9 !important;
    transform: scale(1.05);
  }

  .close-btn-header:active {
    transform: scale(0.98);
  }

  .status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #4caf50;
    border-radius: 50%;
    margin-right: 5px;
    animation: pulse 2s infinite;
  }

  /* Chat Messages Area */
  .chat-messages {
    flex: 1 1 auto;
    min-height: 0; /* Critical for flex child scrolling */
    padding: 15px;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: #FFFBF8;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: none !important;
    /* Firefox */
    -ms-overflow-style: none !important;
    /* IE/Edge */
    -webkit-user-select: none;
    user-select: none;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  .chat-messages::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
  }

  /* Message Styles - allow text selection/copy in bubbles (override parent user-select: none) */
  .chat-messages .message,
  .chat-messages .user-message,
  .chat-messages .bot-message {
    -webkit-user-select: text;
    user-select: text;
  }

  .message {
    max-width: 95%;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .bot-message {
    background-color: #ffffff;
    padding: 12px 15px;
    border-radius: 0 20px 20px 20px;
    color: #495057;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    line-height: 1.6;
    margin-top: 12px;
    font-size: 14px;
  }

  /* Markdown: headings and subheadings */
  .bot-message .bot-heading,
  .bot-message h3.bot-heading {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3748;
    margin: 1em 0 0.5em 0;
    line-height: 1.3;
  }
  .bot-message .bot-heading:first-child,
  .bot-message h3.bot-heading:first-child { margin-top: 0; }
  .bot-message .bot-subheading,
  .bot-message h4.bot-subheading {
    font-size: 1rem;
    font-weight: 600;
    color: #4a5568;
    margin: 0.85em 0 0.4em 0;
    line-height: 1.3;
  }
  .bot-message .section-header { font-weight: 600; color: #2d3748; }

  /* Markdown: tables */
  .bot-message .bot-message-table,
  .bot-message table.bot-message-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75em 0;
    font-size: 13px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-radius: 8px;
    overflow: hidden;
  }
  .bot-message .bot-message-table th,
  .bot-message .bot-message-table td {
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
    text-align: left;
  }
  .bot-message .bot-message-table th {
    background-color: #FFF5F2;
    color: #c94d2a;
    font-weight: 600;
  }
  .bot-message .bot-message-table tr:nth-child(even) { background-color: #fafafa; }
  .bot-message .bot-message-table tr:hover { background-color: #FFFBF8; }
  .bot-message .bot-block { margin: 0.5em 0; }

  .user-message {
    background: #FDF1E9;
    color: rgb(0, 0, 0);
    padding: 12px 15px;
    border-radius: 20px 20px 0 20px;
    border: 2px solid white;
    margin-left: auto;
    font-size: 14px;
  }

  .bot-message-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    animation: messageAppear 0.3s ease;
  }

  .stream-response {
    animation: fadeIn 0.2s ease-in;
  }

  .ai-indicator {
    color: white;
    padding: 2px;
    border-radius: 50%;
    height: 50px;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
    border: 2px solid #EA613D;
  }

  /* Chat Input Area */
  .chat-input {
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom)); /* Handle notches on iPhone */
    background-color: white;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* Prevent horizontal scrolling */
    touch-action: none; /* Prevent any touch action on input area itself */
  }

  .chat-input input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    outline: none;
    font-size: 16px; /* iOS fix: min 16px to prevent zoom */
    transition: border-color 0.3s ease;
    -webkit-appearance: none; /* Remove iOS default styling */
    -webkit-border-radius: 20px; /* iOS border radius */
    appearance: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    touch-action: manipulation; /* Only allow normal touch interactions */
  }

  .chat-input input:focus {
    border-color: #EA613D;
  }

  .send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: transform 0.3s ease;
  }

  /* Typing Indicator */
  .typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px;
    margin: 10px 0 15px;
  }

  .typing-dot {
    width: 8px;
    height: 8px;
    background-color: #EA613D;
    border-radius: 50%;
    opacity: 0.4;
    animation: typingAnimation 1.4s infinite;
  }

  /* Follow-up Questions */
  .follow-up-questions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }

  .options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
    animation: messageAppear 0.3s ease;
  }

  .option-button {
    background-color: #FDF1E9;
    border: 2px solid #EB613D;
    color: #EB613D;
    padding: 8px 15px;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    font-weight: 500;
    min-width: 100%;
    margin: 5px 0;
    font-size: 14px;
  }

  .option-button:hover {
    background-color: #f6ebe4;
    color: rgb(0, 0, 0);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.2);
  }

  /* List Styles */
  .numbered-item,
  .bullet-point {
    padding: 8px 0;
    line-height: 1.5;
    font-size: inherit;
  }

  .item-number {
    margin-right: 0.5em;
  }

  /* Base button styles */
  #helpButton {
    pointer-events: auto !important;
    outline: none !important;
  }

  #helpButton * {
    pointer-events: none; /* Prevent child elements from blocking clicks */
  }

  /* Fox circle - always present */
  .fox-circle {
    width: 56px;
    height: 56px;
    background: white;
    border-radius: 50%;
    border: 4px solid #EA613D;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  /* Mobile: ONLY fox circle visible */
  @media screen and (max-width: 767px) {
    #helpButton {
      width: 70px !important;
      height: 70px !important;
      border-radius: 50% !important;
      padding: 7px !important;
      justify-content: center !important;
      background-color: transparent !important; /* NO orange */
    }

    .fox-circle {
      position: static !important;
      margin: 0 !important;
      width: 70px !important;
      height: 70px !important;
    }

    .button-text,
    .arrow-icon {
      display: none !important;
      width: 0 !important;
      height: 0 !important;
      overflow: hidden !important;
    }
  }

  /* Desktop/Tablet: Pill shape with EVERYTHING visible */
  @media screen and (min-width: 768px) {
    #helpButton {
      width: auto !important;
      height: 70px !important;
      border-radius: 35px !important;
      padding: 7px 20px 7px 7px !important;
      gap: 12px !important;
      background-color: #EA613D !important; /* Orange pill */
    }

    .fox-circle {
      position: static !important;
      width: 56px !important;
      height: 56px !important;
      margin: 0 !important;
    }

    .button-text {
      display: inline-block !important;
      opacity: 1 !important;
      visibility: visible !important;
      color: #ffffff !important;
      font-size: 15px !important;
      font-weight: 600 !important;
      white-space: nowrap !important;
      margin: 0 !important;
    }

    .arrow-icon {
      display: inline-block !important;
      opacity: 1 !important;
      visibility: visible !important;
      width: 20px !important;
      height: 20px !important;
      margin: 0 !important;
      filter: brightness(0) invert(1) !important;
    }
  }

  /* Responsive Breakpoints */
  @media screen and (max-width: 480px) {
    .chat-box {
      width: 100vw !important;
      height: 100% !important; /* Let JS control this */
      position: fixed !important;
      top: 0 !important;
      left: 0 !important;
      right: 0 !important;
      bottom: 0 !important;
      display: flex !important;
      flex-direction: column !important;
      overflow: hidden !important;
    }

    .chat-header {
      position: relative !important;
      flex: 0 0 auto !important;
      z-index: 100;
      min-height: 72px !important;
      padding: 12px 16px !important;
      padding-top: max(12px, env(safe-area-inset-top)) !important;
    }

    .chat-messages {
      flex: 1 1 auto !important;
      min-height: 0 !important; /* Critical for scrolling */
      overflow-y: auto !important;
      overflow-x: hidden !important;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      padding: 12px;
      padding-bottom: 20px;
    }

    .chat-input {
      position: relative !important;
      flex: 0 0 auto !important;
      padding: 12px;
      padding-bottom: max(12px, env(safe-area-inset-bottom));
      background-color: white;
      box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
      z-index: 10;
    }

    .chat-input input {
      font-size: 16px !important; /* Prevent zoom on iOS */
    }
  }

  @media screen and (min-width: 481px) {
    .chat-box {
      width: 460px;
      height: 645px;
      right: 27px;
      bottom: 0;
      top: auto;
      left: auto;
      border-radius: 20px;
      max-height: 100vh;
    }
  }

  @media screen and (min-width: 768px) {
    .chat-box {
      width: 480px;
      right: 27px;
      bottom: 0;
      top: auto;
      left: auto;
      height: 645px;
      max-height: 100vh;
    }

    .chat-header {
      padding: 16px;
    }

    .bot-avatar {
      width: 40px;
      height: 40px;
    }

    .chat-messages {
      padding: 20px;
    }

    .bot-message,
    .user-message {
      padding: 15px 20px;
      max-width: 85%;
      font-size: 15px;
    }

    .option-button {
      min-width: calc(50% - 10px);
      margin: 5px;
    }
  }

  @media screen and (min-width: 1024px) {
    .chat-box {
      width: 520px;
      right: 27px;
      bottom: 0;
      top: auto;
      left: auto;
      height: 645px !important;
      max-height: 100vh;
    }


    .chat-messages {
      padding: 24px;
      padding-top: calc(70px + 24px); /* Account for fixed header + padding */
    }

    .bot-message,
    .user-message {
      padding: 18px 22px;
      font-size: 16px;
    }

    .chat-input input {
      padding: 12px 20px;
      font-size: 15px;
    }

    .send-button {
      width: 45px;
      height: 45px;
    }
  }

  @media screen and (min-width: 1440px) {
    .chat-box {
      width: 560px;
      right: 27px;
      bottom: 0;
      top: auto;
      left: auto;
      height: 100vh;
      max-height: 100vh;
    }

    .bot-avatar {
      width: 45px;
      height: 45px;
    }

    .chat-header {
      padding: 20px;
    }

    .option-button {
      font-size: 15px;
      padding: 12px 20px;
    }
  }

  /* Accessibility */
  @media (prefers-reduced-motion: reduce) {
    * {
      transition: none !important;
      animation: none !important;
    }
  }

  @media (prefers-contrast: high) {
    .send-button {
      border: 2px solid #000;
    }

    .bot-message,
    .user-message {
      border: 1px solid currentColor;
    }
  }

  /* CTA Buttons Styles — always horizontal (EN and FR) */
  #cta-buttons {
    padding: 10px 14px;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 10px;
    margin: 12px 0;
    align-items: stretch;
  }

  /* Status line (e.g. "Clinique fermée — Urgences disponibles") hidden per design */
  #cta-buttons .cta-status-badge {
    display: none;
  }

  .cta-buttons-wrapper {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 10px;
    width: 100%;
  }

  .cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s ease, transform 0.1s ease, box-shadow 0.1s ease;
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
    text-align: center;
  }

  .cta-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
  }

  .cta-btn-call {
    background-color: #EA613D;
    color: #fff;
  }

  .cta-btn-book {
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #e1e1e1;
  }

  .cta-referral-note {
    font-size: 11px;
    color: #888;
    text-align: center;
    margin-top: 2px;
  }