/* ── Hana Chat Widget ────────────────────────────────────────────────────── */

/* Floating button */
.hana-bubble {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9500;
}

.hana-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #064e3b, #059669);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(5, 150, 105, 0.45);
    animation: hana-bob 3.5s ease-in-out infinite;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1px;
}

.hana-btn .hana-icon-cat {
    font-size: 1.6rem;
    color: white;
    line-height: 1;
}

.hana-btn .hana-icon-label {
    font-size: 0.5rem;
    color: rgba(255,255,255,0.85);
    font-weight: 700;
    letter-spacing: 0.05em;
    font-family: 'Inter', sans-serif;
    line-height: 1;
}

.hana-btn:hover {
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 8px 28px rgba(5, 150, 105, 0.55);
    animation-play-state: paused;
}

.hana-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    background: #22c55e;
    border-radius: 50%;
    border: 2.5px solid white;
    animation: hana-pulse 2.2s ease-in-out infinite;
}

@keyframes hana-bob {
    0%, 100% { transform: translateY(0); }
    45%       { transform: translateY(-7px); }
}

@keyframes hana-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
    50%       { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
}

/* Chat window */
.hana-window {
    position: fixed;
    bottom: 5.75rem;
    right: 1.5rem;
    width: 348px;
    max-height: 500px;
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9400;
    transform-origin: bottom right;
    transform: scale(0.75) translateY(16px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.25s ease;
}

.hana-window.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* Header */
.hana-header {
    background: linear-gradient(135deg, #064e3b 0%, #059669 100%);
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.hana-header-avatar-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
}

.hana-header-info { flex: 1; }
.hana-header-name   { color: white; font-weight: 700; font-size: 0.95rem; line-height: 1.2; }
.hana-header-status { color: rgba(255,255,255,0.75); font-size: 0.72rem; display: flex; align-items: center; gap: 0.3rem; }
.hana-header-status::before { content: '●'; color: #4ade80; font-size: 0.6rem; }

.hana-close {
    background: rgba(255,255,255,0.12);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    transition: background 0.2s;
    flex-shrink: 0;
}

.hana-close:hover { background: rgba(255,255,255,0.22); }

/* Messages */
.hana-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #f8fafc;
    scroll-behavior: smooth;
}

.hana-messages::-webkit-scrollbar { width: 4px; }
.hana-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.hana-msg {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    animation: msgIn 0.25s ease;
}

@keyframes msgIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hana-msg.user { flex-direction: row-reverse; }

.msg-avatar-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #064e3b, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: white;
    flex-shrink: 0;
}

.msg-bubble {
    max-width: 78%;
    padding: 0.625rem 0.875rem;
    border-radius: 1.1rem;
    font-size: 0.875rem;
    line-height: 1.55;
}

.hana-msg.bot  .msg-bubble {
    background: white;
    color: #1e293b;
    border-bottom-left-radius: 0.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.hana-msg.user .msg-bubble {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

/* Quick chips (initial) */
.hana-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.625rem;
}

.chip {
    background: rgba(5,150,105,0.08);
    color: #059669;
    border: 1px solid rgba(5,150,105,0.2);
    border-radius: 2rem;
    padding: 0.3rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.chip:hover { background: #059669; color: white; border-color: #059669; }

/* Action buttons inside messages */
.hana-actions {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-top: 0.625rem;
}

.hana-action-btn {
    display: block;
    text-align: center;
    background: rgba(5,150,105,0.08);
    color: #059669;
    border: 1px solid rgba(5,150,105,0.25);
    border-radius: 0.625rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.hana-action-btn:hover { background: #059669; color: white; }

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.75rem 1rem !important;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing-dot 1.2s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%           { transform: translateY(-5px); opacity: 1; }
}

/* Input area */
.hana-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid #e2e8f0;
    background: white;
    flex-shrink: 0;
}

.hana-input-wrap input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 2rem;
    padding: 0.55rem 1rem;
    font-family: inherit;
    font-size: 0.875rem;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s;
}

.hana-input-wrap input:focus { border-color: #059669; }

.hana-send {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: all 0.2s;
}

.hana-send:hover   { transform: scale(1.1); }
.hana-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Mobile */
@media (max-width: 420px) {
    .hana-window {
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
        bottom: 5.25rem;
    }
}
