/* =========================================================
   ALLINFOWORLD119 · FINANCE GLOSSARY V2
   - 전문용어 최초 1회 자동설명
   - 우측 고정 금융용어 검색
   - 자동완성
========================================================= */

/* ---------------------------------------------------------
   1. 본문 자동 용어 표시
--------------------------------------------------------- */
.aiw-glossary-term{
  display:inline;
  padding:0;
  border:0;
  border-bottom:1px dotted #7f9fbe;
  background:transparent;
  color:inherit;
  font:inherit;
  line-height:inherit;
  cursor:help;
  text-decoration:none!important;
  text-underline-offset:2px;
}

.aiw-glossary-term:hover,
.aiw-glossary-term:focus{
  color:#1f5f9f;
  border-bottom-color:#2d6aa8;
  outline:none;
}

.aiw-glossary-term::after{
  content:"ⓘ";
  display:inline;
  margin-left:2px;
  color:#7195b8;
  font-size:.72em;
  vertical-align:.09em;
}

/* ---------------------------------------------------------
   2. 자동 용어 클릭 설명 팝오버
--------------------------------------------------------- */
.aiw-glossary-popover{
  position:fixed;
  z-index:1000001;
  width:min(370px,calc(100vw - 28px));
  max-height:min(540px,calc(100vh - 32px));
  overflow:auto;
  padding:18px;
  border:1px solid #dbe5ef;
  border-radius:16px;
  background:#fff;
  box-shadow:0 22px 70px rgba(16,42,67,.20);
  color:#26384f;
  opacity:0;
  transform:translateY(5px);
  pointer-events:none;
  transition:opacity .14s ease,transform .14s ease;
}

.aiw-glossary-popover.is-open{
  opacity:1;
  transform:translateY(0);
  pointer-events:auto;
}

.aiw-glossary-popover-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
}

.aiw-glossary-popover-label{
  color:#2d6aa8;
  font-size:9.5px;
  line-height:1.3;
  font-weight:900;
  letter-spacing:.12em;
}

.aiw-glossary-popover h4,
.aiw-glossary-result h4{
  margin:4px 0 0;
  color:#12243a;
  font-size:19px;
  line-height:1.35;
  font-weight:900;
  letter-spacing:-.035em;
}

.aiw-glossary-close{
  display:grid;
  place-items:center;
  flex:0 0 30px;
  width:30px;
  height:30px;
  padding:0;
  border:1px solid #e2e8ef;
  border-radius:9px;
  background:#fff;
  color:#748396;
  font-size:18px;
  line-height:1;
  cursor:pointer;
}

.aiw-glossary-equivalent{
  margin-top:9px;
  padding:9px 11px;
  border-radius:10px;
  background:#f4f8fc;
  color:#45627e;
  font-size:10.5px;
  line-height:1.55;
  word-break:keep-all;
}

.aiw-glossary-block{
  margin-top:15px;
}

.aiw-glossary-block strong{
  display:block;
  margin-bottom:5px;
  color:#334a62;
  font-size:10px;
  font-weight:900;
  letter-spacing:.03em;
}

.aiw-glossary-block p{
  margin:0;
  color:#52647a;
  font-size:12.5px;
  line-height:1.72;
  word-break:keep-all;
}

.aiw-glossary-example{
  padding:11px 12px;
  border-left:3px solid #9dc1e3;
  border-radius:0 9px 9px 0;
  background:#f8fafc;
}

/* ---------------------------------------------------------
   3. 스크롤을 따라다니는 금융용어 검색 버튼
   position:fixed = 페이지 스크롤과 무관하게 같은 화면 위치 유지
--------------------------------------------------------- */
.aiw-glossary-fab{
  position:fixed;
  z-index:999996;
  right:22px;
  bottom:188px;
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:44px;
  padding:0 15px;
  border:1px solid rgba(255,255,255,.18);
  border-radius:999px;
  background:#173b73;
  color:#fff;
  box-shadow:0 12px 30px rgba(23,59,115,.25);
  font-family:inherit;
  font-size:11.5px;
  font-weight:850;
  letter-spacing:-.01em;
  cursor:pointer;
  transition:transform .16s ease,box-shadow .16s ease,background .16s ease;
}

