:root {
    /* Brand Colors - Light Theme */
    --kairon-primary: #0C1AC1; 
    --kairon-gradient: linear-gradient(135deg, #0C1AC1, #4A148C);
    --kairon-surface: #ffffff;
    --kairon-bg-alt: #f9fafb;
    --white: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-light: rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    margin: 0;
}

/* Main Panel - Solid Light Layout */
#kairon-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    height: 680px;
    max-height: 90vh;
    background: var(--kairon-surface);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.12), 0 0 0 1px var(--border-light);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
    color: var(--text-main);
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;

    /* Animation State (Closed) */
    opacity: 0;
    visibility: hidden;
    transform: translateY(40px) scale(0.95);
    transform-origin: bottom right;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#kairon-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* HEADER - Premium Top */
.panel-header {
    flex-shrink: 0;
    height: 70px;
    background: var(--kairon-gradient);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(12, 26, 193, 0.15);
    z-index: 20;
}

.panel-header::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    animation: shine 4s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    20% { left: 200%; }
    100% { left: 200%; }
}

.panel-header .left-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-header .logo-placeholder {
    width: 36px;
    height: 36px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    overflow: hidden;
}

.panel-header .logo-placeholder img {
    width: 36px; /* Fill the container */
    height: 36px;
    object-fit: cover;
    transform: scale(1.1); /* Match the zoom effect from the launcher button */
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.panel-header .title {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
}

.panel-header .close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.75);
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.panel-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    transform: none;
    box-shadow: none;
}

/* MESSAGES - Scrollable Middle */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #ffffff; /* Clean white canvas */
}

