/*---- START Chat Support Component Styles ----*/
.chat-support-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Montserrat', sans-serif;
}

/* Floating Chat Button */
.chat-float-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #17313f, #456978);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(28, 55, 80, 0.3);
    transition: all 0.3s ease;
    position: relative;
    animation: float 3s ease-in-out infinite;
}

.chat-float-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(28, 55, 80, 0.4);
}

.chat-float-button i {
    font-size: 24px;
}

.chat-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4c51;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid white;
}

/* Float Animation */
@keyframes float {

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

    50% {
        transform: translateY(-5px);
    }
}

/* Chat Panel */
.chat-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(20px) scale(0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.chat-panel-open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    z-index: 9;
    justify-content: space-between;
}

.chat-panel-minimized {
    height: 60px;
}

.chat-panel-minimized .chat-messages,
.chat-panel-minimized .chat-input-area {
    display: none;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #17313f, #456978);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
}

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

.chat-status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #56ca00;
    position: relative;
}

.chat-status-indicator.online::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #56ca00;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

.chat-header-text h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-status-text {
    font-size: 12px;
    opacity: 0.8;
    margin: 0;
}

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

.chat-minimize-btn,
.chat-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chat-minimize-btn:hover,
.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
}

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

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

/* Chat Message Styles */
.chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 5px;
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    /* margin-top: auto; */
}

