/* Digages AI Chatbot - Frontend Styles */

:root {
    --digages-primary: #6366f1;
    --digages-secondary: #8b5cf6;
    --digages-dark: #1e1b4b;
    --digages-light: #f8fafc;
    --digages-border: #e2e8f0;
    --digages-shadow: rgba(99, 102, 241, 0.2);
}

/* Chatbot Bubble */
#digages-chatbot-bubble {
    position: fixed;
    z-index: 999999;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--digages-primary) 0%, var(--digages-secondary) 100%);
    box-shadow: 0 8px 32px var(--digages-shadow), 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: digages-pulse 2s infinite;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

#digages-chatbot-bubble:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 48px var(--digages-shadow), 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: none;
}

#digages-chatbot-bubble:active {
    transform: scale(0.95);
}

#digages-chatbot-bubble.digages-minimized {
    width: 64px;
    height: 64px;
}

#digages-chatbot-bubble.digages-expanded {
    opacity: 0;
    pointer-events: none;
}

/* Position variants */
#digages-chatbot-bubble.digages-bottom-right {
    bottom: 24px;
    right: 24px;
}

#digages-chatbot-bubble.digages-bottom-left {
    bottom: 24px;
    left: 24px;
}

#digages-chatbot-bubble.digages-top-right {
    top: 24px;
    right: 24px;
}

#digages-chatbot-bubble.digages-top-left {
    top: 24px;
    left: 24px;
}

/* Notification badge */
.digages-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 24px;
    height: 24px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    border: 3px solid white;
    animation: digages-bounce 0.5s ease-out;
}

/* Chatbot Container */
#digages-chatbot-container {
    position: fixed;
    z-index: 999998;
    width: 420px;
    height: 540px;
    border-radius: 24px;
    background: white;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px var(--digages-border);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: scale(0.9) translateY(20px);
}

#digages-chatbot-container.digages-visible {
    display: flex;
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Position variants for container */
#digages-chatbot-container.digages-bottom-right {
    bottom: 70px;
    right: 24px;
}

#digages-chatbot-container.digages-bottom-left {
    bottom: 70px;
    left: 24px;
}

#digages-chatbot-container.digages-top-right {
    top: 70px;
    right: 24px;
}

#digages-chatbot-container.digages-top-left {
    top: 70px;
    left: 24px;
}

/* Chatbot Header */
.digages-chatbot-header {
    background: linear-gradient(135deg, var(--digages-primary) 0%, var(--digages-secondary) 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.digages-chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.2), transparent);
    pointer-events: none;
}

.digages-chatbot-header-content {
    flex: 1;
    position: relative;
    z-index: 1;
}

.digages-chatbot-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 4px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    letter-spacing: -0.02em;
    color: #fff;
}

.digages-chatbot-subtitle {
    font-size: 13px;
    opacity: 0.9;
    margin: 0;
    font-weight: 500;
}

.digages-chatbot-actions {
    display: flex;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.digages-action-btn {
    width: 36px !important;
    height: 36px !important;
    border: none !important;
    background: transparent !important;
    color: white !important;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    backdrop-filter: blur(10px) !important;
}

.digages-action-btn:hover {
    background: transparent !important;
    transform: scale(1.1);
}

.digages-action-btn:active {
    transform: scale(0.95);
}

/* Chat Messages Container */
.digages-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(to bottom, #fafbfc 0%, #f8fafc 100%);
    scroll-behavior: smooth;
}

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

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

.digages-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.digages-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Message Styles */
.digages-message {
    margin-bottom: 16px;
    display: flex;
    animation: digages-slideIn 0.3s ease-out;
}

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

.digages-message-content {
    max-width: 75%;
    padding: 14px 18px;
    border-radius: 18px;
    word-wrap: break-word;
    font-size: 15px;
    line-height: 1.5;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

.digages-message.digages-user .digages-message-content {
    background: linear-gradient(135deg, var(--digages-primary) 0%, var(--digages-secondary) 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 12px var(--digages-shadow);
}

.digages-message.digages-bot .digages-message-content {
    background: white;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* Message metadata */
.digages-message-meta {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    opacity: 0.7;
}

.digages-confidence {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.05);
}

.digages-confidence.digages-high {
    color: #059669;
    background: rgba(5, 150, 105, 0.1);
}

.digages-confidence.digages-medium {
    color: #d97706;
    background: rgba(217, 119, 6, 0.1);
}

.digages-confidence.digages-low {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
}

.digages-context-note {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-style: italic;
    color: var(--digages-primary);
}

/* Typing indicator */
.digages-typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}

.digages-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--digages-primary);
    border-radius: 50%;
    animation: digages-typing 1.4s infinite;
}

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

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

/* Status message */
.digages-status-message {
    text-align: center;
    padding: 12px;
    margin: 8px 0;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

.digages-status-message.digages-loading {
    background: #fef3c7;
    color: #92400e;
}

.digages-status-message.digages-ready {
    background: #d1fae5;
    color: #065f46;
}

.digages-status-message.digages-error {
    background: #fee2e2;
    color: #991b1b;
}

/* Input Container */
.digages-chat-input-container {
    padding: 16px 20px 20px;
    background: white;
    border-top: 1px solid var(--digages-border);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.digages-chat-input-wrapper {
    flex: 1;
    position: relative;
}

.digages-chat-input {
    width: 100%;
    padding: 14px 48px 14px 18px;
    border: 2px solid var(--digages-border);
    border-radius: 16px;
    font-size: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    outline: none;
    transition: all 0.2s;
    resize: none;
    max-height: 120px;
    min-height: 48px;
    line-height: 1.5;
    overflow-x: visible !important;
    overflow-y: clip !important;
}

.digages-chat-input:focus {
    border-color: var(--digages-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.digages-chat-input:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
    opacity: 0.6;
}

.digages-input-actions {
    position: absolute;
    right: 8px;
    bottom: 8px;
    display: flex;
    gap: 4px;
}

.digages-send-btn {
    width: 36px !important;
    height: 36px !important;
    border: none !important;
    background: transparent !important;
    color: linear-gradient(135deg, var(--digages-primary) 0%, var(--digages-secondary) 100%) !important;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s; 
}

.digages-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    /* box-shadow: 0 4px 12px var(--digages-shadow); */
}

.digages-send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.digages-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Animations */
@keyframes digages-pulse {
    0%, 100% {
        box-shadow: 0 8px 32px var(--digages-shadow), 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 8px 40px var(--digages-shadow), 0 2px 8px rgba(0, 0, 0, 0.1), 
                    0 0 0 8px rgba(99, 102, 241, 0.15);
    }
}

@keyframes digages-bounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

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

@keyframes digages-typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    #digages-chatbot-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        top: 0 !important;
    }
    
    #digages-chatbot-bubble {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
    
    .digages-message-content {
        max-width: 85%;
    }
}

/* Print styles */
@media print {
    #digages-chatbot-bubble,
    #digages-chatbot-container {
        display: none !important;
    }
}

#digages-clear-btn
{
    display: none !important;
}

#digages-close-btn
{
    display: none !important;
}

.digages-bot .digages-message-content .digages-aichat-inner-link {
    text-decoration: underline !important;
}

.digages-user .digages-message-content .digages-aichat-inner-link {
    text-decoration: underline !important;
    color: white !important;
}
 