/* =========================================
   CHAT WITH KOBI (js/kobi-chat.js)
   ========================================= */

.kobi-chat-launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 18px 6px 6px;
    border: 2px solid #215437;
    border-radius: 9999px;
    background: #fdf8f0;
    color: #215437;
    font-family: 'Lora', Georgia, serif;
    font-size: 15px;
    font-weight: 800;
    box-shadow: 0 10px 28px rgba(33, 84, 55, 0.22);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.kobi-chat-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(33, 84, 55, 0.28);
}
.kobi-chat-launcher img {
    width: 48px;
    height: 48px;
    border-radius: 9999px;
    background: #e6f3e9;
    object-fit: contain;
}
.kobi-chat-launcher-open .kobi-chat-launcher-label { display: none; }
.kobi-chat-launcher-open { padding: 6px; }

.kobi-chat-panel {
    position: fixed;
    right: 20px;
    bottom: 92px;
    z-index: 95;
    display: flex;
    flex-direction: column;
    width: 370px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 120px);
    max-height: calc(100dvh - 120px);
    overflow: hidden;
    border: 2px solid #ebd3b4;
    border-radius: 28px;
    background: #fdf8f0;
    box-shadow: 0 24px 60px rgba(33, 84, 55, 0.25);
    font-family: 'Lora', Georgia, serif;
    color: #1d3326;
}
.kobi-chat-panel[hidden] { display: none; }

.kobi-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #215437;
    color: #ffffff;
}
.kobi-chat-header img {
    width: 42px;
    height: 42px;
    border-radius: 9999px;
    background: #f7e7ce;
    object-fit: contain;
}
.kobi-chat-header-text { flex: 1; min-width: 0; }
.kobi-chat-title {
    margin: 0;
    font-family: 'Merriweather', serif;
    font-size: 17px;
    font-weight: 900;
}
.kobi-chat-subtitle {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    color: #e6f3e9;
}
.kobi-chat-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 9999px;
    background: transparent;
    color: #ffffff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}
.kobi-chat-close:hover { background: rgba(255, 255, 255, 0.15); }

.kobi-chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px 8px;
    background: #f7e7ce;
}
.kobi-chat-row {
    display: flex;
    margin-bottom: 10px;
}
.kobi-chat-row-user { justify-content: flex-end; }
.kobi-chat-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.kobi-chat-row-assistant .kobi-chat-bubble {
    background: #ffffff;
    border: 1px solid #ebd3b4;
    border-bottom-left-radius: 6px;
    color: #1d3326;
}
.kobi-chat-row-user .kobi-chat-bubble {
    background: #215437;
    border-bottom-right-radius: 6px;
    color: #ffffff;
}
.kobi-chat-error .kobi-chat-bubble {
    background: #fff4ec;
    border-color: #f0c9a8;
}

.kobi-chat-typing .kobi-chat-bubble {
    display: flex;
    gap: 4px;
    padding: 14px 16px;
}
.kobi-chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 9999px;
    background: #88d49e;
    animation: kobi-chat-dot 1s ease-in-out infinite;
}
.kobi-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.kobi-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes kobi-chat-dot {
    0%, 100% { opacity: 0.35; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-3px); }
}

.kobi-chat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 14px 0;
    background: #f7e7ce;
}
.kobi-chat-chips[hidden] { display: none; }
.kobi-chat-chip {
    padding: 7px 12px;
    border: 1px solid #88d49e;
    border-radius: 9999px;
    background: #e6f3e9;
    color: #215437;
    font-family: 'Lora', Georgia, serif;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.kobi-chat-chip:hover { background: #88d49e; }

.kobi-chat-form {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #ebd3b4;
    background: #fdf8f0;
}
.kobi-chat-input {
    flex: 1;
    min-height: 42px;
    max-height: 110px;
    padding: 10px 12px;
    border: 1px solid #ebd3b4;
    border-radius: 14px;
    background: #ffffff;
    color: #1d3326;
    font-family: 'Lora', Georgia, serif;
    font-size: 16px; /* 16px stops iPhones from zooming in */
    font-weight: 600;
    resize: none;
}
.kobi-chat-input:focus {
    outline: none;
    border-color: #215437;
}
.kobi-chat-send {
    padding: 0 16px;
    border: 0;
    border-radius: 9999px;
    background: #88d49e;
    color: #215437;
    font-family: 'Lora', Georgia, serif;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}
.kobi-chat-send:hover { background: #72c489; }
.kobi-chat-send:disabled { opacity: 0.5; cursor: default; }

.kobi-chat-note {
    margin: 0;
    padding: 0 14px 10px;
    background: #fdf8f0;
    color: #4b5f52;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

@media (max-width: 480px) {
    .kobi-chat-launcher { right: 14px; bottom: 14px; }
    .kobi-chat-panel {
        right: 8px;
        left: 8px;
        bottom: 80px;
        width: auto;
        max-width: none;
        height: calc(100dvh - 100px);
        max-height: none;
    }
}
