:root {
    --da-primary: #0b63ce;          /* Dynamically overwritten by JS */
    --da-primary-dark: #084a9a;     /* Dynamically overwritten by JS */
    --da-primary-rgb: 11, 99, 206;  /* Dynamically overwritten by JS */
    --da-bg: rgba(255, 255, 255, 0.95);
    --da-text: #1e293b;
    --da-secondary-bg: #f8fafc;
    --da-border: rgba(226, 232, 240, 0.8);
    --da-radius: 20px;
    --da-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.05);
    --da-font: 'Outfit', system-ui, -apple-system, sans-serif;
    --da-chat-width: 380px;
    --da-chat-height: 600px;
}

/* Premium Floating action button with pulse rings */
.da-float-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99998;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--da-primary) 0%, var(--da-primary-dark) 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 8px 24px rgba(var(--da-primary-rgb), 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: da-float-breath 4s ease-in-out infinite;
}

/* Sonar pulse waves extending from the floating button */
.da-float-btn::before,
.da-float-btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--da-primary);
    opacity: 0.5;
    z-index: -1;
    animation: da-sonar-pulse 2.5s cubic-bezier(0.215, 0.610, 0.355, 1) infinite;
}

.da-float-btn::after {
    animation-delay: 1.25s;
}

@keyframes da-float-breath {
    0% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0); }
}

@keyframes da-sonar-pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

.da-float-btn:hover {
    box-shadow: 0 12px 30px rgba(var(--da-primary-rgb), 0.5);
    background: linear-gradient(135deg, var(--da-primary-dark) 0%, var(--da-primary) 100%);
    transform: translateY(-4px) scale(1.08) rotate(8deg);
}

.da-float-btn:active {
    transform: translateY(0) scale(0.95);
}

.da-float-btn svg {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.da-float-btn:hover svg {
    transform: scale(1.1) rotate(-10deg);
}

.da-float-btn.hide {
    opacity: 0;
    transform: translateY(40px) scale(0.5);
    pointer-events: none;
}

/* Speech hint bubble with slide/fade entry */
.da-float-bubble {
    position: fixed;
    bottom: 96px;
    left: 24px;
    z-index: 99997;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 12px 36px 12px 16px;
    max-width: 240px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.02);
    font-family: var(--da-font);
    font-size: 13.5px;
    font-weight: 500;
    color: #1e293b;
    opacity: 0;
    transform: translateY(15px) scale(0.95);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: block;
    visibility: hidden;
}

.da-float-bubble.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    visibility: visible;
}

.da-float-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 22px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(255, 255, 255, 0.88);
}

/* Close button inside speech bubble */
.da-bubble-close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.05);
    border: none;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    color: #64748b;
    padding: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.da-bubble-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #1e293b;
    transform: translateY(-50%) scale(1.1);
}

/* Premium Glassmorphic Chat Window */
.da-chat-window {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99999;
    width: var(--da-chat-width);
    max-width: calc(100vw - 48px);
    height: var(--da-chat-height);
    max-height: calc(100vh - 100px);
    background: var(--da-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--da-radius);
    box-shadow: var(--da-shadow);
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--da-font);
    color: var(--da-text);
    opacity: 0;
    transform: translateY(40px) scale(0.92);
    pointer-events: none;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.da-chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    visibility: visible;
}

/* Chat Header */
.da-chat-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--da-primary) 0%, var(--da-primary-dark) 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.da-avatar-container {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.da-chat-header img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.da-avatar-fallback {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
}

/* Pulsing online status indicator */
.da-online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background-color: #2ecc71;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
    animation: da-pulse-green 2s infinite;
}

@keyframes da-pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(46, 204, 113, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}

.da-header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.da-chat-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1.2;
}

.da-header-status {
    font-size: 11px;
    opacity: 0.85;
    font-weight: 400;
}

.da-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.da-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Messages container */
.da-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    background: var(--da-secondary-bg);
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Custom Scrollbars */
.da-messages::-webkit-scrollbar {
    width: 6px;
}

.da-messages::-webkit-scrollbar-track {
    background: transparent;
}

.da-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
}

.da-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.15);
}

/* Message bubbles */
.da-message {
    max-width: 82%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
    font-size: 13.5px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    animation: da-slide-in-msg 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
    position: relative;
}

@keyframes da-slide-in-msg {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.da-message.bot {
    align-self: flex-start;
    background: #ffffff;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.01);
}

.da-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--da-primary) 0%, var(--da-primary-dark) 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 10px rgba(var(--da-primary-rgb), 0.25);
}

/* Bot Message Markdown Formatting */
.da-message.bot h1,
.da-message.bot h2,
.da-message.bot h3,
.da-message.bot h4 {
    color: #0f172a;
    font-weight: 700;
    margin: 12px 0 6px 0;
}

.da-message.bot h1:first-child,
.da-message.bot h2:first-child,
.da-message.bot h3:first-child,
.da-message.bot h4:first-child {
    margin-top: 0;
}

.da-message.bot h1 { font-size: 17px; }
.da-message.bot h2 { font-size: 15.5px; }
.da-message.bot h3 { font-size: 14.5px; }
.da-message.bot h4 { font-size: 13.5px; }

