/* ============================================================
   Bono-AI Widget Styles
   우측 하단 플로팅 버튼 + 대화창 패널
   ============================================================ */

/* ── FAB (Floating Action Button) ── */
#bonoAiFab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00c4a0 0%, #0099e0 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 196, 160, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-size: 22px;
    color: #fff;
    user-select: none;
}
#bonoAiFab:hover {
    transform: scale(1.12);
    box-shadow: 0 6px 28px rgba(0, 196, 160, 0.6);
}
#bonoAiFab.active {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff4757 100%);
    box-shadow: 0 4px 20px rgba(255, 71, 87, 0.45);
}

/* ── Chat Panel ── */
#bonoAiPanel {
    position: fixed;
    bottom: 92px;
    right: 28px;
    width: 380px;
    max-width: calc(100vw - 48px);
    background: #1a1d26;
    border: 1px solid #2e3347;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
    z-index: 8999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}
#bonoAiPanel.hidden {
    transform: scale(0.85);
    opacity: 0;
    pointer-events: none;
}

/* ── Panel Header ── */
.bono-ai-header {
    background: linear-gradient(135deg, #00c4a0 0%, #0099e0 100%);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.bono-ai-header-title {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.5px;
}
.bono-ai-header-sub {
    font-size: 10px;
    color: rgba(255,255,255,0.75);
    margin-left: auto;
}

/* ── Chat Body (messages) ── */
.bono-ai-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    min-height: 240px;
    max-height: 420px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.bono-ai-body::-webkit-scrollbar { width: 4px; }
.bono-ai-body::-webkit-scrollbar-thumb { background: #2e3347; border-radius: 2px; }

/* ── Message Bubbles ── */
.bono-msg {
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: bonoFadeIn 0.3s ease;
}
@keyframes bonoFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.bono-msg-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #5a6278;
    text-transform: uppercase;
}
.bono-msg.ai .bono-msg-label { color: #00c4a0; }
.bono-msg.user .bono-msg-label { color: #0099e0; text-align: right; }

.bono-msg-bubble {
    background: #22263a;
    border-radius: 12px 12px 12px 4px;
    padding: 11px 14px;
    font-size: 12.5px;
    line-height: 1.65;
    color: #c8cedd;
    white-space: pre-wrap;
    word-break: break-word;
}
.bono-msg.user .bono-msg-bubble {
    background: #1a3a5c;
    border-radius: 12px 12px 4px 12px;
    text-align: right;
    color: #e0eeff;
}

/* ── Grade Badge ── */
.bono-grade-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 6px;
}
.bono-grade-badge.safe    { background: rgba(0,196,160,0.15); color: #00c4a0; }
.bono-grade-badge.warning { background: rgba(255,193,7,0.15);  color: #ffc107; }
.bono-grade-badge.danger  { background: rgba(255,71,87,0.15);  color: #ff4757; }
.bono-grade-badge.unknown { background: rgba(140,147,163,0.18); color: #8c93a3; }
.bono-quality { font-size: 10px; color: #8c93a3; margin: 6px 0 4px; }
.bono-reasons { margin-top: 8px; font-size: 11px; color: #d0d6e4; line-height: 1.45; }
.bono-reason { margin: 2px 0; }
.bono-thesis { margin-top: 10px; padding-top: 8px; border-top: 1px dashed #2e3347; }
.bono-thesis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bono-thesis-col { background: #12141c; border: 1px solid #2a2e3e; border-radius: 8px; padding: 8px; }
.bono-thesis-head { font-size: 11px; font-weight: 800; color: #c8cedd; margin-bottom: 6px; }
.bono-thesis-row { font-size: 11px; line-height: 1.4; color: #c8cedd; margin: 4px 0; }
.bono-thesis-mark {
    display: inline-block;
    min-width: 32px;
    margin-right: 4px;
    font-size: 10px;
    font-weight: 800;
}
.bono-thesis-row.valid .bono-thesis-mark { color: #00c4a0; }
.bono-thesis-row.broken .bono-thesis-mark { color: #8c93a3; }
.bono-thesis-row.none .bono-thesis-mark { color: #5c6378; }
.bono-thesis-note { font-size: 11px; color: #8c93a3; margin-top: 8px; line-height: 1.45; }
.bono-score {
    margin: 10px 0 4px;
    padding: 10px;
    border-radius: 10px;
    background: #12141c;
    border: 1px solid #2a2e3e;
}
.bono-score.long { border-color: #00c4a0; }
.bono-score.short { border-color: #ff4757; }
.bono-score.mixed { border-color: #3a4156; }
.bono-score-label { font-size: 13px; font-weight: 800; color: #e8edf7; }
.bono-score-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0 6px;
    background: #2a2e3e;
}
.bono-score-bar .l { background: #00c4a0; }
.bono-score-bar .s { background: #ff4757; }
.bono-score-why { font-size: 10px; color: #8c93a3; line-height: 1.4; margin: 3px 0; }
.bono-score-note { font-size: 10px; color: #6b7388; margin-top: 6px; line-height: 1.4; }
.bono-step-tip { font-size: 11px; color: #ffb4a8; line-height: 1.4; margin: 3px 0; }
.bono-step-row { display: flex; align-items: flex-start; gap: 6px; margin: 4px 0; }
.bono-step-row .bono-step-tip { flex: 1; margin: 0; }
.bono-step-row .bono-scen-btn { flex-shrink: 0; margin-top: 1px; }
.bono-depth-row {
    white-space: pre-wrap;
    display: block;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #2e3347;
    line-height: 1.5;
    color: #c8cedd;
}
.bono-scen-wrap { margin-top: 12px; padding-top: 8px; border-top: 1px solid #2e3347; }
.bono-scen-head { font-size: 11px; font-weight: 700; color: #8c93a3; margin-bottom: 8px; }
.bono-scen-card { background: #12141c; border: 1px solid #2a2e3e; border-radius: 8px; padding: 8px; margin-bottom: 8px; }
.bono-scen-title { font-size: 11px; color: #c8cedd; margin-bottom: 6px; font-weight: 600; }
.bono-scen-btns { display: flex; flex-wrap: wrap; gap: 4px; }
.bono-scen-btn {
    background: #1e2433; color: #d5dbe8; border: 1px solid #3a4156;
    border-radius: 5px; padding: 4px 8px; font-size: 10px; font-weight: 700; cursor: pointer;
}
.bono-scen-btn:hover { border-color: #00c4a0; color: #00c4a0; }
.bono-scen-custom { display: flex; gap: 4px; margin-top: 6px; }
.bono-scen-custom input {
    flex: 1; background: #0a0a10 !important; border: 1px solid #2e3347;
    color: #fff !important; -webkit-text-fill-color: #fff; caret-color: #fff;
    border-radius: 5px; padding: 4px 6px; font-size: 11px; width: 80px;
}

/* ── Market Data Block ── */
.bono-market-block {
    background: #12151f;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 11.5px;
    color: #8b92a8;
    margin-top: 6px;
}
.bono-market-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bono-oi-read { color: #d7deee; font-weight: 600; }

/* ── Typing Indicator ── */
.bono-typing {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 10px 14px;
    background: #22263a;
    border-radius: 12px 12px 12px 4px;
    width: fit-content;
}
.bono-typing span {
    width: 7px;
    height: 7px;
    background: #00c4a0;
    border-radius: 50%;
    animation: bonoTypingBounce 1.2s infinite ease-in-out;
}
.bono-typing span:nth-child(2) { animation-delay: 0.2s; }
.bono-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bonoTypingBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40%           { transform: translateY(-6px); opacity: 1; }
}

/* ── Input Area ── */
.bono-ai-footer {
    border-top: 1px solid #2e3347;
    padding: 12px 14px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.bono-ai-input {
    flex: 1;
    background: #22263a;
    border: 1px solid #2e3347;
    border-radius: 10px;
    padding: 9px 12px;
    color: #d1d4dc;
    font-size: 12.5px;
    resize: none;
    outline: none;
    min-height: 38px;
    max-height: 90px;
    line-height: 1.5;
    transition: border-color 0.2s;
    font-family: 'Inter', sans-serif;
}
.bono-ai-input:focus { border-color: #00c4a0; }
.bono-ai-input::placeholder { color: #4a5068; }

.bono-ai-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00c4a0, #0099e0);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    flex-shrink: 0;
    transition: transform 0.15s, opacity 0.15s;
}
.bono-ai-send-btn:hover { transform: scale(1.1); }
.bono-ai-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ── Analyze Button ── */
.bono-analyze-btn {
    width: 100%;
    padding: 9px;
    border-radius: 8px;
    background: linear-gradient(135deg, #00c4a0, #0099e0);
    border: none;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 8px;
    transition: opacity 0.15s;
    letter-spacing: 0.3px;
}
.bono-analyze-btn:hover { opacity: 0.85; }
.bono-analyze-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Mobile tweaks ── */
@media (max-width: 480px) {
    #bonoAiPanel { width: calc(100vw - 32px); right: 16px; }
    #bonoAiFab   { bottom: 20px; right: 16px; }
}
