/**
 * Froala AI Chatbot Styles
 * Version: 1.0.0
 * Author: Froala Team
 */

/* Main Container */
#froala-ai-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
}

/* Chat Icon Styles */
.froala-chat-icon {
    width: 60px;
    height: 60px;
    background: #0098f7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 152, 247, 0.4);
    transition: all 0.3s ease;
    color: white;
    position: relative;
}

.froala-chat-icon::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: #0098f7;
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.froala-chat-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0, 152, 247, 0.6);
}

.froala-chat-icon:hover::before {
    opacity: 1;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* Froala Brand Icon */
.froala-brand-icon {
    width: 28px;
    height: 28px;
    fill: currentColor;
    border-radius: 4px;
}

/* Chat Window Styles */
.froala-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 520px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.froala-chat-window.open {
    display: flex;
}

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

/* Chat Header */
.froala-chat-header {
    background: #0098f7;
    color: white;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
}

.froala-chat-info {
    flex: 1;
    display: flex;
    align-items: center;
}

.froala-chat-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    color: white;
    padding: 0;
}

.froala-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.froala-end-chat-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
}

.froala-end-chat-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.froala-end-chat-btn span {
    font-size: 12px;
}

.froala-chat-subtitle {
    font-size: 12px;
    opacity: 0.85;
    margin-top: 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.9);
}

.froala-status-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
}

.froala-status-dot {
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

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

.froala-status-text {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.froala-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.froala-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Chat Body */
.froala-chat-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.froala-welcome-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}


.froala-agent-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #0098f7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.froala-agent-avatar img {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.froala-message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 18px 18px 18px 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    max-width: 280px;
}

.froala-message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #374151;
}

/* User Messages */
.froala-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: flex-start;
}

.froala-user-message {
    flex-direction: row-reverse;
}

.froala-user-content {
    background: #0098f7 !important;
    color: white !important;
    border-radius: 18px 18px 6px 18px !important;
    padding: 12px 16px !important;
}

.froala-user-content p {
    color: white !important;
    margin-bottom: 0 !important;
}

/* Chat Footer */
.froala-chat-footer {
    padding: 20px 24px;
    border-top: 1px solid #e5e7eb;
    background: white;
    border-radius: 0 0 16px 16px;
}

.froala-input-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

#froala-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    background: #f9fafb;
}

#froala-chat-input:focus {
    border-color: #0098f7;
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 152, 247, 0.1);
}

#froala-chat-input::placeholder {
    color: #9ca3af;
}

.froala-send-btn {
    width: 44px;
    height: 44px;
    background: #0098f7;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 152, 247, 0.3);
}

.froala-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 152, 247, 0.4);
}

.froala-send-btn:active {
    transform: scale(0.95);
}

.froala-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Typing Indicator */
.froala-typing-indicator {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.froala-typing-content {
    background: white;
    padding: 16px;
    border-radius: 18px 18px 18px 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.froala-typing-dots {
    display: flex;
    gap: 4px;
}

.froala-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Powered by Froala */
.froala-powered-by {
    text-align: center;
    padding: 8px 16px;
    font-size: 11px;
    color: #6b7280;
    background: #f9fafb;
    border-top: 1px solid #f3f4f6;
}

.froala-powered-by a {
    color: #0098f7;
    text-decoration: none;
    font-weight: 500;
}

.froala-powered-by a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    #froala-ai-chatbot-container {
        bottom: 15px;
        right: 15px;
    }
    
    .froala-chat-window {
        width: 340px;
        height: 480px;
        bottom: 70px;
    }
    
    .froala-chat-icon {
        width: 56px;
        height: 56px;
    }
    
    .froala-brand-icon {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    .froala-chat-window {
        width: 320px;
        height: 450px;
        right: -10px;
    }
    
    .froala-chat-header,
    .froala-chat-body,
    .froala-chat-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .froala-message-content {
        max-width: 240px;
    }
}

/* Scrollbar Styling */
.froala-chat-body::-webkit-scrollbar {
    width: 4px;
}

.froala-chat-body::-webkit-scrollbar-track {
    background: transparent;
}

.froala-chat-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.froala-chat-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .froala-chat-window {
        background: #1f2937;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    }
    
    .froala-chat-body {
        background: #111827;
    }
    
    .froala-message-content {
        background: #374151;
        color: #f9fafb;
    }
    
    .froala-message-content p {
        color: #f9fafb;
    }
    
    .froala-chat-footer {
        background: #1f2937;
        border-color: #374151;
    }
    
    #froala-chat-input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    #froala-chat-input:focus {
        background: #4b5563;
    }
    
    #froala-chat-input::placeholder {
        color: #9ca3af;
    }
    
    .froala-typing-content {
        background: #374151;
    }
}

