/**
 * AI聊天界面样式 - QQ风格
 */

/* 聊天按钮 */
.hadi-ai-chat-button {
    position: fixed;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    z-index: 9998;
    transition: all 0.3s ease;
    border: none;
    overflow: visible;
}

.hadi-ai-chat-button:hover {
    background: transparent;
}

.hadi-ai-chat-button:active {
    transform: scale(0.9);
}

.hadi-ai-chat-button svg,
.hadi-ai-chat-button-icon {
    width: 80px;
    height: 80px;
    display: block;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 8px rgba(33, 204, 124, 0.3));
}

.hadi-ai-chat-button:hover svg,
.hadi-ai-chat-button:hover .hadi-ai-chat-button-icon {
    transform: scale(1.08);
    filter: drop-shadow(0 3px 12px rgba(33, 204, 124, 0.5));
}

/* 未读消息徽章 */
.hadi-ai-unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff4444;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.3;
    box-shadow: 0 1px 4px rgba(255, 68, 68, 0.3);
    z-index: 10000;
    animation: badgePulse 2s ease-in-out infinite;
    white-space: nowrap;
    border: 1.5px solid #fff;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 1px 4px rgba(255, 68, 68, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 2px 6px rgba(255, 68, 68, 0.4);
    }
}

.hadi-ai-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.hadi-ai-position-float-bar {
    bottom: 60px;
    right: 20px;
}

.hadi-ai-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* 聊天窗口 */
.hadi-ai-chat-widget {
    position: fixed;
    width: 400px;
    height: 600px;
    background: #f5f5f5;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}

.hadi-ai-chat-widget.hadi-ai-position-bottom-right {
    bottom: 50px;
    right: 20px;
}

.hadi-ai-chat-widget.hadi-ai-position-float-bar {
    bottom: 50px;
    right: 20px;
}

.hadi-ai-chat-widget.hadi-ai-position-bottom-left {
    bottom: 50px;
    left: 20px;
}

/* 响应式 */
@media (max-width: 600px) {
    .hadi-ai-chat-widget {
        width: calc(100% - 40px);
        height: calc(100vh - 120px);
        bottom: 50px !important;
        left: 20px !important;
        right: 20px !important;
    }
}

/* 头部 */
.hadi-ai-chat-header {
    background: var(--od-primary, #f04494);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px 16px 0 0;
}

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

.hadi-ai-chat-avatar-small {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hadi-ai-chat-avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.hadi-ai-chat-title-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hadi-ai-chat-title-text {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.hadi-ai-chat-status {
    font-size: 11px;
    opacity: 0.9;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    max-width: 100%;
}

.hadi-ai-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
    animation: breathe-dot 2s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
}

@keyframes breathe-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.2);
        box-shadow: 0 0 12px rgba(74, 222, 128, 0.9);
    }
}

.hadi-ai-status-text {
    white-space: nowrap;
}

.hadi-ai-status-qq {
    white-space: nowrap;
    font-size: 10px;
    opacity: 0.85;
    cursor: pointer;
    transition: opacity 0.2s;
    color: inherit;
    text-decoration: none;
}

.hadi-ai-status-qq:hover {
    opacity: 1;
    text-decoration: underline;
}

/* 响应式：小屏幕时调整状态显示 */
@media (max-width: 600px) {
    .hadi-ai-chat-status {
        font-size: 10px;
        gap: 4px;
    }
    
    .hadi-ai-status-qq {
        font-size: 9px;
    }
}

.hadi-ai-chat-header-actions {
    display: flex;
    gap: 4px;
}

.hadi-ai-chat-action-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.hadi-ai-chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* 容器布局 */
.hadi-ai-chat-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.hadi-ai-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.hadi-ai-chat-sidebar {
    display: none; /* 隐藏侧边栏，更简洁 */
}

.hadi-ai-chat-sidebar-avatar {
    text-align: center;
}

.hadi-ai-chat-sidebar-info {
    margin-top: 12px;
}

.hadi-ai-chat-sidebar-info h3 {
    font-size: 14px;
    color: #333;
    margin: 0 0 4px 0;
    font-weight: 600;
}

.hadi-ai-chat-sidebar-info p {
    font-size: 12px;
    color: #999;
    margin: 0;
}

/* 头像 */
.hadi-ai-chat-avatar-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--od-primary, #f04494) 0%, var(--od-primary-2, #ff7eb2) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.hadi-ai-chat-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.hadi-ai-chat-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    margin-top: 18px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.hadi-ai-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hadi-ai-chat-fallback-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--od-primary, #f04494);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0;
}

/* 消息区域 */
.hadi-ai-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f5f5f5;
}

.hadi-ai-chat-welcome {
    text-align: center;
    color: #666;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* 快速导航 */
.hadi-ai-quick-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
    max-width: 100%;
}

