/* =========================================================
   OCIA PREMIUM SUPPORT WIDGET V2
   Enoroidai + Human Support
   ========================================================= */

.ocia-chat-v2,
.ocia-chat-v2 *{
  box-sizing:border-box;
}

.ocia-chat-v2{
  --ocia-chat-primary:#F15A24;
  --ocia-chat-secondary:#29ABE2;
  --ocia-chat-accent:#005BAA;
  --ocia-chat-surface:#FFFFFF;
  --ocia-chat-text:#17212B;
  --ocia-chat-muted:#68747D;
  --ocia-chat-launcher-size:64px;

  position:fixed;
  right:22px;
  bottom:22px;
  z-index:2147483000;

  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  color:var(--ocia-chat-text);
  line-height:1.45;
}

.ocia-chat-v2.is-left{
  right:auto;
  left:22px;
}

.ocia-chat-v2 [hidden]{
  display:none !important;
}


/* =========================================================
   LAUNCHER
   ========================================================= */

.ocia-chat-v2__launcher{
  width:var(--ocia-chat-launcher-size);
  height:var(--ocia-chat-launcher-size);

  padding:0;
  border:4px solid rgba(255,255,255,.96);
  border-radius:50%;

  display:grid;
  place-items:center;

  position:relative;

  background:
    linear-gradient(
      135deg,
      var(--ocia-chat-accent) 0%,
      var(--ocia-chat-secondary) 54%,
      var(--ocia-chat-primary) 100%
    );

  color:#fff;

  box-shadow:
    0 18px 42px rgba(0,91,170,.24),
    0 7px 18px rgba(20,30,40,.16);

  cursor:pointer;

  transition:
    transform .2s ease,
    box-shadow .2s ease;
}

.ocia-chat-v2__launcher:hover{
  transform:
    translateY(-2px)
    scale(1.025);

  box-shadow:
    0 22px 48px rgba(0,91,170,.3),
    0 8px 22px rgba(20,30,40,.18);
}

.ocia-chat-v2__launcher:focus-visible{
  outline:
    3px solid
    color-mix(
      in srgb,
      var(--ocia-chat-secondary) 55%,
      white
    );

  outline-offset:3px;
}

.ocia-chat-v2.is-open
.ocia-chat-v2__launcher{
  transform:scale(.92);
}

.ocia-chat-v2__launcher-mark,
.ocia-chat-v2__brand-mark,
.ocia-chat-v2__assistant-avatar,
.ocia-chat-v2__message-avatar{
  overflow:hidden;

  display:grid;
  place-items:center;

  font-weight:800;
}

.ocia-chat-v2__launcher-mark{
  width:100%;
  height:100%;

  border-radius:50%;

  font-size:1.15rem;
}

.ocia-chat-v2__launcher-mark img,
.ocia-chat-v2__brand-mark img,
.ocia-chat-v2__assistant-avatar img,
.ocia-chat-v2__message-avatar img{
  width:100%;
  height:100%;
  object-fit:contain;
}

.ocia-chat-v2__badge{
  min-width:22px;
  height:22px;

  padding:0 5px;

  position:absolute;
  top:-7px;
  right:-5px;

  display:grid;
  place-items:center;

  border:
    2px solid
    #fff;

  border-radius:999px;

  background:#D9363E;
  color:#fff;

  font-size:10px;
  font-weight:800;

  box-shadow:
    0 4px 10px
    rgba(217,54,62,.24);
}


/* =========================================================
   PANEL
   ========================================================= */

.ocia-chat-v2__panel{
  width:min(390px,calc(100vw - 28px));
  height:min(690px,calc(100dvh - 110px));

  position:absolute;
  right:0;
  bottom:
    calc(
      var(--ocia-chat-launcher-size)
      +
      14px
    );

  overflow:hidden;

  display:grid;
  grid-template-rows:
    auto
    minmax(0,1fr)
    auto;

  border:
    1px solid
    rgba(20,40,60,.1);

  border-radius:24px;

  background:
    var(--ocia-chat-surface);

  box-shadow:
    0 30px 80px rgba(10,35,60,.22),
    0 10px 30px rgba(10,35,60,.12);

  opacity:0;
  visibility:hidden;

  pointer-events:none;

  transform:
    translateY(14px)
    scale(.975);

  transform-origin:
    bottom right;

  transition:
    opacity .22s ease,
    transform .22s ease,
    visibility .22s ease;
}