.aiw-glossary-fab:hover{
  transform:translateY(-2px);
  background:#204a84;
  box-shadow:0 16px 34px rgba(23,59,115,.29);
}

.aiw-glossary-fab-icon{
  display:grid;
  place-items:center;
  width:23px;
  height:23px;
  border-radius:50%;
  background:rgba(255,255,255,.11);
  font-size:14px;
  line-height:1;
}

/* ---------------------------------------------------------
   4. 검색창
--------------------------------------------------------- */
.aiw-glossary-search-panel{
  position:fixed;
  z-index:1000000;
  right:22px;
  bottom:241px;
  display:none;
  width:min(410px,calc(100vw - 30px));
  max-height:min(640px,calc(100vh - 170px));
  overflow:visible;
  border:1px solid #dbe5ef;
  border-radius:18px;
  background:#fff;
  box-shadow:0 24px 80px rgba(16,42,67,.23);
  color:#26384f;
}

.aiw-glossary-search-panel.is-open{
  display:block;
}

.aiw-glossary-search-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:15px;
  padding:17px 17px 12px;
}

.aiw-glossary-search-kicker{
  display:block;
  color:#2d6aa8;
  font-size:9.5px;
  font-weight:900;
  letter-spacing:.12em;
}

.aiw-glossary-search-title{
  display:block;
  margin-top:4px;
  color:#172b44;
  font-size:17px;
  line-height:1.4;
  font-weight:900;
  letter-spacing:-.035em;
}

.aiw-glossary-search-desc{
  margin:4px 0 0;
  color:#7c8898;
  font-size:10.5px;
  line-height:1.5;
}

.aiw-glossary-search-box{
  position:relative;
  padding:0 17px;
}

.aiw-glossary-search-input-wrap{
  display:flex;
  align-items:center;
  gap:8px;
  min-height:46px;
  padding:0 11px 0 13px;
  border:1px solid #cfdce8;
  border-radius:12px;
  background:#fff;
  transition:border-color .15s ease,box-shadow .15s ease;
}

.aiw-glossary-search-input-wrap:focus-within{
  border-color:#7ea7ce;
  box-shadow:0 0 0 3px rgba(45,106,168,.09);
}

.aiw-glossary-search-input{
  min-width:0;
  width:100%;
  height:44px;
  padding:0;
  border:0!important;
  outline:0!important;
  background:transparent!important;
  color:#172b44!important;
  box-shadow:none!important;
  font-family:inherit!important;
  font-size:14px!important;
  font-weight:720!important;
}

.aiw-glossary-search-input::placeholder{
  color:#9aa6b4;
  font-weight:550;
}

.aiw-glossary-search-submit{
  flex:0 0 auto;
  min-width:54px;
  height:32px;
  padding:0 10px;
  border:0;
  border-radius:9px;
  background:#173b73;
  color:#fff;
  font-size:10.5px;
  font-weight:850;
  cursor:pointer;
}

.aiw-glossary-search-status{
  min-height:22px;
  padding:7px 2px 0;
  color:#8996a6;
  font-size:9.5px;
  line-height:1.4;
}

/* ---------------------------------------------------------
   5. 자동완성
--------------------------------------------------------- */
.aiw-glossary-autocomplete{
  position:absolute;
  z-index:3;
  top:51px;
  left:17px;
  right:17px;
  display:none;
  max-height:305px;
  overflow:auto;
  padding:6px;
  border:1px solid #dbe4ed;
  border-radius:12px;
  background:#fff;
  box-shadow:0 14px 35px rgba(16,42,67,.16);
}

.aiw-glossary-autocomplete.is-open{
  display:block;
}

.aiw-glossary-auto-item{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:12px;
  width:100%;
  padding:10px 10px;
  border:0;
  border-radius:9px;
  background:transparent;
  color:#334a62;
  text-align:left;
  cursor:pointer;
}

