/* Chat Widget Styles - Absolute App Labs */
/* Matches the design and aesthetics of absoluteapplabs.com */

:root {
    --chat-primary-blue: #274DA1;
    --chat-light-blue: #74D0F1;
    --chat-dark-text: #3D3C45;
    --chat-white: #FFFFFF;
    --chat-gray-bg: #F5F5F5;
    --chat-border: #E6E6E6;
    --chat-font-primary: "Manrope", sans-serif;
    --chat-font-secondary: "Urbanist", sans-serif;
}

/* Floating Chat Button */
.chat-widget-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: var(--chat-font-primary);
}

.chat-widget-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(89.39deg, var(--chat-primary-blue) 0.53%, var(--chat-light-blue) 117.25%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(39, 77, 161, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.chat-widget-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(39, 77, 161, 0.6);
}

.chat-widget-button:active {
    transform: scale(0.95);
}

.chat-widget-button svg {
    width: 28px;
    height: 28px;
    fill: var(--chat-white);
    transition: transform 0.3s ease;
}

.chat-widget-button.active svg {
    transform: rotate(45deg);
}

/* Notification Badge */
.chat-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #FF4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-height: 600px;
    height: 600px;
    border-radius: 11px;
    background: var(--chat-white);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Chat Header */
.chat-header {
    background: linear-gradient(89.39deg, var(--chat-primary-blue) 0.53%, var(--chat-light-blue) 117.25%);
    color: var(--chat-white);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--chat-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: var(--chat-primary-blue);
}

.chat-header-info h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    font-family: var(--chat-font-secondary);
}

.chat-header-info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

.chat-header-btn {
    background: none;
    border: none;
    color: var(--chat-white);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.chat-header-btn:hover {
    opacity: 0.8;
}

.chat-header-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Chat Messages Container */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--chat-white);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: var(--chat-gray-bg);
}

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* Message Bubbles */
.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    animation: slideIn 0.3s ease;
}

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

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

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

.message-bubble {
    padding: 12px 16px;
    border-radius: 11px;
    font-size: 15px;
    line-height: 22px;
    word-wrap: break-word;
}

.chat-message.user .message-bubble {
    background: linear-gradient(89.39deg, var(--chat-primary-blue) 0.53%, var(--chat-light-blue) 117.25%);
    color: var(--chat-white);
    border-radius: 11px 11px 0 11px;
}

.chat-message.bot .message-bubble {
    background: var(--chat-gray-bg);
    color: var(--chat-dark-text);
    border-radius: 11px 11px 11px 0;
}

.message-timestamp {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    align-self: flex-end;
}

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

/* Message Sources */
.message-sources {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.source-link {
    font-size: 13px;
    color: var(--chat-primary-blue);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(39, 77, 161, 0.08);
    border-radius: 5px;
    transition: background 0.2s;
}

.source-link:hover {
    background: rgba(39, 77, 161, 0.15);
}

.source-link svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--chat-gray-bg);
    border-radius: 11px 11px 11px 0;
    max-width: 75px;
}

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

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

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

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

/* Feedback Buttons */
.message-feedback {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.feedback-btn {
    background: none;
    border: 1px solid var(--chat-border);
    border-radius: 5px;
    padding: 4px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--chat-dark-text);
    transition: all 0.2s;
}

.feedback-btn:hover {
    border-color: var(--chat-primary-blue);
    color: var(--chat-primary-blue);
}

.feedback-btn.active {
    background: var(--chat-primary-blue);
    border-color: var(--chat-primary-blue);
    color: var(--chat-white);
}

.feedback-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Chat Input */
.chat-input-container {
    padding: 16px 20px;
    background: var(--chat-white);
    border-top: 1px solid var(--chat-border);
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    border: 1px solid var(--chat-border);
    border-radius: 7px;
    padding: 12px 16px;
    font-size: 15px;
    font-family: var(--chat-font-primary);
    color: var(--chat-dark-text);
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: border-color 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--chat-primary-blue);
}

.chat-input::placeholder {
    color: #999;
}

.chat-send-btn {
    background: linear-gradient(89.39deg, var(--chat-primary-blue) 0.53%, var(--chat-light-blue) 117.25%);
    border: none;
    border-radius: 7px;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    min-width: 44px;
    min-height: 44px;
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(39, 77, 161, 0.3);
}

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

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

.chat-send-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--chat-white);
}

/* Welcome Message */
.chat-welcome {
    text-align: center;
    padding: 40px 20px;
    color: var(--chat-dark-text);
}

.chat-welcome-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    background: linear-gradient(89.39deg, var(--chat-primary-blue) 0.53%, var(--chat-light-blue) 117.25%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-welcome-icon svg {
    width: 32px;
    height: 32px;
    fill: var(--chat-white);
}

.chat-welcome h4 {
    font-family: var(--chat-font-secondary);
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--chat-primary-blue);
}

.chat-welcome p {
    font-size: 14px;
    margin: 0 0 20px;
    line-height: 20px;
}

.chat-quick-questions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-question-btn {
    background: var(--chat-gray-bg);
    border: 1px solid var(--chat-border);
    border-radius: 7px;
    padding: 12px;
    font-size: 14px;
    color: var(--chat-dark-text);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.quick-question-btn:hover {
    background: var(--chat-white);
    border-color: var(--chat-primary-blue);
    color: var(--chat-primary-blue);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 32px);
        right: 16px;
        bottom: 90px;
        max-height: calc(100vh - 120px);
    }
    
    .chat-widget-container {
        right: 16px;
        bottom: 16px;
    }
}

@media (max-width: 768px) {
    .chat-message {
        max-width: 85%;
    }
}

/* Accessibility */
.chat-widget-button:focus,
.chat-header-btn:focus,
.feedback-btn:focus,
.chat-send-btn:focus,
.quick-question-btn:focus,
.quick-reply-btn:focus {
    outline: 2px solid var(--chat-primary-blue);
    outline-offset: 2px;
}

/* Quick Replies (Product Bubbles) */
.quick-replies-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

.quick-reply-btn {
    background: var(--chat-primary-blue);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(39, 77, 161, 0.15);
}

.quick-reply-btn:hover {
    background: var(--chat-primary-blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(39, 77, 161, 0.25);
}

.quick-reply-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(39, 77, 161, 0.15);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