.ocia-chat-v2.is-left
.ocia-chat-v2__panel{
  right:auto;
  left:0;

  transform-origin:
    bottom left;
}

.ocia-chat-v2.is-open
.ocia-chat-v2__panel{
  opacity:1;
  visibility:visible;

  pointer-events:auto;

  transform:
    translateY(0)
    scale(1);
}


/* =========================================================
   HEADER
   ========================================================= */

.ocia-chat-v2__header{
  min-height:82px;

  padding:
    15px
    14px
    14px
    16px;

  display:flex;
  align-items:center;
  justify-content:space-between;

  gap:12px;

  color:#fff;

  background:
    linear-gradient(
      125deg,
      var(--ocia-chat-accent) 0%,
      var(--ocia-chat-secondary) 57%,
      var(--ocia-chat-primary) 112%
    );
}

.ocia-chat-v2__brand{
  min-width:0;

  display:flex;
  align-items:center;

  gap:11px;
}

.ocia-chat-v2__brand-mark{
  width:43px;
  height:43px;

  flex:0 0 43px;

  border-radius:13px;

  background:
    rgba(255,255,255,.96);

  color:
    var(--ocia-chat-accent);

  box-shadow:
    0 6px 15px
    rgba(0,0,0,.09);
}

.ocia-chat-v2__brand-copy{
  min-width:0;

  display:grid;

  gap:1px;
}

.ocia-chat-v2__title{
  overflow:hidden;

  color:#fff;

  font-size:14px;
  font-weight:750;

  text-overflow:ellipsis;
  white-space:nowrap;
}

.ocia-chat-v2__subtitle{
  overflow:hidden;

  color:
    rgba(255,255,255,.82);

  font-size:10px;

  text-overflow:ellipsis;
  white-space:nowrap;
}

.ocia-chat-v2__header-actions{
  display:flex;

  gap:5px;
}

.ocia-chat-v2__icon-btn{
  width:31px;
  height:31px;

  padding:0;

  display:grid;
  place-items:center;

  border:0;

  border-radius:9px;

  background:
    rgba(255,255,255,.13);

  color:#fff;

  font-size:18px;

  cursor:pointer;
}

.ocia-chat-v2__icon-btn:hover{
  background:
    rgba(255,255,255,.22);
}


/* =========================================================
   BODY
   ========================================================= */

.ocia-chat-v2__body{
  min-height:0;

  overflow-y:auto;

  overscroll-behavior:contain;

  background:
    linear-gradient(
      145deg,
      #F6FBFF 0%,
      #FFF 45%,
      #FFF7F2 100%
    );
}

.ocia-chat-v2__intro{
  padding:
    19px
    17px
    20px;
}

.ocia-chat-v2__assistant-card{
  margin-bottom:15px;

  display:flex;
  align-items:center;

  gap:10px;
}

.ocia-chat-v2__assistant-avatar{
  width:42px;
  height:42px;

  flex:0 0 42px;

  border-radius:50%;

  color:#fff;

  background:
    linear-gradient(
      135deg,
      var(--ocia-chat-accent),
      var(--ocia-chat-secondary)
    );

  box-shadow:
    0 7px 18px
    rgba(0,91,170,.17);
}

.ocia-chat-v2__assistant-avatar.is-small{
  width:30px;
  height:30px;

  flex:0 0 30px;
}

.ocia-chat-v2__assistant-card > span:last-child{
  display:grid;

  gap:1px;
}

.ocia-chat-v2__assistant-card strong{
  color:var(--ocia-chat-text);

  font-size:13px;
}

.ocia-chat-v2__assistant-card small{
  color:var(--ocia-chat-muted);

  font-size:10px;
}


/* =========================================================
   WELCOME
   ========================================================= */

.ocia-chat-v2__welcome{
  margin-bottom:14px;

  padding:
    15px
    16px;

  border:
    1px solid
    rgba(0,91,170,.08);

  border-radius:
    5px
    17px
    17px
    17px;

  background:
    color-mix(
      in srgb,
      var(--ocia-chat-surface) 94%,
      transparent
    );

  box-shadow:
    0 8px 24px
    rgba(15,45,70,.06);
}

.ocia-chat-v2__welcome strong{
  display:block;

  margin-bottom:5px;

  color:var(--ocia-chat-text);

  font-size:14px;
}

.ocia-chat-v2__welcome p{
  margin:0;

  color:var(--ocia-chat-muted);

  font-size:12px;

  line-height:1.55;
}


