.collinx-chat-wrapper {
    position: relative;
    max-width: 420px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 45px rgba(0,0,0,0.45);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.collinx-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #111827;
}
.collinx-chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
}
.collinx-logo-circle {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    background: linear-gradient(135deg, #6366f1, #14b8a6);
    color: #f9fafb;
}
.collinx-title-text { font-weight: 600; }
.collinx-status { font-size: 11px; opacity: 0.8; }

.collinx-chat-window {
    height: 320px;
    overflow-y: auto;
    padding: 12px 14px;
}

.collinx-message {
    margin-bottom: 10px;
    display: flex;
}
.collinx-message span {
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    max-width: 90%;
}
.collinx-message.user { justify-content: flex-end; }
.collinx-message.user span {
    border-bottom-right-radius: 2px;
}
.collinx-message.ai { justify-content: flex-start; }
.collinx-message.ai span {
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(148, 163, 184, 0.5);
}

.collinx-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid #111827;
}
.collinx-text-input {
    flex: 1;
    border-radius: 999px;
    border: 1px solid #4b5563;
    padding: 8px 12px;
    font-size: 14px;
}
.collinx-mic-btn {
    border-radius: 999px;
    padding: 8px 12px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}
.collinx-footer-hint {
    font-size: 11px;
    padding: 4px 10px 10px;
    opacity: 0.7;
}

/* Floating bubble */
.collinx-floating-bubble {
    position: fixed;
    bottom: 24px;
    right: 22px;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 30%, #4f46e5, #020617);
    color: #f9fafb;
    cursor: pointer;
    z-index: 9999;
}
.collinx-floating-panel {
    position: fixed;
    bottom: 90px;
    right: 22px;
    z-index: 9999;
}

/* Light theme */
.collinx-theme-light {
    background: #ffffff;
    color: #111827;
}
.collinx-theme-light .collinx-chat-window {
    background: #f9fafb;
}
.collinx-theme-light .collinx-message.user span {
    background: #e5f0ff;
    color: #111827;
}
.collinx-theme-light .collinx-message.ai span {
    background: #ffffff;
    color: #111827;
}

/* Dark theme */
.collinx-theme-dark {
    background: #050609;
    color: #f9fafb;
}
.collinx-theme-dark .collinx-chat-header {
    border-bottom-color: #111827;
}
.collinx-theme-dark .collinx-chat-window {
    background: #050609;
}
.collinx-theme-dark .collinx-message.user span {
    background: #1f2933;
    color: #e5e7eb;
}
.collinx-theme-dark .collinx-message.ai span {
    background: #111827;
    color: #f9fafb;
    border: none;
}
.collinx-theme-dark .collinx-text-input {
    background: #0b1017;
    border-color: #1f2933;
    color: #f9fafb;
}
.collinx-theme-dark .collinx-mic-btn {
    background: #6366f1;
    color: #f9fafb;
}

/* Auto theme (follows system) */
@media (prefers-color-scheme: dark) {
    .collinx-theme-auto {
        background: #050609;
        color: #f9fafb;
    }
}


/* Avatar mode layout */

.collinx-chat-wrapper {
    max-width: 440px;
}

.collinx-chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.collinx-logo-circle {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    overflow: hidden;
}

.collinx-logo-initial {
    z-index: 1;
}

.collinx-logo-avatar {
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    opacity: 0.0; /* subtle overlay; kept for future use */
}

.collinx-title-stack {
    display: flex;
    flex-direction: column;
}

.collinx-mode-label {
    font-size: 11px;
    opacity: 0.75;
}

.collinx-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.collinx-mode-toggle {
    background: #111827;
    border-radius: 999px;
    padding: 2px;
    display: inline-flex;
    align-items: center;
}

.collinx-mode-btn {
    border: none;
    background: transparent;
    color: #e5e7eb;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 999px;
    cursor: pointer;
}

.collinx-mode-btn-active {
    background: #2563eb;
    color: #fff;
}

.collinx-avatar-panel {
    background: #020617;
    padding: 12px;
}

.collinx-avatar-frame {
    width: 100%;
    aspect-ratio: 4 / 5;
    border-radius: 16px;
    overflow: hidden;
    background: #020617;
}

.collinx-avatar-frame iframe {
    width: 100%;
    height: 100%;
    border: none;
}

#collinx-text-panel {
    padding-top: 4px;
}

/* Small tweak so footer hint doesn't double-stack badly */
#collinx-text-panel .collinx-footer-hint {
    margin-top: 4px;
}
