/**
 * edevis Chat Widget - Styles
 */

@import url('https://fonts.googleapis.com/css2?family=Albert+Sans:wght@400;500;600;700&display=swap');

:root {
    --edevis-chat-primary: #4d65ff;
    --edevis-chat-primary-dark: #3b52d4;
    --edevis-chat-primary-light: #e8ebff;
    --edevis-chat-white: #ffffff;
    --edevis-chat-gray-50: #f9fafb;
    --edevis-chat-gray-100: #f3f4f6;
    --edevis-chat-gray-200: #e5e7eb;
    --edevis-chat-gray-300: #d1d5db;
    --edevis-chat-gray-400: #9ca3af;
    --edevis-chat-gray-500: #6b7280;
    --edevis-chat-gray-600: #4b5563;
    --edevis-chat-gray-700: #374151;
    --edevis-chat-gray-800: #1f2937;
    --edevis-chat-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    --edevis-chat-shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.2);
    --edevis-chat-radius: 12px;
    --edevis-chat-radius-sm: 6px;
    --edevis-chat-font: 'Albert Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Container */
.edevis-chat-container {
    font-family: var(--edevis-chat-font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--edevis-chat-gray-800);
    position: fixed;
    bottom: var(--edevis-chat-position-bottom, 20px);
    right: var(--edevis-chat-position-right, 20px);
    z-index: 999999;
}

.edevis-chat-container *,
.edevis-chat-container *::before,
.edevis-chat-container *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Launcher Button */
.edevis-chat-launcher {
    width: var(--edevis-chat-launcher-size, 65px);
    height: var(--edevis-chat-launcher-size, 65px);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--edevis-chat-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
    outline: none;
    background: transparent;
    padding: 0;
    overflow: hidden;
}

.edevis-chat-launcher:hover {
    transform: scale(1.05);
    box-shadow: var(--edevis-chat-shadow-lg);
}

.edevis-chat-launcher.edevis-chat-hidden {
    display: none;
}

.edevis-chat-launcher-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Widget Window */
.edevis-chat-widget {
    position: absolute;
    bottom: var(--edevis-chat-position-bottom, 20px);
    right: 0;
    width: var(--edevis-chat-widget-width, 400px);
    max-width: calc(100vw - 40px);
    height: var(--edevis-chat-widget-height, 600px);
    min-height: var(--edevis-chat-widget-min-height, 400px);
    max-height: var(--edevis-chat-widget-max-height, 90vh);
    background: var(--edevis-chat-white);
    border-radius: var(--edevis-chat-radius);
    box-shadow: var(--edevis-chat-shadow-lg);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: edevis-chat-slideUp 0.3s ease;
}

.edevis-chat-widget.edevis-chat-visible {
    display: flex;
}

@keyframes edevis-chat-slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.edevis-chat-header {
    background: var(--edevis-chat-primary);
    color: var(--edevis-chat-white);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.edevis-chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.edevis-chat-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

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

.edevis-chat-header-title {
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
}

.edevis-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.edevis-chat-header-btn {
    background: none;
    border: none;
    color: var(--edevis-chat-white);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.edevis-chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.edevis-chat-header-btn svg {
    width: 18px;
    height: 18px;
}

/* Content */
.edevis-chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Chat Area */
.edevis-chat-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Messages */
.edevis-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    scroll-padding-top: 16px;
}

.edevis-chat-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.edevis-chat-message-user {
    align-self: flex-end;
}

.edevis-chat-message-bot {
    align-self: flex-start;
}

.edevis-chat-message-bubble {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.edevis-chat-message-bubble p {
    margin: 0 0 8px 0;
}

.edevis-chat-message-bubble p:last-child {
    margin-bottom: 0;
}

.edevis-chat-message-bubble ul,
.edevis-chat-message-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.edevis-chat-message-bubble li {
    margin-bottom: 4px;
}

.edevis-chat-message-bubble strong {
    font-weight: 600;
}

.edevis-chat-message-bubble a {
    color: var(--edevis-chat-primary);
    text-decoration: underline;
}

.edevis-chat-message-bubble a:hover {
    color: var(--edevis-chat-primary-dark);
}

.edevis-chat-message-user .edevis-chat-message-bubble {
    background: var(--edevis-chat-primary);
    color: var(--edevis-chat-white);
    border-bottom-right-radius: 4px;
}

.edevis-chat-message-user .edevis-chat-message-bubble a {
    color: var(--edevis-chat-white);
    text-decoration: underline;
}

.edevis-chat-message-bot .edevis-chat-message-bubble {
    background: var(--edevis-chat-gray-100);
    color: var(--edevis-chat-gray-800);
    border-bottom-left-radius: 4px;
}

/* Message Footer */
.edevis-chat-message-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    padding: 0 2px;
}

.edevis-chat-message-footer-right {
    justify-content: flex-end;
}

.edevis-chat-message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--edevis-chat-primary);
}

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

