/* =========================================================
   B-ART SPACE Guide Add-on v0.5.2
   Floating chat UI
========================================================= */

#bas-guide-floating,
#bas-guide-floating *,
#bas-guide-floating *::before,
#bas-guide-floating *::after {
  box-sizing:border-box;
}

#bas-guide-floating {
  --bas-guide-orange:#df8754;
  --bas-guide-orange-dark:#c87548;
  --bas-guide-text:#302b28;
  --bas-guide-sub:#766d67;
  --bas-guide-border:#eadbcf;
  --bas-guide-cream:#fbf7f2;
  --bas-guide-shadow:rgba(61,45,36,.18);

  position:fixed;
  right:24px;
  bottom:320px;
  z-index:9999;

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Hiragino Kaku Gothic ProN",
    "Yu Gothic",
    "Noto Sans JP",
    sans-serif;
}

#bas-guide-floating.is-raised {
  bottom:320px;
}

#bas-guide-floating .bas-guide-launcher {
  display:flex;
  align-items:center;
  gap:10px;

  min-width:132px;
  min-height:54px;

  padding:8px 15px 8px 9px;

  border:1px solid rgba(223,135,84,.50);
  border-radius:999px;

  background:rgba(255,255,255,.97);
  color:var(--bas-guide-text);

  box-shadow:0 8px 24px var(--bas-guide-shadow);

  cursor:pointer;

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

#bas-guide-floating .bas-guide-launcher:hover {
  transform:translateY(-2px);
  box-shadow:0 12px 28px rgba(61,45,36,.21);
}

#bas-guide-floating .bas-guide-launcher-icon {
  display:flex;
  align-items:center;
  justify-content:center;

  width:38px;
  height:38px;

  flex:0 0 auto;

  border-radius:50%;

  background:
    linear-gradient(
      135deg,
      #ef9a54 0%,
      #d77742 100%
    );

  color:#fff;

  font-family:Georgia,"Times New Roman",serif;
  font-size:11px;
  font-weight:700;
  letter-spacing:.03em;
}

#bas-guide-floating .bas-guide-launcher-copy {
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  min-width:0;
}

#bas-guide-floating .bas-guide-launcher-copy small {
  margin-bottom:1px;
  color:#92867f;
  font-size:8px;
  line-height:1.2;
}

#bas-guide-floating .bas-guide-launcher-copy strong {
  color:#554c47;
  font-size:12px;
  font-weight:700;
  line-height:1.35;
  white-space:nowrap;
}

#bas-guide-floating .bas-guide-panel {
  position:fixed;
  right:20px;
  bottom:20px;

  display:flex;
  flex-direction:column;

  width:390px;
  height:min(590px,76vh);

  overflow:hidden;

  border:1px solid var(--bas-guide-border);
  border-radius:17px;

  background:#fff;

  box-shadow:
    0 18px 48px rgba(55,41,33,.22);

  opacity:0;
  visibility:hidden;
  pointer-events:none;

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

  transform-origin:
    right bottom;

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

#bas-guide-floating.is-open .bas-guide-panel {
  opacity:1;
  visibility:visible;
  pointer-events:auto;

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

#bas-guide-floating .bas-guide-panel-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:15px;

  flex:0 0 auto;

  min-height:70px;

  padding:
    14px 16px 13px 18px;

  border-bottom:
    1px solid
    var(--bas-guide-border);

  background:
    linear-gradient(
      135deg,
      #fff 0%,
      #fbf5ef 100%
    );
}

#bas-guide-floating .bas-guide-panel-head > div {
  min-width:0;
}

#bas-guide-floating .bas-guide-panel-eyebrow {
  display:block;

  margin-bottom:4px;

  color:var(--bas-guide-orange);

  font-family:
    Georgia,
    "Times New Roman",
    serif;

  font-size:8px;
  line-height:1.2;
  letter-spacing:.17em;
}

#bas-guide-floating .bas-guide-panel-head strong {
  display:block;

  color:#433d39;

  font-size:13px;
  font-weight:700;
  line-height:1.45;
}

