:root {
    --cb-primary: #4f46e5;
    --cb-primary-hover: #4338ca;
    --cb-primary-light: #eef2ff;
    --cb-surface: #ffffff;
    --cb-surface-translucent: rgba(255, 255, 255, 0.92);
    --cb-bg: #f8fafc;
    --cb-text: #0f172a;
    --cb-text-muted: #64748b;
    --cb-border: #e2e8f0;
    --cb-radius: 16px;
    --cb-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --cb-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#course-chatbot {
    font-family: var(--cb-font);
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}

/* Floating Launcher Button */
.cb-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cb-primary), #7c3aed);
    color: #fff;
    border: none;
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.4);
    cursor: pointer;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

.cb-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 14px 20px -3px rgba(79, 70, 229, 0.5);
}

/* Chat Window Container */
.cb-window {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 580px;
    max-height: calc(100vh - 120px);
    background: var(--cb-surface-translucent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--cb-radius);
    box-shadow: var(--cb-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cb-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header & Progress Bar */
.cb-header {
    background: linear-gradient(135deg, var(--cb-primary), #6366f1);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.cb-header-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.cb-header-actions {
    display: flex;
    gap: 8px;
}

.cb-header-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s;
}

.cb-header-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.cb-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #38bdf8;
    width: 0%;
    transition: width 0.35s ease;
}

/* Message Feed */
.cb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--cb-bg);
}

.cb-msg {
    max-width: 82%;
    padding: 10px 14px;
    font-size: 13.5px;
    line-height: 1.45;
    border-radius: 14px;
    animation: fadeInSlide 0.25s ease forwards;
}

.cb-msg.bot {
    align-self: flex-start;
    background: var(--cb-surface);
    color: var(--cb-text);
    border: 1px solid var(--cb-border);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.cb-msg.user {
    align-self: flex-end;
    background: var(--cb-primary);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

/* Option Chips */
.cb-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    animation: fadeInSlide 0.25s ease forwards;
}

.cb-option-btn {
    background: var(--cb-surface);
    color: var(--cb-primary);
    border: 1px solid #cbd5e1;
    padding: 7px 12px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cb-option-btn:hover {
    background: var(--cb-primary-light);
    border-color: var(--cb-primary);
    transform: translateY(-1px);
}

/* Course Cards */
.cb-course-card {
    background: var(--cb-surface);
    border: 1px solid var(--cb-border);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cb-course-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -2px rgba(0, 0, 0, 0.08);
}

.cb-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.cb-card-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--cb-text);
}

.cb-badge {
    background: var(--cb-primary-light);
    color: var(--cb-primary);
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
    text-transform: uppercase;
}

.cb-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    font-size: 12px;
    color: var(--cb-text-muted);
}

.cb-card-grid span {
    color: var(--cb-text);
    font-weight: 500;
}

.cb-card-cta {
    display: inline-block;
    text-align: center;
    background: var(--cb-primary);
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    padding: 7px;
    border-radius: 8px;
    transition: background 0.2s;
    margin-top: 4px;
}

.cb-card-cta:hover {
    background: var(--cb-primary-hover);
}

/* Typing Indicator Animation */
.cb-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.cb-typing span {
    width: 6px;
    height: 6px;
    background: var(--cb-text-muted);
    border-radius: 50%;
    animation: bounce 1.2s infinite ease-in-out;
}

.cb-typing span:nth-child(2) { animation-delay: 0.2s; }
.cb-typing span:nth-child(3) { animation-delay: 0.4s; }

/* Input Form */
.cb-input-row {
    padding: 10px 14px;
    background: var(--cb-surface);
    border-top: 1px solid var(--cb-border);
    display: flex;
    gap: 8px;
}

.cb-input {
    flex: 1;
    border: 1px solid var(--cb-border);
    background: var(--cb-bg);
    padding: 9px 12px;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    transition: border 0.2s;
}

.cb-input:focus {
    border-color: var(--cb-primary);
    background: #fff;
}

.cb-send-btn {
    background: var(--cb-primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.cb-send-btn:hover {
    background: var(--cb-primary-hover);
}

@keyframes fadeInSlide {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
}