.edevis-chat-user-avatar {
    background: var(--edevis-chat-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.edevis-chat-user-avatar svg {
    width: 16px;
    height: 16px;
    color: var(--edevis-chat-white);
}

.edevis-chat-message-actions {
    display: flex;
    gap: 6px;
}

.edevis-chat-message-action {
    background: none;
    border: none;
    color: var(--edevis-chat-gray-400);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.edevis-chat-message-action:hover {
    color: var(--edevis-chat-primary);
    background: var(--edevis-chat-gray-100);
}

/* Typing Indicator */
.edevis-chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--edevis-chat-gray-100);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.edevis-chat-typing-dot {
    width: 7px;
    height: 7px;
    background: var(--edevis-chat-gray-400);
    border-radius: 50%;
    animation: edevis-chat-bounce 1.4s infinite ease-in-out;
}

.edevis-chat-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.edevis-chat-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes edevis-chat-bounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input Area */
.edevis-chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--edevis-chat-gray-200);
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: var(--edevis-chat-white);
}

.edevis-chat-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--edevis-chat-gray-100);
    border-radius: 20px;
    padding: 10px 16px;
    border: 1px solid transparent;
}

.edevis-chat-input-wrapper:focus-within {
    border-color: var(--edevis-chat-primary);
    background: var(--edevis-chat-white);
}

.edevis-chat-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 14px;
    font-family: var(--edevis-chat-font);
    resize: none;
    max-height: 80px;
    min-height: 20px;
    outline: none;
    color: var(--edevis-chat-gray-800);
    overflow-y: auto;
}

.edevis-chat-input::placeholder {
    color: var(--edevis-chat-gray-400);
}

.edevis-chat-send-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    border-radius: 50%;
    background: var(--edevis-chat-primary);
    color: var(--edevis-chat-white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.edevis-chat-send-btn:hover {
    background: var(--edevis-chat-primary-dark);
}

.edevis-chat-send-btn:disabled {
    background: var(--edevis-chat-gray-300);
    cursor: not-allowed;
    color: var(--edevis-chat-gray-500);
}

.edevis-chat-send-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
}

/* Scrollbar */
.edevis-chat-messages::-webkit-scrollbar {
    width: 5px;
}

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

.edevis-chat-messages::-webkit-scrollbar-thumb {
    background: var(--edevis-chat-gray-300);
    border-radius: 3px;
}

/* Copy Success Tooltip */
.edevis-chat-copy-tooltip {
    position: absolute;
    background: var(--edevis-chat-gray-800);
    color: var(--edevis-chat-white);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.edevis-chat-copy-tooltip.edevis-chat-visible {
    opacity: 1;
}

/* Mobile Styles */
@media (max-width: 480px) {
    .edevis-chat-container {
        bottom: var(--edevis-chat-position-bottom-mobile, 10px);
        right: var(--edevis-chat-position-right-mobile, 10px);
    }

    /* Fullscreen widget on mobile */
    .edevis-chat-widget {
        position: fixed;
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        min-height: unset;
        border-radius: 0;
    }

    .edevis-chat-launcher {
        width: var(--edevis-chat-launcher-size-mobile, 55px);
        height: var(--edevis-chat-launcher-size-mobile, 55px);
    }
}