/* Markdown Styles for Bot Messages */
.froala-message-content h1,
.froala-message-content h2,
.froala-message-content h3 {
    margin: 0 0 8px 0;
    font-weight: 600;
    color: #1f2937;
}

.froala-message-content h1 {
    font-size: 18px;
}

.froala-message-content h2 {
    font-size: 16px;
}

.froala-message-content h3 {
    font-size: 14px;
}

.froala-message-content strong {
    font-weight: 600;
    color: #1f2937;
}

.froala-message-content em {
    font-style: italic;
}

.froala-message-content code {
    background: #f3f4f6;
    color: #dc2626;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 12px;
}

.froala-message-content pre {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 12px;
    line-height: 1.4;
}

.froala-message-content pre code {
    background: transparent;
    color: #374151;
    padding: 0;
    border-radius: 0;
}

.froala-message-content ul,
.froala-message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.froala-message-content li {
    margin-bottom: 4px;
    font-size: 14px;
    line-height: 1.5;
}

.froala-message-content a {
    color: #2563eb;
    text-decoration: none;
}

.froala-message-content a:hover {
    text-decoration: underline;
}

.froala-message-content br {
    line-height: 1.5;
}

/* Feedback Form Styles */
.froala-feedback-form {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    border-radius: 16px;
    padding: 24px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.froala-feedback-header {
    text-align: center;
    margin-bottom: 24px;
}

.froala-feedback-header h5 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.froala-feedback-header p {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.4;
}

.froala-feedback-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.froala-rating-section {
    text-align: center;
}

.froala-rating-section label {
    display: block;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.froala-rating-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.froala-rating-btn {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.froala-rating-btn:hover {
    border-color: #0098f7;
    transform: scale(1.05);
}

.froala-rating-btn.selected {
    background: #0098f7;
    border-color: #0098f7;
    color: white;
    transform: scale(1.1);
}

.froala-feedback-text-section {
    flex: 1;
}

.froala-feedback-text-section label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.froala-feedback-textarea {
    width: 100%;
    padding: 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

.froala-feedback-textarea:focus {
    border-color: #0098f7;
    box-shadow: 0 0 0 3px rgba(0, 152, 247, 0.1);
}

.froala-char-counter {
    text-align: right;
    margin-top: 4px;
    font-size: 12px;
    color: #9ca3af;
}

.froala-feedback-actions {
    display: flex;
    gap: 12px;
    margin-top: auto;
    padding-top: 20px;
}

.froala-feedback-skip-btn {
    flex: 1;
    padding: 12px 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.froala-feedback-skip-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.froala-feedback-submit-btn {
    flex: 2;
    padding: 12px 16px;
    background: #0098f7;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 152, 247, 0.3);
}

.froala-feedback-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 152, 247, 0.4);
}

.froala-feedback-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Dark mode feedback form */
@media (prefers-color-scheme: dark) {
    .froala-feedback-form {
        background: #1f2937;
    }
    
    .froala-feedback-header h5 {
        color: #f9fafb;
    }
    
    .froala-feedback-header p {
        color: #9ca3af;
    }
    
    .froala-rating-section label,
    .froala-feedback-text-section label {
        color: #f3f4f6;
    }
    
    .froala-rating-btn {
        background: #374151;
        border-color: #4b5563;
    }
    
    .froala-rating-btn:hover {
        border-color: #0098f7;
    }

    .froala-feedback-textarea {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }

    .froala-feedback-textarea:focus {
        background: #4b5563;
        border-color: #0098f7;
    }
    
    .froala-feedback-skip-btn {
        background: #374151;
        border-color: #4b5563;
        color: #d1d5db;
    }
    
    .froala-feedback-skip-btn:hover {
        background: #4b5563;
        border-color: #6b7280;
    }
}