.aiw-glossary-auto-item:hover,
.aiw-glossary-auto-item.is-active{
  background:#f2f7fb;
}

.aiw-glossary-auto-main{
  min-width:0;
}

.aiw-glossary-auto-term{
  display:block;
  overflow:hidden;
  color:#1e344c;
  font-size:11.5px;
  line-height:1.4;
  font-weight:850;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.aiw-glossary-auto-alias{
  display:block;
  margin-top:2px;
  overflow:hidden;
  color:#8b98a8;
  font-size:9.5px;
  line-height:1.35;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.aiw-glossary-auto-type{
  align-self:center;
  color:#6c87a2;
  font-size:9px;
  font-weight:800;
  white-space:nowrap;
}

/* ---------------------------------------------------------
   6. 검색 결과
--------------------------------------------------------- */
.aiw-glossary-search-content{
  max-height:min(420px,calc(100vh - 315px));
  overflow:auto;
  padding:13px 17px 18px;
}

.aiw-glossary-result{
  padding-top:2px;
}

.aiw-glossary-result-label{
  color:#2d6aa8;
  font-size:9.5px;
  font-weight:900;
  letter-spacing:.1em;
}

.aiw-glossary-not-found{
  padding:13px;
  border:1px dashed #d5e0ea;
  border-radius:11px;
  background:#fbfcfd;
  color:#728196;
  font-size:11.5px;
  line-height:1.65;
}

.aiw-glossary-suggestion{
  margin-top:12px;
}

.aiw-glossary-suggestion-label{
  display:block;
  margin-bottom:7px;
  color:#7d8a9b;
  font-size:9.5px;
  font-weight:850;
}

.aiw-glossary-suggestion button{
  display:block;
  width:100%;
  margin-top:6px;
  padding:9px 10px;
  border:1px solid #e0e7ee;
  border-radius:9px;
  background:#fff;
  color:#30465e;
  font-size:11px;
  font-weight:750;
  text-align:left;
  cursor:pointer;
}

.aiw-glossary-suggestion button:hover{
  border-color:#bdd0e2;
  background:#f7fafc;
}

/* 티스토리 기본 버튼 스타일 충돌 방지 */
.aiw-glossary-fab,
.aiw-glossary-close,
.aiw-glossary-search-submit,
.aiw-glossary-auto-item,
.aiw-glossary-suggestion button,
.aiw-glossary-term{
  -webkit-appearance:none;
  appearance:none;
}

/* ---------------------------------------------------------
   7. Mobile
--------------------------------------------------------- */
@media (max-width:640px){
  .aiw-glossary-fab{
    right:14px;
    bottom:170px;
    min-height:42px;
    padding:0 13px;
  }

  .aiw-glossary-search-panel{
    left:10px;
    right:10px;
    bottom:222px;
    width:auto;
    max-height:calc(100vh - 150px);
    border-radius:17px;
  }

  .aiw-glossary-search-content{
    max-height:calc(100vh - 330px);
  }

  .aiw-glossary-popover{
    left:12px!important;
    right:12px!important;
    bottom:12px!important;
    top:auto!important;
    width:auto;
    max-height:62vh;
    padding:17px;
    border-radius:17px;
  }
}
/* FLOATING UI STACK V2.4 */
@media (min-width:641px){
  .aiw-glossary-fab{bottom:188px!important;}
  .aiw-glossary-search-panel{bottom:241px!important;}
}
@media (max-width:640px){
  .aiw-glossary-fab{bottom:170px!important;}
  .aiw-glossary-search-panel{bottom:222px!important;}
}
/* =========================================================
   V2.8 · MOBILE GLOSSARY SAFE AREA
========================================================= */
@media (max-width:640px){
  .aiw-glossary-fab{
    right:max(14px,env(safe-area-inset-right))!important;
  }

  .aiw-glossary-search-panel{
    left:max(10px,env(safe-area-inset-left))!important;
    right:max(10px,env(safe-area-inset-right))!important;
    width:auto!important;
    max-width:none!important;
  }
}