.da-message.bot ul {
    margin: 8px 0;
    padding-left: 20px;
}

.da-message.bot li {
    margin-bottom: 4px;
}

.da-message.bot li:last-child {
    margin-bottom: 0;
}

.da-divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 12px 0;
}

.da-inline-code {
    background: #f1f5f9 !important;
    color: #e11d48 !important;
    padding: 2px 6px !important;
    border-radius: 6px !important;
    font-family: Consolas, Monaco, 'Andale Mono', monospace !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    border: 1px solid #e2e8f0 !important;
    display: inline !important;
}

/* Wikipedia-style hyperlink styling (Blue link with vivid green hover) */
.da-link {
    color: #0b63ce !important; /* Elegant Wikipedia Blue */
    text-decoration: underline !important;
    text-decoration-color: rgba(11, 99, 206, 0.4) !important;
    font-weight: 700 !important; /* Distinct bold style */
    background: transparent !important; /* Pure anchor tag inline look */
    padding: 0 !important;
    margin: 0 !important;
    display: inline !important;
    transition: color 0.25s ease, text-decoration-color 0.25s ease !important;
}

.da-link:hover {
    color: #10b981 !important; /* Outstanding vivid green hover effect! */
    text-decoration-color: #10b981 !important;
}

/* Code Blocks */
.da-code-block-wrapper {
    background: #1e293b !important; /* Header background wrapper */
    border-radius: 12px !important;
    margin: 14px 0 !important;
    overflow: hidden !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
}

.da-code-block-header {
    background: #1e293b !important;
    padding: 8px 14px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.da-code-lang {
    color: #94a3b8 !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    font-family: var(--da-font) !important;
}

.da-copy-code-btn {
    background: transparent !important;
    border: 1px solid rgba(148, 163, 184, 0.2) !important;
    color: #94a3b8 !important;
    padding: 4px 10px !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    transition: all 0.2s !important;
}

.da-copy-code-btn:hover {
    background: rgba(148, 163, 184, 0.1) !important;
    color: #f1f5f9 !important;
    border-color: rgba(148, 163, 184, 0.4) !important;
}

.da-copy-code-btn.copied {
    background: #10b981 !important;
    color: #ffffff !important;
    border-color: #10b981 !important;
}

/* Theme-insulated terminal body container (Restored clean light UI) */
.da-pre {
    margin: 0 !important;
    padding: 14px !important;
    overflow-x: auto !important;
    background: #f8fafc !important; /* Premium light grey background matching your theme's container */
    border-left: 4px solid #10b981 !important; /* Iconic clean green left border from the previous awesome UI */
    border-radius: 0 0 12px 12px !important;
    border-top: none !important;
    border-right: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
}

/* Theme-insulated terminal code text (Crisp high-visibility charcoal text) */
.da-code {
    color: #1e293b !important; /* Crisp, readable charcoal text */
    font-family: Consolas, Monaco, 'Andale Mono', monospace !important;
    font-size: 13px !important;
    line-height: 1.6 !important;
    white-space: pre !important;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
}

/* Thinking Indicator */
.da-thinking {
    align-self: flex-start;
    background: #ffffff;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.02);
}

.da-thinking span {
    width: 6px;
    height: 6px;
    background: var(--da-primary);
    border-radius: 50%;
    animation: da-bounce 1.4s infinite ease-in-out both;
    opacity: 0.6;
}

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

@keyframes da-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1.1); opacity: 1; }
}

/* Input Area */
.da-input-area {
    display: flex;
    align-items: flex-end;
    border-top: 1px solid #e2e8f0;
    padding: 12px 16px;
    background: #ffffff;
    gap: 8px;
}

.da-input-area textarea {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 10px 16px;
    resize: none;
    font-family: inherit;
    font-size: 13.5px;
    outline: none;
    max-height: 100px;
    min-height: 20px;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
    line-height: 1.4;
    background: #f8fafc;
}

.da-input-area textarea:focus {
    border-color: var(--da-primary);
    box-shadow: 0 0 0 3px rgba(var(--da-primary-rgb), 0.15);
    background: #ffffff;
}

.da-send-btn {
    background: linear-gradient(135deg, var(--da-primary) 0%, var(--da-primary-dark) 100%);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(var(--da-primary-rgb), 0.2);
    transition: all 0.2s;
}

.da-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(var(--da-primary-rgb), 0.35);
}

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

.da-send-btn svg {
    transition: transform 0.2s;
}

.da-send-btn:hover svg {
    transform: translate(2px, -2px);
}

/* Mobile responsive styling */
@media (max-width: 480px) {
    :root {
        --da-chat-width: 100%;
        --da-chat-height: 82vh;
    }
    .da-chat-window {
        left: 0;
        right: 0;
        bottom: 0;
        max-width: 100%;
        max-height: 82vh;
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -8px 30px rgba(0,0,0,0.15);
        transform: translateY(100%) scale(1);
    }
    .da-chat-window.open {
        transform: translateY(0) scale(1);
    }
    .da-float-btn {
        bottom: 16px;
        left: 16px;
        width: 54px;
        height: 54px;
    }
    .da-float-bubble {
        bottom: 84px;
        left: 16px;
        max-width: calc(100vw - 32px);
    }
}