@keyframes slideUpBounce {
    0% { opacity: 0; transform: translateY(20px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Chat Bubbles */
.msg {
    max-width: 82%;
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 14.5px;
    line-height: 1.5;
    position: relative;
    font-weight: 500;
    animation: slideUpBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Bot: Well-defined premium dark gray */
.msg.bot {
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    background: #ccff00; /* Bright Neon Lime */
    border: none; 
    color: #111827; /* Dark text for readability */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); 
}

/* User: Deep Blue Gradient */
.msg.user {
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    background: var(--kairon-gradient);
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px rgba(12, 26, 193, 0.2);
}

.msg.agent {
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.08);
}

.msg.system {
    align-self: center;
    border: none;
    background: #f3f4f6;
    padding: 6px 12px;
    border-radius: 12px;
    color: #6b7280;
    font-size: 11px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* INTERACTIVE AREA */
.interactive-area {
    flex-shrink: 0;
    background: #fafafa;
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10;
}

.kairon-controls {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none; 
    margin: 0 -8px; 
    padding: 0 8px; 
}

.kairon-controls::-webkit-scrollbar {
    display: none;
}

.kairon-categories {
    display: flex;
    gap: 10px;
    padding: 4px 4px 12px 4px; 
}

.kairon-categories button,
.category-chip {
    white-space: nowrap;
    padding: 8px 18px;
    background: #fff;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.kairon-categories button.active,
.kairon-categories button:hover,
.category-chip.active,
.category-chip:hover {
    background: var(--kairon-primary);
    color: #fff;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 16px rgba(12, 26, 193, 0.25);
}

.kairon-categories button:active,
.category-chip:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 2px 6px rgba(12, 26, 193, 0.15);
}

.kairon-browse-all {
    display: none;
}

/* Vertical Suggestions */
.kairon-faq-pane {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 160px; /* Slightly taller to show more options */
    overflow-y: auto;
    padding: 8px 4px; /* extra padding for shadows to not clip */
    margin: -8px -4px; /* offset padding */
    scrollbar-width: none; /* Hide scrollbar completely */
    -ms-overflow-style: none;
}

.kairon-faq-pane::-webkit-scrollbar {
    display: none; /* Hide scrollbar completely */
}

@keyframes slideInRight {
    0% { opacity: 0; transform: translateX(15px); }
    100% { opacity: 1; transform: translateX(0); }
}

.kairon-faq-pane button,
.suggestion-btn {
    width: 100%;
    text-align: left;
    padding: 14px 18px;
    background: #fff;
    border: none;
    border-radius: 14px;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 3px 10px rgba(0,0,0,0.04);
    /* Staggered entry animation */
    animation: slideInRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Staggering up to 6 suggestion items */
.suggestion-btn:nth-child(1) { animation-delay: 0.05s; }
.suggestion-btn:nth-child(2) { animation-delay: 0.10s; }
.suggestion-btn:nth-child(3) { animation-delay: 0.15s; }
.suggestion-btn:nth-child(4) { animation-delay: 0.20s; }
.suggestion-btn:nth-child(5) { animation-delay: 0.25s; }
.suggestion-btn:nth-child(6) { animation-delay: 0.30s; }

.kairon-faq-pane button:hover,
.suggestion-btn:hover {
    background: var(--kairon-primary); 
    color: #fff;
    transform: translateY(-2px); /* Smooth lift up */
    box-shadow: 0 8px 20px rgba(12, 26, 193, 0.25); /* Elegant floating shadow */
}

.kairon-faq-pane button:active,
.suggestion-btn:active {
    transform: translateY(1px); /* Press down effect */
    box-shadow: 0 2px 4px rgba(12, 26, 193, 0.1);
}

/* FOOTER - Composer */
.composer {
    flex-shrink: 0;
    padding: 18px 24px;
    background: #fff;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 14px;
}

.composer input {
    flex: 1;
    border: 2px solid var(--kairon-primary);
    outline: none;
    font-size: 15px;
    color: #111827;
    font-weight: 500;
    background: #fff;
    padding: 14px 20px;
    border-radius: 24px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 8px rgba(12, 26, 193, 0.05);
}

.composer input::placeholder {
    color: #9ca3af;
}

.composer input:focus {
    box-shadow: 0 6px 18px rgba(12, 26, 193, 0.18);
}

.composer button {
    width: 48px;
    height: 48px;
    background: var(--kairon-primary);
    border: none;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(12, 26, 193, 0.25);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.composer button svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    transform: translateX(1px);
    transition: transform 0.3s;
}

.composer button:hover {
    transform: scale(1.1) rotate(-8deg);
    box-shadow: 0 6px 18px rgba(12, 26, 193, 0.35);
    background: #1122eb;
}

.composer button:hover svg {
    transform: translateX(3px) scale(1.1);
}

/* Launcher Button */
#kairon-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 70px;
    height: 70px;
    background: #fff;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0,0,0,0.05);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Added to crop the zoomed image to the circle */
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: float-btn 4s ease-in-out infinite;
}

@keyframes float-btn {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

#kairon-button:hover {
    animation-play-state: paused;
    transform: scale(1.05) rotate(5deg);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

#kairon-button img {
    width: 65px; /* Increased base size */
    height: 65px;
    object-fit: cover;
    transform: scale(1.1); /* Zoom in to crop out empty padding */
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#kairon-button:hover img {
    transform: scale(1.325); /* Slight additional zoom on hover */
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #kairon-panel {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        max-height: 100vh;
        border: none;
    }
}

/* --- Typing & Thinking Animations --- */

.typing-indicator {
    padding: 14px 18px;
    background: #ccff00;
    border-radius: 20px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    width: fit-content;
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    animation: slideUpBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.typing-dots {
    display: flex;
    gap: 5px;
    align-items: center;
    height: 16px;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    background-color: #111827;
    border-radius: 50%;
    display: inline-block;
    animation: typing-dot 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-dot {
    0%, 80%, 100% { 
        transform: scale(0.6); 
        opacity: 0.4; 
    }
    40% { 
        transform: scale(1.2); 
        opacity: 1; 
    }
}

/* Typewriter Cursor */
.typewriter-cursor::after {
    content: '|';
    animation: blink 1s infinite;
    margin-left: 3px;
    color: var(--kairon-primary);
    font-weight: 800;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