/* =========================================================
   QUICK ACTIONS
   ========================================================= */

.ocia-chat-v2__quick-actions{
  margin:
    0
    0
    16px;

  display:flex;
  flex-wrap:wrap;

  gap:7px;
}

.ocia-chat-v2__quick-actions.is-conversation{
  padding:
    0
    15px
    2px;
}

.ocia-chat-v2__chip{
  max-width:100%;

  padding:
    7px
    11px;

  border:
    1px solid
    color-mix(
      in srgb,
      var(--ocia-chat-secondary) 55%,
      #D7E1E8
    );

  border-radius:999px;

  background:
    rgba(255,255,255,.84);

  color:
    var(--ocia-chat-accent);

  font-size:11px;
  font-weight:650;

  white-space:normal;

  cursor:pointer;

  transition:
    background .15s ease,
    transform .15s ease;
}

.ocia-chat-v2__chip:hover{
  background:
    color-mix(
      in srgb,
      var(--ocia-chat-secondary) 8%,
      white
    );

  transform:
    translateY(-1px);
}


/* =========================================================
   START FORM
   ========================================================= */

.ocia-chat-v2__start-form{
  display:grid;

  gap:13px;
}

.ocia-chat-v2__identity-grid{
  display:grid;
  grid-template-columns:
    repeat(2,minmax(0,1fr));

  gap:9px;
}

.ocia-chat-v2__start-form label{
  display:grid;

  gap:5px;
}

.ocia-chat-v2__start-form label > span{
  color:var(--ocia-chat-text);

  font-size:10px;
  font-weight:700;
}

.ocia-chat-v2__start-form em{
  color:var(--ocia-chat-muted);

  font-size:9px;
  font-style:normal;
  font-weight:400;
}

.ocia-chat-v2__start-form input,
.ocia-chat-v2__start-form textarea,
.ocia-chat-v2__composer textarea{
  width:100%;

  border:
    1px solid
    rgba(20,45,65,.12);

  border-radius:11px;

  outline:0;

  background:
    rgba(255,255,255,.94);

  color:var(--ocia-chat-text);

  font:inherit;

  transition:
    border-color .15s ease,
    box-shadow .15s ease;
}

.ocia-chat-v2__start-form input{
  min-height:39px;

  padding:9px 10px;

  font-size:12px;
}

.ocia-chat-v2__start-form textarea{
  min-height:76px;

  padding:10px 11px;

  resize:vertical;

  font-size:12px;
}

.ocia-chat-v2__start-form input:focus,
.ocia-chat-v2__start-form textarea:focus,
.ocia-chat-v2__composer textarea:focus{
  border-color:
    var(--ocia-chat-secondary);

  box-shadow:
    0 0 0 3px
    color-mix(
      in srgb,
      var(--ocia-chat-secondary) 13%,
      transparent
    );
}

.ocia-chat-v2__form-actions{
  display:grid;
  grid-template-columns:
    1fr
    1fr;

  gap:8px;
}

.ocia-chat-v2__primary-btn,
.ocia-chat-v2__secondary-btn{
  min-height:41px;

  padding:8px 11px;

  border-radius:11px;

  font:inherit;
  font-size:11px;
  font-weight:750;

  cursor:pointer;
}

.ocia-chat-v2__primary-btn{
  border:
    1px solid
    var(--ocia-chat-primary);

  background:
    var(--ocia-chat-primary);

  color:#fff;
}

.ocia-chat-v2__secondary-btn{
  border:
    1px solid
    color-mix(
      in srgb,
      var(--ocia-chat-accent) 45%,
      #D5DEE5
    );

  background:#fff;

  color:
    var(--ocia-chat-accent);
}

.ocia-chat-v2 button:disabled,
.ocia-chat-v2 input:disabled,
.ocia-chat-v2 textarea:disabled{
  opacity:.58;
  cursor:not-allowed;
}


/* =========================================================
   CONVERSATION
   ========================================================= */

.ocia-chat-v2__conversation{
  min-height:100%;

  padding-top:11px;
}

.ocia-chat-v2__conversation-meta{
  padding:
    0
    15px
    9px;

  display:flex;
  align-items:center;
  justify-content:space-between;

  gap:8px;
}

.ocia-chat-v2__ticket{
  overflow:hidden;

  color:var(--ocia-chat-muted);

  font-size:9px;

  text-overflow:ellipsis;
  white-space:nowrap;
}