.hadi-ai-quick-nav-item {
    display: inline-block;
    padding: 10px 18px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.hadi-ai-quick-nav-item:hover {
    background: var(--od-primary, #f04494);
    color: #fff;
    border-color: var(--od-primary, #f04494);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(var(--od-primary-rgb, 240, 68, 148), 0.30);
}

.hadi-ai-chat-message {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

.hadi-ai-chat-message.user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.hadi-ai-chat-message.assistant {
    flex-direction: row;
    justify-content: flex-start;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hadi-ai-chat-message-wrapper {
    display: flex;
    flex-direction: column;
    max-width: calc(100% - 50px);
    gap: 4px;
    flex: 1;
}

.hadi-ai-chat-message.user .hadi-ai-chat-message-wrapper {
    align-items: flex-end;
}

.hadi-ai-chat-message.assistant .hadi-ai-chat-message-wrapper {
    align-items: flex-start;
}

.hadi-ai-chat-message-time {
    font-size: 11px;
    color: #999;
    padding: 0 4px;
    margin-bottom: 0;
    display: block;
    opacity: 0.7;
    line-height: 1.2;
}

.hadi-ai-chat-message.user .hadi-ai-chat-message-time {
    text-align: right;
    padding-right: 8px;
}

.hadi-ai-chat-message.assistant .hadi-ai-chat-message-time {
    text-align: left;
    padding-left: 8px;
}

.hadi-ai-chat-message-content {
    position: relative;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.6;
    font-size: 14px;
    max-width: 100%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* 消息气泡（圆润，带尾巴指向头像） */
.hadi-ai-chat-message.user .hadi-ai-chat-message-content {
    background: var(--od-primary, #f04494);
    color: #fff;
    border-radius: 12px; /* 统一圆润 */
    margin-left: 0;
    margin-right: 0;
    position: relative;
}

/* 用户消息气泡尾巴（指向右边头像） */
.hadi-ai-chat-message.user .hadi-ai-chat-message-content::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 8px;
    border-color: transparent transparent transparent var(--od-primary, #f04494);
}

.hadi-ai-chat-message.assistant .hadi-ai-chat-message-content {
    background: #fff;
    color: #333;
    border-radius: 12px; /* 统一圆润 */
    border: 1px solid #e0e0e0;
    margin-left: 0;
    margin-right: 0;
    position: relative;
}

/* 助手消息气泡尾巴（指向左边头像） */
.hadi-ai-chat-message.assistant .hadi-ai-chat-message-content::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 8px 6px 0;
    border-color: transparent #fff transparent transparent;
}

/* 助手消息气泡尾巴边框（与边框颜色一致） */
.hadi-ai-chat-message.assistant .hadi-ai-chat-message-content::after {
    content: '';
    position: absolute;
    left: -9px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 8px 6px 0;
    border-color: transparent #e0e0e0 transparent transparent;
    z-index: -1;
}

.hadi-ai-chat-message-loading {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 12px 12px 12px 4px;
    border: 1px solid #e0e0e0;
}

.hadi-ai-chat-message-loading span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--od-primary, #f04494);
    animation: bounce 1.4s infinite ease-in-out both;
}

.hadi-ai-chat-message-loading span:nth-child(1) {
    animation-delay: -0.32s;
}

.hadi-ai-chat-message-loading span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* 输入区域 */
.hadi-ai-chat-footer {
    background: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 10px;
}

.hadi-ai-chat-toolbar {
    display: none; /* 隐藏工具栏，更简洁 */
}

.hadi-ai-chat-tool-btn {
    background: transparent;
    border: none;
    color: #666;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.hadi-ai-chat-tool-btn:hover {
    background: #f0f0f0;
    color: var(--od-primary, #f04494);
}

.hadi-ai-chat-input-wrapper {
    padding: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.hadi-ai-chat-input-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 7px;
    color: #8a92a3;
    font-size: 12px;
    line-height: 1.4;
}

.hadi-ai-chat-counter {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}

.hadi-ai-chat-counter.is-over-limit {
    color: #e11d48;
    font-weight: 700;
}

.hadi-ai-chat-input-wrapper.is-over-limit .hadi-ai-chat-input {
    border-color: #e11d48;
    box-shadow: 0 0 0 3px rgba(225, 29, 72, .08);
}

.hadi-ai-chat-system-notice {
    width: fit-content;
    max-width: 82%;
    margin: 10px auto;
    padding: 7px 11px;
    border-radius: 8px;
    border: 1px solid rgba(225, 29, 72, .14);
    background: rgba(225, 29, 72, .07);
    color: #be123c;
    font-size: 12px;
    line-height: 1.55;
    text-align: center;
}

.hadi-ai-chat-system-notice.is-info {
    border-color: rgba(var(--od-primary-rgb, 240, 68, 148), .16);
    background: rgba(var(--od-primary-rgb, 240, 68, 148), .08);
    color: var(--od-primary, #f04494);
}

.hadi-ai-chat-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 40px;
    font-family: inherit;
    transition: border-color 0.2s;
    color: #333;
    background: #fff;
    box-sizing: border-box;
}

.hadi-ai-chat-input:focus {
    outline: none;
    border-color: var(--od-primary, #f04494);
}

.hadi-ai-chat-send-area {
    display: none; /* 发送按钮移到输入框旁边 */
}

.hadi-ai-chat-send-btn {
    background: var(--od-primary, #f04494);
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 0 28px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    height: 40px;
    min-width: 70px;
    box-sizing: border-box;
    box-shadow: 0 2px 6px rgba(var(--od-primary-rgb, 240, 68, 148), 0.25);
}

.hadi-ai-chat-send-btn:hover:not(:disabled) {
    background: var(--od-primary-2, #ff7eb2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--od-primary-rgb, 240, 68, 148), 0.40);
}

.hadi-ai-chat-send-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(var(--od-primary-rgb, 240, 68, 148), 0.20);
}

.hadi-ai-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #ccc;
    box-shadow: none;
}

/* 滚动条样式 */
.hadi-ai-chat-body::-webkit-scrollbar {
    width: 6px;
}

.hadi-ai-chat-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.hadi-ai-chat-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.hadi-ai-chat-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 消息中的链接样式 */
.hadi-ai-chat-message-content a {
    color: var(--od-primary, #f04494);
    text-decoration: underline;
    word-break: break-all;
    transition: color 0.2s;
}

.hadi-ai-chat-message-content a:hover {
    color: var(--od-primary-2, #ff7eb2);
    text-decoration: underline;
}

.hadi-ai-chat-message.user .hadi-ai-chat-message-content a {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: underline;
}

.hadi-ai-chat-message.user .hadi-ai-chat-message-content a:hover {
    color: #fff;
    text-decoration: underline;
}

/* 结束对话按钮 */
.hadi-ai-end-conversation-buttons {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hadi-ai-end-conversation-btn {
    flex: 1;
    min-width: 60px;
    padding: 6px 14px;
    border: none;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hadi-ai-end-btn {
    background: #ff6b6b;
    color: #fff;
}

.hadi-ai-end-btn:hover {
    background: #ff5252;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 107, 107, 0.3);
}

.hadi-ai-end-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.2);
}

.hadi-ai-continue-btn {
    background: var(--od-primary, #f04494);
    color: #fff;
}

.hadi-ai-continue-btn:hover {
    background: var(--od-primary-2, #ff7eb2);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(var(--od-primary-rgb, 240, 68, 148), 0.30);
}

.hadi-ai-continue-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(var(--od-primary-rgb, 240, 68, 148), 0.20);
}

/* 欢迎提示框 */
.hadi-ai-welcome-tooltip {
    position: fixed;
    z-index: 9997;
    max-width: 260px;
    width: 260px;
    background: linear-gradient(135deg, var(--od-primary, #f04494) 0%, var(--od-primary-2, #ff7eb2) 100%);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(var(--od-primary-rgb, 240, 68, 148), 0.30);
    padding: 0;
    animation: tooltipFadeIn 0.5s ease-out;
    overflow: visible;
}

.hadi-ai-welcome-tooltip.hadi-ai-position-bottom-right {
    bottom: 90px;
    right: 90px;
}

.hadi-ai-welcome-tooltip.hadi-ai-position-float-bar {
    bottom: 90px;
    right: 90px;
}

.hadi-ai-welcome-tooltip.hadi-ai-position-bottom-left {
    bottom: 90px;
    left: 90px;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.hadi-ai-tooltip-body {
    padding: 14px 16px;
    color: #fff;
    position: relative;
    background-image: 
        radial-gradient(circle at 90% 10%, rgba(255, 255, 255, 0.15) 2px, transparent 2px);
    background-size: 20px 20px;
    background-position: 0 0;
}

.hadi-ai-tooltip-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    z-index: 10;
}

.hadi-ai-tooltip-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.hadi-ai-tooltip-body p {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    padding-right: 30px; /* 为关闭按钮留出空间 */
}

.hadi-ai-tooltip-body p:first-child {
    font-size: 15px;
    margin-bottom: 6px;
    margin-top: 0;
}

.hadi-ai-tooltip-desc {
    font-size: 12px !important;
    font-weight: 400 !important;
    opacity: 0.95;
    line-height: 1.5;
    margin-bottom: 10px !important;
}

.hadi-ai-tooltip-action {
    margin-top: 8px;
    cursor: pointer;
    display: inline-block;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    opacity: 0.9;
}

.hadi-ai-tooltip-action:hover {
    opacity: 1;
    transform: translateX(3px);
}

.hadi-ai-tooltip-arrow {
    position: absolute;
    width: 0;
    height: 0;
}

.hadi-ai-welcome-tooltip.hadi-ai-position-bottom-right .hadi-ai-tooltip-arrow {
    right: 15px;
    bottom: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--od-primary-2, #ff7eb2);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
    transform: rotate(45deg);
}

.hadi-ai-welcome-tooltip.hadi-ai-position-bottom-left .hadi-ai-tooltip-arrow {
    right: 15px;
    bottom: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--od-primary-2, #ff7eb2);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
    transform: rotate(45deg);
}

/* 响应式 */
@media (max-width: 600px) {
    .hadi-ai-welcome-tooltip {
        max-width: calc(100% - 40px);
        width: auto;
        right: 20px !important;
        left: 20px !important;
        bottom: 90px !important;
    }
    
    .hadi-ai-welcome-tooltip.hadi-ai-position-bottom-right .hadi-ai-tooltip-arrow,
    .hadi-ai-welcome-tooltip.hadi-ai-position-bottom-left .hadi-ai-tooltip-arrow {
        right: 20px;
        bottom: -10px;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-top: 10px solid var(--od-primary-2, #ff7eb2);
        transform: rotate(45deg);
    }
}

/* Onedown theme adaptation */
.hadi-ai-chat-button {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--float-btn-bg, rgba(125, 139, 160, 0.12));
    border: 0;
    box-shadow: none;
    backdrop-filter: saturate(2) blur(10px);
}

.hadi-ai-chat-button:hover {
    background: rgba(var(--od-primary-rgb, 240, 68, 148), 0.12);
    border-color: transparent;
    transform: none;
}

.hadi-ai-chat-button:active {
    transform: translateY(0) scale(0.96);
}

.hadi-ai-chat-button svg,
.hadi-ai-chat-button-icon {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 5px 10px rgba(var(--od-primary-rgb, 240, 68, 148), 0.18));
}

.hadi-ai-chat-button:hover svg,
.hadi-ai-chat-button:hover .hadi-ai-chat-button-icon {
    transform: scale(1.05);
    filter: drop-shadow(0 6px 12px rgba(var(--od-primary-rgb, 240, 68, 148), 0.24));
}

.hadi-ai-chat-widget *,
.hadi-ai-welcome-tooltip *,
.hadi-ai-chat-button * {
    box-sizing: border-box;
}

.hadi-ai-position-bottom-right {
    right: 20px;
    bottom: 60px;
}

.hadi-ai-position-float-bar {
    right: 20px;
    bottom: 60px;
}

.hadi-ai-position-bottom-left {
    left: 22px;
    bottom: 92px;
}

.hadi-ai-chat-widget {
    width: 390px;
    height: 620px;
    max-height: calc(100vh - 120px);
    background: var(--od-card, #fff);
    border: 1px solid var(--od-line, #eef0f4);
    border-radius: 10px;
    box-shadow: 0 26px 70px rgba(15, 23, 42, 0.22);
    color: var(--od-heading, #252c3a);
}

.hadi-ai-chat-widget.hadi-ai-position-bottom-right {
    right: 74px;
    bottom: 92px;
}

.hadi-ai-chat-widget.hadi-ai-position-float-bar {
    right: 74px;
    bottom: 56px;
}

#hadi-ai-chat-button.hadi-ai-in-float-bar {
    position: relative;
    inset: auto;
    z-index: auto;
    flex: 0 0 68px;
    width: 68px;
    height: 68px;
    margin: 0 auto 10px;
    background: transparent;
    backdrop-filter: none;
}

#hadi-ai-chat-button.hadi-ai-in-float-bar:hover {
    background: transparent;
}

#hadi-ai-chat-button.hadi-ai-in-float-bar svg,
#hadi-ai-chat-button.hadi-ai-in-float-bar .hadi-ai-chat-button-icon {
    width: 68px;
    height: 68px;
}

#hadi-ai-chat-button.hadi-ai-in-float-bar .hadi-ai-chat-button-icon {
    animation: hadiAiRobotIdle 4.8s ease-in-out infinite;
    transform-origin: center;
    will-change: transform, filter;
}

#hadi-ai-chat-button.hadi-ai-in-float-bar:hover .hadi-ai-chat-button-icon {
    animation: none;
    transform: scale(1.08);
    filter: drop-shadow(0 0 10px rgba(var(--od-primary-rgb, 240, 68, 148), 0.32));
}

@keyframes hadiAiRobotIdle {
    0%,
    68%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(var(--od-primary-rgb, 240, 68, 148), 0));
    }

    74% {
        transform: scale(1.06);
        filter: drop-shadow(0 0 8px rgba(var(--od-primary-rgb, 240, 68, 148), 0.28));
    }

    80% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(var(--od-primary-rgb, 240, 68, 148), 0));
    }
}

@media (prefers-reduced-motion: reduce) {
    #hadi-ai-chat-button.hadi-ai-in-float-bar .hadi-ai-chat-button-icon {
        animation: none;
    }
}

.hadi-ai-chat-widget.hadi-ai-position-bottom-left {
    left: 22px;
    bottom: 92px;
}

.hadi-ai-chat-header {
    background: var(--od-gradient, linear-gradient(135deg, #f04494, #ff7eb2));
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
    padding: 14px 16px;
}

.hadi-ai-chat-title {
    gap: 11px;
    min-width: 0;
}

.hadi-ai-chat-avatar-small,
.hadi-ai-chat-avatar-large,
.hadi-ai-chat-avatar {
    background: rgba(var(--od-primary-rgb, 240, 68, 148), 0.10);
    border: 1px solid rgba(var(--od-primary-rgb, 240, 68, 148), 0.16);
    box-shadow: none;
}

.hadi-ai-chat-avatar-small {
    width: 34px;
    height: 34px;
}

.hadi-ai-chat-title-info {
    min-width: 0;
}

.hadi-ai-chat-title-text {
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 800;
}

.hadi-ai-chat-status {
    gap: 5px;
    color: rgba(255, 255, 255, 0.88);
}

.hadi-ai-status-dot {
    width: 7px;
    height: 7px;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.hadi-ai-chat-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.16);
    font-size: 20px;
}

.hadi-ai-chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.26);
}

.hadi-ai-chat-body {
    padding: 14px;
    background:
        linear-gradient(180deg, rgba(var(--od-primary-rgb, 240, 68, 148), 0.035), transparent 160px),
        color-mix(in srgb, var(--od-card, #fff) 92%, #f8fafc);
}

.hadi-ai-chat-welcome {
    padding: 30px 18px 24px;
    color: var(--od-muted, #8a93a8);
}

.hadi-ai-chat-welcome p {
    margin: 0;
    color: var(--od-heading, #252c3a);
    font-size: 14px;
    line-height: 1.7;
}

.hadi-ai-quick-nav {
    gap: 7px;
    margin-top: 12px;
}

.hadi-ai-quick-nav-item {
    padding: 7px 12px;
    border-radius: 7px;
    background: var(--od-card, #fff);
    border: 1px solid var(--od-line, #eef0f4);
    color: var(--od-heading, #252c3a);
    font-size: 12px;
    font-weight: 700;
    box-shadow: none;
}

.hadi-ai-quick-nav-item:hover {
    background: rgba(var(--od-primary-rgb, 240, 68, 148), 0.08);
    border-color: rgba(var(--od-primary-rgb, 240, 68, 148), 0.28);
    color: var(--od-primary, #f04494);
    transform: translateY(-1px);
    box-shadow: none;
}

.hadi-ai-chat-message {
    margin-bottom: 14px;
    gap: 9px;
}

.hadi-ai-chat-message-wrapper {
    max-width: calc(100% - 47px);
}

.hadi-ai-chat-message-time {
    color: var(--od-muted, #8a93a8);
    font-size: 10px;
}

.hadi-ai-chat-message-content {
    padding: 10px 13px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.72;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.hadi-ai-chat-message.user .hadi-ai-chat-message-content {
    background: var(--od-gradient, linear-gradient(135deg, #f04494, #ff7eb2));
    border-radius: 8px;
}

.hadi-ai-chat-message.user .hadi-ai-chat-message-content::after {
    border-color: transparent transparent transparent var(--od-primary-2, #ff7eb2);
}

.hadi-ai-chat-message.assistant .hadi-ai-chat-message-content {
    background: var(--od-card, #fff);
    color: var(--od-heading, #252c3a);
    border: 1px solid var(--od-line, #eef0f4);
    border-radius: 8px;
}

.hadi-ai-chat-message.is-strict-faq .hadi-ai-chat-message-content {
    border-color: rgba(var(--od-primary-rgb, 240, 68, 148), 0.18);
    background: rgba(var(--od-primary-rgb, 240, 68, 148), 0.055);
    color: var(--od-heading, #252c3a);
    box-shadow: none;
}

.hadi-ai-chat-message.assistant .hadi-ai-chat-message-content::before {
    border-color: transparent var(--od-card, #fff) transparent transparent;
}

.hadi-ai-chat-message.assistant .hadi-ai-chat-message-content::after {
    border-color: transparent var(--od-line, #eef0f4) transparent transparent;
}

.hadi-ai-chat-message-loading {
    border-radius: 8px;
    border-color: var(--od-line, #eef0f4);
    background: var(--od-card, #fff);
}

.hadi-ai-chat-message-loading span {
    background: var(--od-primary, #f04494);
}

.hadi-ai-chat-footer {
    padding: 12px;
    background: var(--od-card, #fff);
    border-top: 1px solid var(--od-line, #eef0f4);
}

.hadi-ai-chat-input-wrapper {
    align-items: flex-end;
}

.hadi-ai-chat-input {
    min-height: 40px;
    padding: 10px 13px;
    border-radius: 8px;
    border-color: var(--od-line, #eef0f4);
    background: color-mix(in srgb, var(--od-card, #fff) 94%, #f8fafc);
    color: var(--od-heading, #252c3a);
}

.hadi-ai-chat-input:focus {
    border-color: rgba(var(--od-primary-rgb, 240, 68, 148), 0.5);
    box-shadow: 0 0 0 3px rgba(var(--od-primary-rgb, 240, 68, 148), 0.10);
}

.hadi-ai-chat-input::placeholder {
    color: var(--od-muted, #8a93a8);
}

.hadi-ai-chat-send-btn {
    height: 40px;
    min-width: 64px;
    padding: 0 16px;
    border-radius: 8px;
    background: var(--od-gradient, linear-gradient(135deg, #f04494, #ff7eb2));
    box-shadow: 0 10px 18px rgba(var(--od-primary-rgb, 240, 68, 148), 0.22);
}

.hadi-ai-chat-send-btn:hover:not(:disabled) {
    background: var(--od-gradient, linear-gradient(135deg, #f04494, #ff7eb2));
    box-shadow: 0 12px 22px rgba(var(--od-primary-rgb, 240, 68, 148), 0.30);
}

.hadi-ai-chat-send-btn:disabled {
    background: var(--od-line, #eef0f4);
    color: var(--od-muted, #8a93a8);
}

.hadi-ai-chat-message-content a {
    color: var(--od-primary, #f04494);
}

.hadi-ai-end-conversation-btn {
    border-radius: 7px;
    box-shadow: none;
}

.hadi-ai-end-conversation-buttons {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hadi-ai-continue-btn {
    background: var(--od-primary, #f04494);
}

.hadi-ai-welcome-tooltip {
    width: 252px;
    border-radius: 8px;
    background: var(--od-card, #fff);
    border: 1px solid var(--od-line, #eef0f4);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
}

.hadi-ai-welcome-tooltip.hadi-ai-position-bottom-right {
    top: var(--hadi-ai-tooltip-top, 96px);
    right: var(--hadi-ai-tooltip-right, 72px);
    bottom: auto;
}

.hadi-ai-welcome-tooltip.hadi-ai-position-float-bar {
    top: var(--hadi-ai-tooltip-top, 96px);
    right: var(--hadi-ai-tooltip-right, 72px);
    bottom: auto;
}

.hadi-ai-welcome-tooltip.hadi-ai-position-bottom-left {
    left: 92px;
    bottom: 104px;
}

.hadi-ai-tooltip-body {
    padding: 14px 15px;
    color: var(--od-heading, #252c3a);
    background-image: none;
}

.hadi-ai-tooltip-body p {
    padding-right: 28px;
}

.hadi-ai-tooltip-desc {
    color: var(--od-muted, #8a93a8);
}

.hadi-ai-tooltip-close {
    top: 9px;
    right: 9px;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(var(--od-primary-rgb, 240, 68, 148), 0.08);
    color: var(--od-primary, #f04494);
}

.hadi-ai-tooltip-close:hover {
    background: rgba(var(--od-primary-rgb, 240, 68, 148), 0.14);
    transform: none;
}

.hadi-ai-tooltip-action {
    color: var(--od-primary, #f04494);
    font-weight: 800;
}

.hadi-ai-welcome-tooltip.hadi-ai-position-bottom-right .hadi-ai-tooltip-arrow,
.hadi-ai-welcome-tooltip.hadi-ai-position-float-bar .hadi-ai-tooltip-arrow,
.hadi-ai-welcome-tooltip.hadi-ai-position-bottom-left .hadi-ai-tooltip-arrow {
    border-top-color: var(--od-card, #fff);
}

.hadi-ai-welcome-tooltip.hadi-ai-position-bottom-right .hadi-ai-tooltip-arrow,
.hadi-ai-welcome-tooltip.hadi-ai-position-float-bar .hadi-ai-tooltip-arrow {
    top: calc(var(--hadi-ai-tooltip-arrow-top, 24px) - 7px);
    right: -16px;
    bottom: auto;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 16px solid var(--od-card, #fff);
    border-right: 0;
    transform: none;
    filter: drop-shadow(2px 0 3px rgba(15, 23, 42, 0.10));
}

.hadi-ai-unread-badge {
    top: -7px;
    right: -7px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #ef4444;
    border: 2px solid var(--od-card, #fff);
    font-size: 10px;
    line-height: 18px;
}

[data-theme="dark"] .hadi-ai-chat-widget,
[data-theme="dark"] .hadi-ai-chat-footer,
[data-theme="dark"] .hadi-ai-chat-message.assistant .hadi-ai-chat-message-content,
[data-theme="dark"] .hadi-ai-chat-message-loading,
[data-theme="dark"] .hadi-ai-welcome-tooltip {
    background: var(--od-card, #191b22);
    border-color: var(--od-line, rgba(255, 255, 255, 0.10));
}

[data-theme="dark"] .hadi-ai-chat-widget {
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .hadi-ai-chat-body {
    background:
        linear-gradient(180deg, rgba(var(--od-primary-rgb, 240, 68, 148), 0.10), transparent 160px),
        #14161d;
}

[data-theme="dark"] .hadi-ai-chat-input,
[data-theme="dark"] .hadi-ai-quick-nav-item {
    background: rgba(255, 255, 255, 0.035);
    border-color: var(--od-line, rgba(255, 255, 255, 0.10));
    color: var(--od-heading, #f4f6fb);
}

[data-theme="dark"] .hadi-ai-chat-input-meta {
    color: rgba(203, 213, 225, .72);
}

[data-theme="dark"] .hadi-ai-chat-system-notice {
    border-color: rgba(251, 113, 133, .2);
    background: rgba(251, 113, 133, .1);
    color: #fda4af;
}

[data-theme="dark"] .hadi-ai-chat-message.assistant .hadi-ai-chat-message-content::before {
    border-color: transparent var(--od-card, #191b22) transparent transparent;
}

[data-theme="dark"] .hadi-ai-chat-message.is-strict-faq .hadi-ai-chat-message-content {
    border-color: rgba(var(--od-primary-rgb, 240, 68, 148), 0.26);
    background: rgba(var(--od-primary-rgb, 240, 68, 148), 0.12);
}

[data-theme="dark"] .hadi-ai-welcome-tooltip.hadi-ai-position-bottom-right .hadi-ai-tooltip-arrow,
[data-theme="dark"] .hadi-ai-welcome-tooltip.hadi-ai-position-float-bar .hadi-ai-tooltip-arrow,
[data-theme="dark"] .hadi-ai-welcome-tooltip.hadi-ai-position-bottom-left .hadi-ai-tooltip-arrow {
    border-top-color: var(--od-card, #191b22);
}

[data-theme="dark"] .hadi-ai-welcome-tooltip.hadi-ai-position-bottom-right .hadi-ai-tooltip-arrow,
[data-theme="dark"] .hadi-ai-welcome-tooltip.hadi-ai-position-float-bar .hadi-ai-tooltip-arrow {
    border-top-color: transparent;
    border-left-color: var(--od-card, #191b22);
}

[data-theme="dark"] .hadi-ai-chat-welcome p,
[data-theme="dark"] .hadi-ai-tooltip-body,
[data-theme="dark"] .hadi-ai-chat-message.assistant .hadi-ai-chat-message-content {
    color: var(--od-heading, #f4f6fb);
}

@media (max-width: 600px) {
    .hadi-ai-chat-button {
        width: 38px;
        height: 38px;
        border-radius: 8px;
        background: var(--float-btn-bg, rgba(125, 139, 160, 0.12));
        border: 0;
        box-shadow: none;
    }

    .hadi-ai-chat-button svg,
    .hadi-ai-chat-button-icon {
        width: 27px;
        height: 27px;
    }

    .hadi-ai-position-bottom-right,
    .hadi-ai-position-float-bar,
    .hadi-ai-position-bottom-left {
        right: 16px;
        left: auto;
        bottom: 110px;
    }

    #hadi-ai-chat-button.hadi-ai-in-float-bar {
        position: relative;
        inset: auto;
        flex-basis: 46px;
        width: 46px;
        height: 46px;
        margin: 0 auto 8px;
        background: transparent;
        backdrop-filter: none;
    }

    #hadi-ai-chat-button.hadi-ai-in-float-bar svg,
    #hadi-ai-chat-button.hadi-ai-in-float-bar .hadi-ai-chat-button-icon {
        width: 46px;
        height: 46px;
    }

    .hadi-ai-chat-widget {
        width: calc(100vw - 24px);
        height: min(620px, calc(100vh - 100px));
        right: 12px !important;
        left: 12px !important;
        bottom: 74px !important;
        border-radius: 10px;
    }

    .hadi-ai-chat-header {
        border-radius: 10px 10px 0 0;
    }

    .hadi-ai-chat-title-text {
        max-width: 190px;
    }

    .hadi-ai-chat-input-wrapper {
        gap: 7px;
    }

    .hadi-ai-chat-input-meta {
        font-size: 11px;
    }

    .hadi-ai-chat-input-meta > span:first-child {
        display: none;
    }

    .hadi-ai-chat-send-btn {
        min-width: 58px;
        padding: 0 12px;
    }

    .hadi-ai-welcome-tooltip {
        right: var(--hadi-ai-tooltip-right, 64px) !important;
        left: auto !important;
        top: var(--hadi-ai-tooltip-top, 80px) !important;
        bottom: auto !important;
        width: min(252px, calc(100vw - 88px));
        max-width: none;
    }
}

/* Frontend refinement: compact, theme-aware chat surface */
.hadi-ai-chat-widget {
    width: 376px;
    height: 570px;
    max-height: calc(100vh - 112px);
    border-radius: 12px;
    border-color: color-mix(in srgb, var(--od-line, #eef0f4) 82%, transparent);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
}

.hadi-ai-chat-header {
    min-height: 58px;
    padding: 11px 14px;
    border-radius: 12px 12px 0 0;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.14);
}

.hadi-ai-chat-avatar-small {
    width: 32px;
    height: 32px;
    border-color: rgba(255, 255, 255, 0.26);
    background: rgba(255, 255, 255, 0.18);
}

.hadi-ai-chat-title-text {
    font-size: 14px;
    font-weight: 750;
}

.hadi-ai-chat-status {
    font-size: 10px;
    line-height: 1.35;
}

.hadi-ai-chat-body {
    padding: 12px 12px 10px;
    background:
        radial-gradient(circle at 28px 24px, rgba(var(--od-primary-rgb, 240, 68, 148), 0.08), transparent 26px),
        linear-gradient(180deg, rgba(var(--od-primary-rgb, 240, 68, 148), 0.035), transparent 132px),
        color-mix(in srgb, var(--od-card, #fff) 88%, #f6f8fb);
}

.hadi-ai-chat-welcome {
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 12px;
    padding: 12px;
    text-align: left;
    border: 1px solid color-mix(in srgb, var(--od-line, #eef0f4) 80%, transparent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--od-card, #fff) 92%, transparent);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.045);
}

.hadi-ai-chat-welcome .hadi-ai-chat-avatar-large {
    width: 42px;
    height: 42px;
}

.hadi-ai-chat-welcome p {
    font-size: 13px;
    line-height: 1.62;
}

.hadi-ai-quick-nav {
    justify-content: flex-start;
    gap: 6px;
    margin-top: 2px;
}

.hadi-ai-quick-nav:empty {
    display: none;
}

.hadi-ai-quick-nav-item {
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 650;
    box-shadow: none;
}

.hadi-ai-chat-message {
    gap: 8px;
    margin-bottom: 12px;
}

.hadi-ai-chat-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    margin-top: 16px;
    border-color: color-mix(in srgb, var(--od-line, #eef0f4) 82%, transparent);
}

.hadi-ai-chat-message-wrapper {
    gap: 3px;
    max-width: calc(100% - 42px);
}

.hadi-ai-chat-message-content {
    padding: 9px 12px;
    border-radius: 9px;
    font-size: 13px;
    line-height: 1.68;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.045);
}

.hadi-ai-chat-message.user .hadi-ai-chat-message-content,
.hadi-ai-chat-message.assistant .hadi-ai-chat-message-content {
    border-radius: 9px;
}

.hadi-ai-chat-message.assistant .hadi-ai-chat-message-content {
    border-color: color-mix(in srgb, var(--od-line, #eef0f4) 84%, transparent);
}

.hadi-ai-chat-message-time {
    font-size: 10px;
    opacity: 0.66;
}

.hadi-ai-chat-footer {
    padding: 10px;
    background: color-mix(in srgb, var(--od-card, #fff) 96%, #f8fafc);
}

.hadi-ai-chat-input-wrapper {
    gap: 7px;
}

.hadi-ai-chat-input {
    min-height: 38px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.45;
}

.hadi-ai-chat-send-btn {
    height: 38px;
    min-width: 58px;
    padding: 0 13px;
    border-radius: 8px;
    font-size: 13px;
}

.hadi-ai-chat-input-meta {
    margin-top: 6px;
    font-size: 11px;
}

[data-theme="dark"] .hadi-ai-chat-widget {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.48);
}

[data-theme="dark"] .hadi-ai-chat-body {
    background:
        radial-gradient(circle at 28px 24px, rgba(var(--od-primary-rgb, 240, 68, 148), 0.13), transparent 28px),
        linear-gradient(180deg, rgba(var(--od-primary-rgb, 240, 68, 148), 0.08), transparent 132px),
        #14161d;
}

[data-theme="dark"] .hadi-ai-chat-welcome {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.035);
    box-shadow: none;
}

[data-theme="dark"] .hadi-ai-chat-welcome p,
[data-theme="dark"] .hadi-ai-chat-title-text,
[data-theme="dark"] .hadi-ai-chat-input,
[data-theme="dark"] .hadi-ai-quick-nav-item,
[data-theme="dark"] .hadi-ai-chat-message.assistant .hadi-ai-chat-message-content {
    color: var(--od-heading, #f4f6fb);
}

[data-theme="dark"] .hadi-ai-chat-footer {
    background: var(--od-card, #191b22);
}

[data-theme="dark"] .hadi-ai-chat-input::placeholder {
    color: rgba(203, 213, 225, 0.62);
}

@media (max-width: 600px) {
    .hadi-ai-chat-widget {
        width: calc(100vw - 24px);
        height: min(620px, calc(100vh - 100px));
        border-radius: 10px;
    }

    .hadi-ai-chat-header {
        border-radius: 10px 10px 0 0;
    }

    .hadi-ai-chat-welcome {
        padding: 11px;
    }
}

/* Robot personality: blink is inside the SVG, this keeps the entry feeling alive. */
#hadi-ai-chat-button.hadi-ai-in-float-bar .hadi-ai-chat-button-icon {
    animation: hadiAiRobotFloat 3.8s ease-in-out infinite;
    filter:
        drop-shadow(0 8px 12px rgba(41, 148, 255, 0.18))
        drop-shadow(0 0 0 rgba(var(--od-primary-rgb, 240, 68, 148), 0));
}

#hadi-ai-chat-button.hadi-ai-in-float-bar::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 5px;
    width: 38px;
    height: 8px;
    border-radius: 999px;
    background: rgba(77, 178, 255, 0.22);
    transform: translateX(-50%);
    animation: hadiAiRobotBaseGlow 3.8s ease-in-out infinite;
    pointer-events: none;
}

#hadi-ai-chat-button.hadi-ai-in-float-bar:hover .hadi-ai-chat-button-icon {
    animation: hadiAiRobotHover 1.2s ease-in-out infinite;
    filter:
        drop-shadow(0 10px 15px rgba(41, 148, 255, 0.28))
        drop-shadow(0 0 12px rgba(var(--od-primary-rgb, 240, 68, 148), 0.24));
}

@keyframes hadiAiRobotFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg) scale(1);
        filter:
            drop-shadow(0 8px 12px rgba(41, 148, 255, 0.18))
            drop-shadow(0 0 0 rgba(var(--od-primary-rgb, 240, 68, 148), 0));
    }

    34% {
        transform: translateY(-5px) rotate(-2deg) scale(1.025);
        filter:
            drop-shadow(0 12px 16px rgba(41, 148, 255, 0.24))
            drop-shadow(0 0 8px rgba(var(--od-primary-rgb, 240, 68, 148), 0.14));
    }

    68% {
        transform: translateY(-2px) rotate(2deg) scale(1.01);
        filter:
            drop-shadow(0 10px 14px rgba(41, 148, 255, 0.22))
            drop-shadow(0 0 5px rgba(var(--od-primary-rgb, 240, 68, 148), 0.10));
    }
}

@keyframes hadiAiRobotHover {
    0%, 100% {
        transform: translateY(-3px) rotate(-2deg) scale(1.08);
    }

    50% {
        transform: translateY(-7px) rotate(2deg) scale(1.11);
    }
}

@keyframes hadiAiRobotBaseGlow {
    0%, 100% {
        transform: translateX(-50%) scaleX(1);
        opacity: .55;
    }

    50% {
        transform: translateX(-50%) scaleX(.78);
        opacity: .30;
    }
}

@media (prefers-reduced-motion: reduce) {
    #hadi-ai-chat-button.hadi-ai-in-float-bar .hadi-ai-chat-button-icon,
    #hadi-ai-chat-button.hadi-ai-in-float-bar:hover .hadi-ai-chat-button-icon,
    #hadi-ai-chat-button.hadi-ai-in-float-bar::after {
        animation: none;
    }
}

/* Message hint: make unread state feel like part of the robot, not a raw app badge. */
#hadi-ai-chat-button .hadi-ai-unread-badge {
    top: 5px;
    right: -4px;
    min-width: 22px;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px 999px 999px 6px;
    background: linear-gradient(135deg, #ff5f7a, #ef334e);
    border: 2px solid var(--od-card, #fff);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 18px;
    box-shadow:
        0 7px 16px rgba(239, 51, 78, 0.24),
        0 0 0 4px rgba(239, 51, 78, 0.08);
    transform-origin: 0 100%;
    animation: hadiAiUnreadNudge 3.2s ease-in-out infinite;
}

#hadi-ai-chat-button .hadi-ai-unread-badge::after {
    content: '';
    position: absolute;
    left: 2px;
    bottom: -4px;
    width: 8px;
    height: 8px;
    background: #ef334e;
    border-left: 2px solid var(--od-card, #fff);
    border-bottom: 2px solid var(--od-card, #fff);
    border-bottom-left-radius: 7px;
    transform: rotate(12deg);
}

#hadi-ai-chat-button.hadi-ai-in-float-bar .hadi-ai-unread-badge {
    top: 8px;
    right: -8px;
}

[data-theme="dark"] #hadi-ai-chat-button .hadi-ai-unread-badge {
    border-color: var(--od-card, #191b22);
    box-shadow:
        0 8px 18px rgba(0, 0, 0, 0.28),
        0 0 0 4px rgba(239, 51, 78, 0.14);
}

[data-theme="dark"] #hadi-ai-chat-button .hadi-ai-unread-badge::after {
    border-left-color: var(--od-card, #191b22);
    border-bottom-color: var(--od-card, #191b22);
}

@keyframes hadiAiUnreadNudge {
    0%, 72%, 100% {
        transform: translateY(0) scale(1);
    }

    78% {
        transform: translateY(-2px) scale(1.08);
    }

    86% {
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 600px) {
    #hadi-ai-chat-button.hadi-ai-in-float-bar .hadi-ai-unread-badge {
        top: 3px;
        right: -7px;
        min-width: 20px;
        height: 18px;
        padding: 0 6px;
        font-size: 10px;
        line-height: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #hadi-ai-chat-button .hadi-ai-unread-badge {
        animation: none;
    }
}

