/* ===========================
   AI Chat Widget Styles
   =========================== */

.cn-chat-widget {
    position: fixed;
    z-index: 9999;
    font-family: var(--font-primary);
}

.cn-chat-widget.bottom-right {
    bottom: 20px;
    right: 20px;
}

.cn-chat-widget.bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Chat Button */
.cn-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d4ff 0%, #00a6ff 50%, #0066cc 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4), 0 0 30px rgba(0, 166, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.cn-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 35px rgba(0, 212, 255, 0.6), 0 0 50px rgba(0, 166, 255, 0.4);
}

.cn-chat-button svg {
    width: 28px;
    height: 28px;
    color: white;
    transition: all 0.3s ease;
}

.cn-chat-button .cn-close-icon {
    display: none;
}

.cn-chat-button.cn-chat-active .cn-chat-icon {
    display: none;
}

.cn-chat-button.cn-chat-active .cn-close-icon {
    display: block;
}

/* Notification Badge */
.cn-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff3b30;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Chat Window */
.cn-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 166, 255, 0.3), 0 0 60px rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 166, 255, 0.2);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cn-chat-window.cn-chat-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.cn-chat-header {
    padding: 20px;
    background: linear-gradient(135deg, rgba(0, 166, 255, 0.15) 0%, rgba(0, 102, 204, 0.1) 100%);
    border-bottom: 1px solid rgba(0, 166, 255, 0.2);
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cn-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cn-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d4ff, #00a6ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 16px;
}

.cn-header-title {
    font-weight: 600;
    color: white;
    font-size: 16px;
}

.cn-header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.cn-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34c759;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.cn-minimize-button {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.cn-minimize-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.cn-minimize-button svg {
    width: 18px;
    height: 18px;
    color: white;
}

/* Messages Container */
.cn-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cn-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.cn-chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.cn-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 166, 255, 0.3);
    border-radius: 3px;
}

.cn-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 166, 255, 0.5);
}

/* Message Bubbles */
.cn-message {
    display: flex;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.cn-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.cn-message-bot .cn-message-content {
    background: rgba(0, 166, 255, 0.15);
    border: 1px solid rgba(0, 166, 255, 0.2);
    color: white;
    border-radius: 12px 12px 12px 4px;
}

.cn-message-user {
    justify-content: flex-end;
}

.cn-message-user .cn-message-content {
    background: linear-gradient(135deg, #00d4ff, #00a6ff);
    color: white;
    border-radius: 12px 12px 4px 12px;
}

/* Typing Indicator */
.cn-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(0, 166, 255, 0.15);
    border: 1px solid rgba(0, 166, 255, 0.2);
    border-radius: 12px 12px 12px 4px;
    width: fit-content;
    margin: 0 20px 12px 20px;
}

.cn-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    animation: typingBounce 1.4s infinite;
}

.cn-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.cn-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-8px);
    }
}

/* Input Container */
.cn-chat-input-container {
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 166, 255, 0.2);
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
}

.cn-chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 166, 255, 0.2);
    border-radius: 8px;
    padding: 10px 14px;
    color: white;
    font-size: 14px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    outline: none;
    transition: all 0.2s ease;
}

.cn-chat-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.cn-chat-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: #00a6ff;
    box-shadow: 0 0 0 3px rgba(0, 166, 255, 0.1);
}

.cn-send-button {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, #00d4ff, #00a6ff);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.cn-send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.4);
}

.cn-send-button svg {
    width: 18px;
    height: 18px;
    color: white;
}

/* Footer */
.cn-chat-footer {
    padding: 10px 20px;
    text-align: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    border-top: 1px solid rgba(0, 166, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0 0 16px 16px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .cn-chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        bottom: 70px;
    }

    .cn-chat-button {
        width: 56px;
        height: 56px;
    }

    .cn-chat-button svg {
        width: 26px;
        height: 26px;
    }
}