.ocia-chat-v2__mode-pill{
  flex:0 0 auto;

  padding:
    4px
    8px;

  border-radius:999px;

  font-size:9px;
  font-weight:750;
}

.ocia-chat-v2__mode-pill.is-ai{
  color:
    var(--ocia-chat-accent);

  background:
    color-mix(
      in srgb,
      var(--ocia-chat-secondary) 13%,
      white
    );
}

.ocia-chat-v2__mode-pill.is-handoff{
  color:#9C4A14;
  background:#FFF1E8;
}

.ocia-chat-v2__mode-pill.is-staff{
  color:#11633B;
  background:#EAF8F0;
}


/* =========================================================
   MESSAGES
   ========================================================= */

.ocia-chat-v2__messages{
  min-height:270px;

  padding:
    3px
    14px
    15px;

  display:flex;
  flex-direction:column;

  gap:12px;
}

.ocia-chat-v2__message{
  max-width:88%;

  display:flex;

  gap:7px;
}

.ocia-chat-v2__message.is-visitor{
  margin-left:auto;
}

.ocia-chat-v2__message.is-assistant,
.ocia-chat-v2__message.is-staff{
  margin-right:auto;
}

.ocia-chat-v2__message-avatar{
  width:28px;
  height:28px;

  flex:0 0 28px;

  margin-top:18px;

  border-radius:50%;

  color:#fff;

  background:
    linear-gradient(
      135deg,
      var(--ocia-chat-accent),
      var(--ocia-chat-secondary)
    );

  font-size:9px;
}

.ocia-chat-v2__message.is-staff
.ocia-chat-v2__message-avatar{
  background:
    linear-gradient(
      135deg,
      var(--ocia-chat-primary),
      #FF9B63
    );
}

.ocia-chat-v2__message-content{
  min-width:0;
}

.ocia-chat-v2__message-sender{
  margin:
    0
    0
    3px
    3px;

  color:var(--ocia-chat-muted);

  font-size:9px;
  font-weight:700;
}

.ocia-chat-v2__message.is-visitor
.ocia-chat-v2__message-sender{
  text-align:right;
}

.ocia-chat-v2__message-bubble{
  padding:
    10px
    12px;

  border-radius:
    5px
    15px
    15px
    15px;

  background:
    rgba(255,255,255,.95);

  color:var(--ocia-chat-text);

  font-size:12px;

  line-height:1.52;

  white-space:pre-wrap;

  overflow-wrap:anywhere;

  box-shadow:
    0 6px 18px
    rgba(15,45,70,.07);
}

.ocia-chat-v2__message.is-visitor
.ocia-chat-v2__message-bubble{
  border-radius:
    15px
    15px
    5px
    15px;

  background:
    var(--ocia-chat-accent);

  color:#fff;

  box-shadow:
    0 7px 18px
    color-mix(
      in srgb,
      var(--ocia-chat-accent) 20%,
      transparent
    );
}

.ocia-chat-v2__message.is-staff
.ocia-chat-v2__message-bubble{
  border:
    1px solid
    color-mix(
      in srgb,
      var(--ocia-chat-primary) 17%,
      #E4E8EB
    );
}

.ocia-chat-v2__message-time{
  margin:
    3px
    3px
    0;

  color:
    color-mix(
      in srgb,
      var(--ocia-chat-muted) 82%,
      transparent
    );

  font-size:8px;
}

.ocia-chat-v2__message.is-visitor
.ocia-chat-v2__message-time{
  text-align:right;
}


/* =========================================================
   TYPING
   ========================================================= */

.ocia-chat-v2__typing{
  padding:
    0
    14px
    14px;

  display:flex;
  align-items:flex-end;

  gap:7px;
}

.ocia-chat-v2__typing-bubble{
  min-width:55px;
  height:34px;

  padding:
    0
    13px;

  display:flex;
  align-items:center;
  justify-content:center;

  gap:4px;

  border-radius:
    5px
    14px
    14px
    14px;

  background:#fff;

  box-shadow:
    0 5px 16px
    rgba(15,45,70,.07);
}

.ocia-chat-v2__typing-bubble i{
  width:5px;
  height:5px;

  border-radius:50%;

  background:
    var(--ocia-chat-secondary);

  animation:
    ociaChatTyping
    .95s
    infinite
    ease-in-out;
}

.ocia-chat-v2__typing-bubble i:nth-child(2){
  animation-delay:.13s;
}