#bas-guide-floating .bas-guide-close {
  display:flex;
  align-items:center;
  justify-content:center;

  width:34px;
  height:34px;

  flex:0 0 auto;

  padding:0;

  border:1px solid rgba(218,198,183,.75);
  border-radius:50%;

  background:#fff;
  color:#756b65;

  cursor:pointer;

  font-size:20px;
  font-weight:300;
  line-height:1;
}

#bas-guide-floating .bas-guide-panel-intro {
  flex:0 0 auto;

  padding:
    13px 15px 12px;

  border-bottom:
    1px solid
    rgba(234,219,207,.68);

  background:#fff;
}

#bas-guide-floating .bas-guide-panel-intro > p {
  margin:
    0 0 10px;

  color:#7a716b;

  font-size:9.5px;
  line-height:1.65;
}

#bas-guide-floating .bas-guide-suggestions {
  display:grid;
  grid-template-columns:
    repeat(2,minmax(0,1fr));

  gap:6px;
}

#bas-guide-floating .bas-guide-suggestions button {
  min-height:36px;

  padding:
    7px 8px;

  border:
    1px solid
    rgba(223,135,84,.24);

  border-radius:7px;

  background:
    var(--bas-guide-cream);

  color:#6d5d53;

  cursor:pointer;

  text-align:left;

  font:inherit;
  font-size:8.5px;
  font-weight:600;
  line-height:1.45;
}

#bas-guide-floating .bas-guide-suggestions button:hover {
  border-color:
    rgba(223,135,84,.55);

  background:#fff;
}

#bas-guide-floating .bas-guide-log {
  flex:1 1 auto;

  min-height:0;

  overflow-y:auto;

  padding:
    14px 14px 5px;

  background:
    linear-gradient(
      180deg,
      #fdfbf9 0%,
      #fff 100%
    );

  overscroll-behavior:contain;
}

#bas-guide-floating .bas-guide-msg {
  width:fit-content;
  max-width:88%;

  margin:
    0 0 10px;

  padding:
    10px 11px;

  border-radius:
    11px 11px 11px 3px;

  color:#625a55;

  background:#f4eee9;

  font-size:10px;
  line-height:1.7;

  white-space:pre-wrap;
  word-break:break-word;
}

#bas-guide-floating .bas-guide-msg.bas-guide-user {
  margin-left:auto;

  border-radius:
    11px 11px 3px 11px;

  background:
    #df8754;

  color:#fff;
}

#bas-guide-floating .bas-guide-msg.bas-guide-thinking {
  color:#93877f;
  font-style:italic;
}

#bas-guide-floating .bas-guide-form {
  display:grid;

  grid-template-columns:
    1fr auto;

  gap:7px;

  flex:0 0 auto;

  padding:
    10px 11px;

  border-top:
    1px solid
    var(--bas-guide-border);

  background:#fff;
}

#bas-guide-floating .bas-guide-form textarea {
  width:100%;
  min-height:46px;
  max-height:100px;

  resize:none;

  padding:
    9px 10px;

  border:
    1px solid
    #ddd0c6;

  border-radius:8px;

  outline:none;

  color:#514a46;
  background:#fff;

  font:inherit;
  font-size:10px;
  line-height:1.55;
}

#bas-guide-floating .bas-guide-form textarea:focus {
  border-color:
    rgba(223,135,84,.68);

  box-shadow:
    0 0 0 2px
    rgba(223,135,84,.09);
}

#bas-guide-floating .bas-guide-form button {
  align-self:stretch;

  min-width:62px;

  padding:
    0 12px;

  border:0;
  border-radius:8px;

  background:
    linear-gradient(
      135deg,
      #ed974f 0%,
      #da773d 100%
    );

  color:#fff;

  cursor:pointer;

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

#bas-guide-floating .bas-guide-form button:disabled {
  cursor:default;
  opacity:.55;
}

#bas-guide-floating .bas-guide-caution {
  flex:0 0 auto;

  margin:0;

  padding:
    0 12px 10px;

  color:#a0958e;

  background:#fff;

  font-size:7.5px;
  line-height:1.5;
}

/* Existing reservation/LINE floating CTAとの重なり回避 */
@media screen and (max-width:900px) and (min-width:701px) {
  #bas-guide-floating {
    right:16px;
    bottom:16px;
  }

  #bas-guide-floating.is-raised {
    bottom:285px;
  }
}

