/* ==========================================================================
   MICT Intelligent Chat Assistant Styles
   ========================================================================== */

/* Floating Launcher Button */
.mict-chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e11d48, #991b1b);
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(225, 29, 72, 0.4), 0 2px 6px rgba(0,0,0,0.15);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.mict-chat-launcher:hover {
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 12px 30px rgba(225, 29, 72, 0.55), 0 4px 10px rgba(0,0,0,0.2);
}

.mict-chat-launcher:active {
    transform: scale(0.95);
}

.mict-chat-launcher svg {
    width: 28px;
    height: 28px;
    stroke: #ffffff;
    transition: transform 0.3s ease;
}

.mict-chat-launcher .icon-close {
    display: none;
}

.mict-chat-launcher.is-open .icon-chat {
    display: none;
}

.mict-chat-launcher.is-open .icon-close {
    display: block;
    transform: rotate(90deg);
}

.mict-chat-launcher.is-open {
    background: linear-gradient(135deg, #374151, #1f2937);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* Online Pulse Badge on Launcher */
.mict-chat-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #10b981;
    border: 2px solid #ffffff;
    border-radius: 50%;
}

.mict-chat-badge::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #10b981;
    opacity: 0.6;
    animation: mict-pulse 2s infinite ease-out;
}

@keyframes mict-pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.4); opacity: 0; }
}

/* Chat Widget Window Container */
.mict-chat-widget {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: #18181b;
    color: #f4f4f5;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 99998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mict-chat-widget.is-open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

/* Light Theme Support */
[data-theme="light"] .mict-chat-widget {
    background: #ffffff;
    color: #18181b;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* Header */
.mict-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(135deg, #1f2937, #111827);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

[data-theme="light"] .mict-chat-header {
    background: linear-gradient(135deg, #f9fafb, #f3f4f6);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    color: #111827;
}

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

.mict-chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #e11d48, #991b1b);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(225, 29, 72, 0.3);
}

.mict-chat-title-group h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.mict-chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #9ca3af;
}

[data-theme="light"] .mict-chat-status {
    color: #6b7280;
}

.mict-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
}

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

.mict-chat-btn-icon {
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mict-chat-btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

[data-theme="light"] .mict-chat-btn-icon:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #111827;
}

/* Chat Messages Scroll Container */
.mict-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.mict-chat-body::-webkit-scrollbar {
    width: 5px;
}

.mict-chat-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

[data-theme="light"] .mict-chat-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

/* Message Rows */
.mict-message-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: mict-fade-in 0.25s ease-out;
}

@keyframes mict-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.mict-message-row.is-user {
    justify-content: flex-end;
}

.mict-bot-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, #e11d48, #991b1b);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.mict-message-bubble {
    max-width: 82%;
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
}

.mict-message-row.is-bot .mict-message-bubble {
    background: #27272a;
    color: #f4f4f5;
    border-top-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .mict-message-row.is-bot .mict-message-bubble {
    background: #f4f4f5;
    color: #18181b;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.mict-message-row.is-user .mict-message-bubble {
    background: linear-gradient(135deg, #e11d48, #be123c);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.25);
}

/* Markdown formatting inside bubbles */
.mict-message-bubble p {
    margin: 0 0 8px 0;
}

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

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

.mict-message-bubble code {
    background: rgba(0, 0, 0, 0.25);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: ui-monospace, monospace;
    font-size: 12px;
}

[data-theme="light"] .mict-message-row.is-bot .mict-message-bubble code {
    background: rgba(0, 0, 0, 0.08);
}

.mict-message-bubble a {
    color: #f43f5e;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
}

[data-theme="light"] .mict-message-row.is-bot .mict-message-bubble a {
    color: #be123c;
}

.mict-message-row.is-user .mict-message-bubble a {
    color: #ffffff;
    text-decoration: underline;
}

.mict-chat-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 12px;
    background: rgba(225, 29, 72, 0.15);
    color: #f43f5e !important;
    border: 1px solid rgba(225, 29, 72, 0.3);
    border-radius: 8px;
    text-decoration: none !important;
    font-size: 12.5px;
    font-weight: 600;
    transition: all 0.2s;
}

.mict-chat-cta-btn:hover {
    background: #e11d48;
    color: #ffffff !important;
    border-color: #e11d48;
}

/* Quick Suggestion Chips Container */
.mict-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.mict-chip {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #d1d5db;
    padding: 6px 11px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.mict-chip:hover {
    background: #e11d48;
    border-color: #e11d48;
    color: #ffffff;
    transform: translateY(-1px);
}

[data-theme="light"] .mict-chip {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #374151;
}

[data-theme="light"] .mict-chip:hover {
    background: #e11d48;
    border-color: #e11d48;
    color: #ffffff;
}

/* Typing Indicator */
.mict-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #27272a;
    border-radius: 14px;
    width: fit-content;
    border-top-left-radius: 4px;
}

[data-theme="light"] .mict-typing-indicator {
    background: #f4f4f5;
}

.mict-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
    animation: mict-bounce 1.4s infinite ease-in-out both;
}

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

@keyframes mict-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Chat Input Footer Area */
.mict-chat-footer {
    padding: 12px 14px;
    background: #18181b;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .mict-chat-footer {
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.mict-input-wrap {
    display: flex;
    align-items: center;
    background: #27272a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 4px 6px 4px 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

[data-theme="light"] .mict-input-wrap {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.mict-input-wrap:focus-within {
    border-color: #e11d48;
    box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.2);
}

.mict-chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: inherit;
    font-size: 13.5px;
    outline: none;
    padding: 8px 0;
}

.mict-chat-input::placeholder {
    color: #71717a;
}

[data-theme="light"] .mict-chat-input::placeholder {
    color: #9ca3af;
}

.mict-chat-send {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #e11d48;
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.mict-chat-send:hover {
    background: #be123c;
    transform: scale(1.05);
}

.mict-chat-send:disabled {
    background: #52525b;
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

.mict-chat-disclaimer {
    margin-top: 6px;
    font-size: 10.5px;
    color: #71717a;
    text-align: center;
}

[data-theme="light"] .mict-chat-disclaimer {
    color: #9ca3af;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .mict-chat-widget {
        bottom: 84px;
        right: 12px;
        left: 12px;
        width: auto;
        height: 75vh;
        max-height: 520px;
    }

    .mict-chat-launcher {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
    }
}