.ocia-chat-v2__typing-bubble i:nth-child(3){
  animation-delay:.26s;
}

@keyframes ociaChatTyping{
  0%,
  65%,
  100%{
    opacity:.35;
    transform:translateY(0);
  }

  32%{
    opacity:1;
    transform:translateY(-3px);
  }
}


/* =========================================================
   HANDOFF
   ========================================================= */

.ocia-chat-v2__handoff-banner{
  margin:
    2px
    14px
    13px;

  padding:
    10px
    11px;

  border:
    1px solid
    rgba(241,90,36,.18);

  border-radius:11px;

  background:#FFF5EF;

  color:#87431C;

  font-size:10px;

  line-height:1.45;
}


/* =========================================================
   FOOTER / COMPOSER
   ========================================================= */

.ocia-chat-v2__footer{
  padding:
    10px
    12px
    9px;

  border-top:
    1px solid
    rgba(20,45,65,.08);

  background:
    color-mix(
      in srgb,
      var(--ocia-chat-surface) 97%,
      transparent
    );
}

.ocia-chat-v2__composer{
  margin-bottom:7px;

  display:grid;
  grid-template-columns:
    minmax(0,1fr)
    40px;

  gap:7px;

  align-items:end;
}

.ocia-chat-v2__composer textarea{
  min-height:40px;
  max-height:105px;

  padding:
    10px
    11px;

  resize:none;

  background:#F5F7F9;

  font-size:11px;
}

.ocia-chat-v2__send-btn{
  width:40px;
  height:40px;

  padding:0;

  border:0;

  border-radius:11px;

  background:
    var(--ocia-chat-primary);

  color:#fff;

  font-size:17px;
  font-weight:800;

  cursor:pointer;

  box-shadow:
    0 6px 15px
    color-mix(
      in srgb,
      var(--ocia-chat-primary) 23%,
      transparent
    );
}

.ocia-chat-v2__footer-row{
  min-height:20px;

  display:flex;
  align-items:center;

  gap:10px;
}

.ocia-chat-v2__link-btn{
  padding:0;

  border:0;

  background:transparent;

  color:
    var(--ocia-chat-accent);

  font-size:9px;
  font-weight:700;

  cursor:pointer;
}

.ocia-chat-v2__powered{
  margin-left:auto;

  color:var(--ocia-chat-muted);

  font-size:8px;
}

.ocia-chat-v2__error{
  margin-top:5px;

  color:#B3261E;

  font-size:10px;

  line-height:1.4;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media(max-width:600px){

  .ocia-chat-v2,
  .ocia-chat-v2.is-left{
    right:
      max(
        12px,
        env(safe-area-inset-right)
      );

    left:auto;

    bottom:
      max(
        12px,
        env(safe-area-inset-bottom)
      );
  }

  .ocia-chat-v2__panel,
  .ocia-chat-v2.is-left
  .ocia-chat-v2__panel{
    width:
      calc(
        100vw
        -
        16px
      );

    height:
      calc(
        100dvh
        -
        18px
      );

    max-height:none;

    position:fixed;

    left:8px;
    right:8px;

    top:
      max(
        8px,
        env(safe-area-inset-top)
      );

    bottom:
      max(
        8px,
        env(safe-area-inset-bottom)
      );

    border-radius:22px;

    transform:
      translateY(12px)
      scale(.985);

    transform-origin:center bottom;
  }

  .ocia-chat-v2.is-open
  .ocia-chat-v2__panel{
    transform:
      translateY(0)
      scale(1);
  }

  .ocia-chat-v2.is-open
  .ocia-chat-v2__launcher{
    opacity:0;
    visibility:hidden;
    pointer-events:none;
  }

  .ocia-chat-v2__header{
    min-height:76px;

    padding:
      13px
      13px
      12px;
  }

  .ocia-chat-v2__intro{
    padding:
      17px
      14px
      20px;
  }

  .ocia-chat-v2__identity-grid{
    grid-template-columns:1fr;
  }

  .ocia-chat-v2__messages{
    padding-left:11px;
    padding-right:11px;
  }

  .ocia-chat-v2__message{
    max-width:92%;
  }
}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media(prefers-reduced-motion:reduce){

  .ocia-chat-v2 *,
  .ocia-chat-v2 *::before,
  .ocia-chat-v2 *::after{
    scroll-behavior:auto !important;
    animation-duration:.001ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.001ms !important;
  }
}