@media screen and (max-width:700px) {
  #bas-guide-floating {
    right:10px;

    bottom:
      calc(
        215px + env(safe-area-inset-bottom)
      );
  }

  #bas-guide-floating.is-raised {
    bottom:
      calc(
        215px + env(safe-area-inset-bottom)
      );
  }

  #bas-guide-floating .bas-guide-launcher {
    min-width:116px;
    min-height:48px;

    padding:
      6px 12px 6px 7px;
  }

  #bas-guide-floating .bas-guide-launcher-icon {
    width:34px;
    height:34px;

    font-size:10px;
  }

  #bas-guide-floating .bas-guide-launcher-copy small {
    font-size:7px;
  }

  #bas-guide-floating .bas-guide-launcher-copy strong {
    font-size:10.5px;
  }

  #bas-guide-floating .bas-guide-panel {
    /*
      スマホでは画面幅いっぱいに表示。
      入力時にSafariが狭いパネルへ寄せて見せる挙動も抑えやすくします。
    */
    left:0;
    right:0;
    bottom:0;

    width:100vw;
    max-width:100vw;

    height:76vh;
    height:76dvh;
    max-height:calc(100dvh - 8px);

    border-left:0;
    border-right:0;
    border-bottom:0;
    border-radius:16px 16px 0 0;

    transform-origin:center bottom;
  }

  #bas-guide-floating .bas-guide-panel-head {
    min-height:63px;

    padding:
      12px 13px 11px 15px;
  }

  #bas-guide-floating .bas-guide-panel-head strong {
    font-size:12px;
  }

  #bas-guide-floating .bas-guide-panel-intro {
    padding:
      11px 12px;
  }

  #bas-guide-floating .bas-guide-panel-intro > p {
    font-size:8.5px;
  }

  #bas-guide-floating .bas-guide-suggestions {
    gap:5px;
  }

  #bas-guide-floating .bas-guide-suggestions button {
    min-height:34px;

    padding:
      6px 7px;

    font-size:8px;
  }

  #bas-guide-floating .bas-guide-log {
    padding:
      12px 11px 4px;
  }

  #bas-guide-floating .bas-guide-msg {
    max-width:91%;

    padding:
      9px 10px;

    font-size:9.5px;
  }

  #bas-guide-floating .bas-guide-form {
    gap:6px;

    padding:
      9px;
  }

  #bas-guide-floating .bas-guide-form textarea {
    min-height:48px;

    /*
      iPhone / iPad Safariは16px未満のフォームをフォーカスすると
      自動ズームするため、スマホ時は16px以上を固定します。
    */
    font-size:16px !important;
    line-height:1.45;

    -webkit-text-size-adjust:100%;
    touch-action:manipulation;
  }

  #bas-guide-floating .bas-guide-form button {
    min-width:56px;

    font-size:9px;
  }
}

@media screen and (max-width:390px) {
  #bas-guide-floating {
    right:5px;
  }

  /* パネルは390px以下でも常に全画面幅を維持 */
  #bas-guide-floating .bas-guide-panel {
    left:0;
    right:0;
    width:100vw;
    max-width:100vw;
  }
}

/* =========================================================
   API-FREE GUIDE ACTION LINKS
========================================================= */
#bas-guide-floating .bas-guide-actions {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin:2px 0 12px;
}

#bas-guide-floating .bas-guide-action {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:34px;
  padding:7px 11px;
  border:1px solid rgba(223,135,84,.42);
  border-radius:999px;
  background:#fff;
  color:var(--bas-guide-orange-dark);
  text-decoration:none !important;
  font-size:9px;
  font-weight:700;
  line-height:1.3;
}

#bas-guide-floating .bas-guide-action:hover {
  background:var(--bas-guide-cream);
}

@media screen and (max-width:700px) {
  #bas-guide-floating .bas-guide-action {
    min-height:32px;
    padding:6px 9px;
    font-size:8.5px;
  }
}

/* =========================================================
   v0.5.0 Groq AI status
========================================================= */
#bas-guide-floating .bas-guide-thinking {
  opacity:.78;
}

#bas-guide-floating .bas-guide-form button:disabled {
  cursor:wait;
  opacity:.55;
}
