/* Chatbot Widget Styles - Blue Gradient Design (Vintage Style) */
.cb-widget {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 2147483647;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

/* Toggle Button - Blue Gradient */
.cb-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7C3AED 0%, #3B82F6 100%);
    /* Purple to Blue Gradient */
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.3s, box-shadow 0.3s;
}

.cb-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.5);
}

.cb-toggle-btn span {
    font-size: 28px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Icon visibility - show chat icon by default, hide close icon */
.cb-icon-chat {
    display: block !important;
}

.cb-icon-close {
    display: none !important;
}

/* When widget is open, hide chat icon and show close icon */
.cb-widget.cb-open .cb-icon-chat {
    display: none !important;
}

.cb-widget.cb-open .cb-icon-close {
    display: block !important;
}

/* Chat Container */
.cb-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 580px;
    background-color: #ffffff;
    border-radius: 24px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
    pointer-events: none;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.cb-widget.cb-open .cb-container {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Header - Purple to Blue Gradient (Matching Reference) */
.cb-header {
    background: linear-gradient(135deg, #7C3AED 0%, #3B82F6 100%);
    /* Purple to Blue */
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 24px 24px 0 0;
}

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

.cb-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.cb-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.cb-header-info h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.cb-header-info span {
    font-size: 13px;
    opacity: 0.9;
    font-weight: 400;
}

.cb-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cb-refresh-btn,
.cb-minimize-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.3s;
    font-size: 20px !important;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cb-refresh-btn:hover,
.cb-minimize-btn:hover {
    opacity: 1;
}

.cb-refresh-btn:hover {
    transform: rotate(180deg);
}

/* Messages Area */
.cb-messages {
    flex: 1;
    padding: 20px;
    padding-bottom: 80px;
    /* Extra padding to prevent chips from covering last message */
    overflow-y: auto;
    background-color: #F8F9FB;
    /* Light background like reference */
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: #d0d0d0 transparent;
}

.cb-messages::-webkit-scrollbar {
    width: 5px;
}

.cb-messages::-webkit-scrollbar-thumb {
    background-color: #d0d0d0;
    border-radius: 3px;
}

/* Timestamp */
.cb-timestamp {
    text-align: center;
    font-size: 11px;
    color: #9CA3AF;
    margin: 8px 0;
    font-weight: 500;
}

/* Message Bubbles */
.cb-msg {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cb-bot {
    background-color: #FFFFFF;
    color: #1F2937;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* Bot Avatar Icon */
.cb-bot-avatar {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #7C3AED 0%, #3B82F6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.cb-bot-avatar::before {
    content: "🤖";
    font-size: 12px;
}

.cb-user {
    background: linear-gradient(135deg, #7C3AED 0%, #3B82F6 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

/* Controls Area */
.cb-controls {
    padding: 16px 20px;
    background-color: #ffffff;
    border-top: 1px solid #F3F4F6;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Chips - Outline Style with Purple Border */
.cb-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 0;
}

/* Hide chips when hidden attribute is set */
.cb-chips[hidden] {
    display: none !important;
}

.cb-chip {
    background-color: #FFFFFF;
    border: 1.5px solid #6366F1 !important;
    /* Indigo 500 */
    color: #4F46E5;
    /* Indigo 600 */
    padding: 10px 18px;
    border-radius: 24px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.cb-chip:hover {
    background-color: #F5F3FF;
    /* Very light purple */
    color: #4338CA;
    /* Deeper indigo */
    border-color: #4F46E5 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.15);
}

/* Input Form */
.cb-input-form {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #ffffff;
    padding: 0;
}

.cb-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    background-color: #F3F4F6;
    border-radius: 28px;
    padding: 0 16px;
    border: 1px solid #E5E7EB;
    transition: all 0.2s;
}

.cb-input-wrapper:focus-within {
    border-color: #7C3AED;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.cb-input {
    flex: 1;
    padding: 12px 8px;
    border: none;
    border-radius: 28px;
    outline: none;
    font-size: 14px;
    background-color: transparent;
}

.cb-input::placeholder {
    color: #9CA3AF;
}

.cb-input-icons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cb-icon-btn {
    background: transparent;
    border: none;
    color: #6B7280;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    font-size: 20px !important;
}

.cb-icon-btn:hover {
    color: #7C3AED;
}

.cb-send-btn {
    background: linear-gradient(135deg, #7C3AED 0%, #3B82F6 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 20px !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.cb-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.cb-send-btn:active {
    transform: scale(0.95);
}

.cb-error {
    color: #EF4444;
    font-size: 12px;
    margin-top: 5px;
    font-weight: 500;
}

/* Skip Button - NEW STYLING */
.cb-skip-btn {
    background: linear-gradient(135deg, #7C3AED 0%, #3B82F6 100%);
    border: 2px solid transparent;
    color: #FFFFFF;
    padding: 10px 24px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    align-self: flex-start;
    margin-left: 56px;
    /* Align with bot messages (avatar width + gap) */
    margin-top: -8px;
    margin-bottom: 8px;
    max-height: 40px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Hide skip button when hidden attribute is set */
.cb-skip-btn[hidden] {
    display: none !important;
}

.cb-skip-btn::before {
    content: "✓";
    font-size: 16px;
    font-weight: bold;
}

.cb-skip-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.cb-skip-btn:active,
.cb-skip-btn.clicked {
    background: #FFFFFF;
    border: 2px solid #3B82F6;
    color: #3B82F6;
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.cb-skip-btn.clicked::before {
    content: "✓";
    color: #3B82F6;
}

/* Optional text styling */
.cb-text-optional {
    color: #9CA3AF;
    font-size: 12px;
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .cb-container {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 70px;
    }
}