.support-message .message-avatar {
    background: linear-gradient(135deg, #17313f, #456978);
    color: white;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #17313f, #b8a890);
    color: white;
}

.message-content {
    max-width: 70%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-text {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.user-message .message-text {
    background: #1c3750;
    color: white;
    border: 1px solid #1c3750;
}

.message-time {
    font-size: 11px;
    color: #64748b;
    padding: 0 8px;
}

.user-message .message-time {
    text-align: right;
}

/* Typing Indicator */
.typing-indicator .message-text {
    background: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #64748b;
    border-radius: 50%;
    animation: typing 1.5s infinite;
}

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

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

@keyframes typing {

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

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

/* Chat Input Area */
.chat-input-area {
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 15px 20px 12px;
}

.chat-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 2px solid #e5e7eb;
    border-radius: 25px;
    padding: 8px 12px;
    transition: border-color 0.2s ease;
}

.chat-input-container:focus-within {
    border-color: #1c3750;
    background: white;
}

.chat-attachment-btn,
.chat-emoji-btn {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.chat-attachment-btn:hover,
.chat-emoji-btn:hover {
    background: #e2e8f0;
    color: #1c3750;
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 4px;
    font-size: 14px;
    outline: none;
    color: #17313f;
}

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

.chat-send-btn {
    background: #17313f;
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: #203f5b;
    transform: scale(1.05);
}

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

.chat-input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 11px;
    color: #64748b;
}

.chat-character-count {
    font-weight: 500;
}

.chat-powered-by {
    font-weight: 500;
}

/* Chat Overlay for Mobile */
.chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 5;
}

.chat-overlay-active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .chat-support-container {
        bottom: 15px;
        right: 15px;
    }

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

    .chat-float-button i {
        font-size: 22px;
    }

    .chat-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }

    .chat-panel-open {
        transform: translateY(0);
    }

    .chat-panel-minimized {
        height: 60px;
        top: auto;
        bottom: 80px;
        left: 15px;
        right: 15px;
        width: auto;
        border-radius: 12px;
    }

    .message-content {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .chat-messages {
        padding: 15px;
        gap: 12px;
    }

    .chat-input-area {
        padding: 12px 15px 10px;
    }

    .chat-header {
        padding: 12px 15px;
    }

    .message-text {
        font-size: 13px;
        padding: 10px 14px;
    }
}

/* Dark Mode Support */

.dark .chat-messages {
    background: #0f0f0f;
}

.dark .message-text {
    background: #374151;
    color: white;
    border-color: #4b5563;
}

.dark .support-message .message-text {
    background: #374151;
    color: white;
}

.dark .chat-input-container {
    background: #374151;
    border-color: #4b5563;
}

.dark .chat-input-container:focus-within {
    border-color: #17313f;
    background: #4b5563;
}

.dark .chat-input {
    color: white;
}

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

.dark .chat-input-area,
.dark .chat-panel {
    background: #000000;
    border-color: #ffffff;
}

.dark .chat-attachment-btn:hover,
.dark .chat-emoji-btn:hover {
    background: #4b5563;
}

/* Loading/Disabled States */
.chat-input:disabled {
    background-color: #f3f4f6 !important;
    color: #9ca3af !important;
    cursor: not-allowed;
}

.chat-send-btn:disabled {
    background-color: #9ca3af !important;
    cursor: not-allowed;
    transform: none !important;
}

.chat-send-btn:disabled:hover {
    background-color: #9ca3af !important;
    transform: none !important;
}

/* Connection Status Indicators */
.chat-connection-status {
    position: absolute;
    bottom: -8px;
    right: 10px;
    font-size: 10px;
    color: #64748b;
}

.chat-connection-status.connecting {
    color: #f59e0b;
}

.chat-connection-status.connected {
    color: #10b981;
}

.chat-connection-status.error {
    color: #ef4444;
}

/* Error Message Styles */
.chat-error-message {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.dark .chat-error-message {
    background: #450a0a;
    color: #fca5a5;
    border-color: #7f1d1d;
}

/* API Response Message Formatting */
.chat-message .message-text {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Markdown Content Styling */
.markdown-content {
    line-height: 1.6;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    margin: 12px 0 8px 0;
    font-weight: 600;
    line-height: 1.3;
}

.markdown-content h1 {
    font-size: 18px;
    color: #1f2937;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 4px;
}

.markdown-content h2 {
    font-size: 16px;
    color: #374151;
}

.markdown-content h3 {
    font-size: 14px;
    color: #4b5563;
}

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

.markdown-content em {
    font-style: italic;
    color: #4b5563;
}

.markdown-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: #dc2626;
    border: 1px solid #e5e7eb;
}

.markdown-content pre {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    line-height: 1.4;
}

.markdown-content pre code {
    background: none;
    padding: 0;
    border: none;
    color: #374151;
}

.markdown-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.markdown-content li {
    margin: 4px 0;
    list-style-type: disc;
}

.markdown-content blockquote {
    border-left: 3px solid #1c3750;
    margin: 8px 0;
    padding: 8px 12px;
    background: #f8fafc;
    font-style: italic;
    color: #4b5563;
}

.markdown-content a {
    color: #1c3750;
    text-decoration: underline;
    font-weight: 500;
}

.markdown-content a:hover {
    color: #203f5b;
    text-decoration: none;
}

.markdown-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 16px 0;
}

/* Dark mode markdown styles */
.dark .markdown-content h1 {
    color: #f9fafb;
    border-color: #4b5563;
}

.dark .markdown-content h2 {
    color: #e5e7eb;
}

.dark .markdown-content h3 {
    color: #d1d5db;
}

.dark .markdown-content strong {
    color: #f9fafb;
}

.dark .markdown-content em {
    color: #d1d5db;
}

.dark .markdown-content code {
    background: #374151;
    color: #fca5a5;
    border-color: #4b5563;
}

.dark .markdown-content pre {
    background: #1f2937;
    border-color: #4b5563;
}

.dark .markdown-content pre code {
    color: #e5e7eb;
}

.dark .markdown-content blockquote {
    border-color: #17313f;
    background: #1f2937;
    color: #d1d5db;
}

.dark .markdown-content a {
    color: #17313f;
}

.dark .markdown-content a:hover {
    color: #b8a890;
}

.dark .markdown-content hr {
    border-color: #4b5563;
}

/* Chat Session Indicator */
.chat-session-info {
    padding: 8px 16px;
    background: #f0f9ff;
    border: 1px solid #e0f2fe;
    border-radius: 8px;
    margin: 10px 20px;
    font-size: 12px;
    color: #0369a1;
    text-align: center;
}

.dark .chat-session-info {
    background: #0c4a6e;
    border-color: #075985;
    color: #7dd3fc;
}

/*---- END Chat Support Component Styles ----*/

/* Chat Support Redirection Styles */
.chat-redirect-message {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
    border: 1px solid #10b981 !important;
    animation: pulse-redirect 2s infinite;
}

.chat-countdown-message {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: white !important;
    border: 1px solid #f59e0b !important;
    font-weight: 600;
    text-align: center;
}

@keyframes pulse-redirect {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

/* Support redirect loading indicator */
.redirect-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.redirect-loading .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

div#chat-area {
    overflow-y: auto !important;
}

body input#chatInput:focus {
    outline: none !important;
    border: 0 !important;
    box-shadow: unset !important;
}
