/* Tanj AI Assistant — Brand colours from logo: yellow #F5D000 / gold, black, white */
#tanj-ai-root {
    --tanj-yellow: #F5D000;
    --tanj-yellow-dark: #D4B000;
    --tanj-black: #0a0a0a;
    --tanj-grey: #1a1a1a;
    --tanj-white: #ffffff;
    --tanj-text: #222222;
    position: fixed;
    bottom: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}
.tanj-ai-right { right: 20px; }
.tanj-ai-left  { left: 20px; }

/* ===== Floating avatar button ===== */
.tanj-ai-toggle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--tanj-black);
    border: 3px solid var(--tanj-yellow);
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(245, 208, 0, 0.45), 0 2px 8px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0;
    overflow: visible;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.tanj-ai-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(245, 208, 0, 0.55), 0 4px 12px rgba(0,0,0,0.35);
}
.tanj-ai-avatar-wrap {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(145deg, #2a2a2a, #111);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.tanj-ai-avatar-wrap svg {
    width: 58px;
    height: 58px;
}
/* Pulse ring */
.tanj-ai-pulse {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid var(--tanj-yellow);
    animation: tanjPulse 2.2s ease-out infinite;
    pointer-events: none;
}
@keyframes tanjPulse {
    0%   { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.35); opacity: 0; }
}
/* Wave hand animation on avatar */
.tanj-wave {
    transform-origin: 70% 70%;
    animation: tanjWave 1.2s ease-in-out infinite;
}
@keyframes tanjWave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(18deg); }
    50% { transform: rotate(-8deg); }
    75% { transform: rotate(14deg); }
}

/* Intro bubble (after 5s) */
.tanj-ai-intro {
    position: absolute;
    bottom: 85px;
    width: 260px;
    background: var(--tanj-black);
    color: var(--tanj-white);
    border: 2px solid var(--tanj-yellow);
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    animation: tanjSlideUp 0.35s ease;
    display: none;
}
.tanj-ai-right .tanj-ai-intro { right: 0; }
.tanj-ai-left  .tanj-ai-intro { left: 0; }
.tanj-ai-intro.visible { display: block; }
.tanj-ai-intro p {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.4;
}
.tanj-ai-intro-name {
    color: var(--tanj-yellow);
    font-weight: 700;
}
.tanj-ai-intro-btns {
    display: flex;
    gap: 8px;
}
.tanj-ai-intro-btns button {
    flex: 1;
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.tanj-btn-primary {
    background: var(--tanj-yellow);
    color: var(--tanj-black);
}
.tanj-btn-ghost {
    background: transparent;
    color: #ccc;
    border: 1px solid #444 !important;
}

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

/* ===== Chat window ===== */
.tanj-ai-window {
    position: absolute;
    bottom: 90px;
    width: 370px;
    max-width: calc(100vw - 28px);
    height: 520px;
    max-height: 75vh;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.28);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 2px solid var(--tanj-yellow);
    animation: tanjSlideUp 0.3s ease;
}
.tanj-ai-right .tanj-ai-window { right: 0; }
.tanj-ai-left  .tanj-ai-window { left: 0; }

.tanj-ai-header {
    background: linear-gradient(135deg, #111 0%, #1a1a1a 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid var(--tanj-yellow);
}
.tanj-ai-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.tanj-ai-header-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #222;
    border: 2px solid var(--tanj-yellow);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tanj-ai-header-avatar svg { width: 40px; height: 40px; }
.tanj-ai-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--tanj-yellow);
}
.tanj-ai-status {
    font-size: 12px;
    color: #aaa;
}
.tanj-ai-status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    margin-right: 6px;
}
.tanj-ai-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
}
.tanj-ai-close-btn:hover { opacity: 1; color: var(--tanj-yellow); }

/* Lead form */
.tanj-ai-lead {
    flex: 1;
    overflow-y: auto;
    padding: 20px 18px;
    background: #fafafa;
}
.tanj-ai-lead h3 {
    margin: 0 0 6px;
    font-size: 17px;
    color: #111;
}
.tanj-ai-lead .sub {
    margin: 0 0 18px;
    font-size: 13px;
    color: #666;
}
.tanj-field {
    margin-bottom: 14px;
}
.tanj-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #444;
    margin-bottom: 5px;
}
.tanj-field input {
    width: 100%;
    box-sizing: border-box;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}
.tanj-field input:focus {
    border-color: var(--tanj-yellow);
}
.tanj-lead-submit {
    width: 100%;
    margin-top: 8px;
    background: var(--tanj-yellow);
    color: #111;
    border: none;
    border-radius: 10px;
    padding: 13px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.tanj-lead-submit:hover { background: var(--tanj-yellow-dark); }
.tanj-lead-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.tanj-lead-error {
    color: #c0392b;
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

/* Messages */
.tanj-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f5f5f5;
    display: none;
    flex-direction: column;
    gap: 10px;
}
.tanj-ai-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
}
.tanj-ai-msg.bot {
    background: #fff;
    color: #222;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-left: 3px solid var(--tanj-yellow);
}
.tanj-ai-msg.user {
    background: var(--tanj-black);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    border-right: 3px solid var(--tanj-yellow);
}
.tanj-ai-msg.typing { color: #888; font-style: italic; }

/* Input */
.tanj-ai-input-area {
    display: none;
    padding: 10px 12px;
    border-top: 1px solid #e5e5e5;
    background: #fff;
    gap: 8px;
}
.tanj-ai-input-area.active { display: flex; }
#tanj-ai-input {
    flex: 1;
    border: 1.5px solid #ddd;
    border-radius: 22px;
    padding: 11px 16px;
    font-size: 14px;
    outline: none;
}
#tanj-ai-input:focus { border-color: var(--tanj-yellow); }
#tanj-ai-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--tanj-yellow);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
#tanj-ai-send:hover { background: var(--tanj-yellow-dark); }
#tanj-ai-send:disabled { opacity: 0.5; cursor: not-allowed; }
#tanj-ai-send svg { fill: #111; }

@media (max-width: 480px) {
    #tanj-ai-root { bottom: 14px; }
    .tanj-ai-right { right: 12px; }
    .tanj-ai-left  { left: 12px; }
    .tanj-ai-window {
        width: calc(100vw - 20px);
        height: 70vh;
        bottom: 85px;
    }
    .tanj-ai-toggle { width: 64px; height: 64px; }
    .tanj-ai-avatar-wrap { width: 54px; height: 54px; }
    .tanj-ai-intro { width: 230px; bottom: 78px; }
}

.tanj-ai-msg a {
    color: #D4B000 !important;
    text-decoration: underline;
    font-weight: 600;
    word-break: break-all;
}
.tanj-ai-msg a:hover {
    color: #F5D000 !important;
}

