f/* THIAide AI Chat - Complete CSS */

#thiaide-chat-container {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Position */
.thiaide-chat-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.thiaide-chat-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Chat Button */
.thiaide-chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #007cba, #005a87);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    z-index: 100001;
    box-shadow: 0 8px 25px rgba(0,124,186,0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.thiaide-chat-position-bottom-left .thiaide-chat-button {
    right: auto;
    left: 20px;
}

/* Chat Window */
.thiaide-chat-window {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 600px;
    height: 600px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100000;
    display: none; /* Hidden by default */
}

.thiaide-chat-position-bottom-left .thiaide-chat-window {
    right: auto;
    left: 20px;
}

/* Header */
.thiaide-chat-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.6) 0%, rgba(118, 75, 162, 0.6) 100%);
backdrop-filter: blur(10px);
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.thiaide-chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.thiaide-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.thiaide-chat-info {
    display: flex;
    flex-direction: column;
}

.thiaide-chat-title {
    font-weight: 600;
    color: #fff;
    font-size: 16px;
}

.thiaide-chat-status {
    font-size: 12px;
    color: #fff;
    font-weight: 500;
}

.thiaide-chat-header-right {
    display: flex;
    gap: 8px;
}

.thiaide-chat-header-right button{
color:#fff !important;

}



.thiaide-header-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    padding: 0;
}

.thiaide-header-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Messages */
.thiaide-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 12px;
	scrollbar-width: thin;
}

/* Welcome */
.thiaide-welcome-message {
    text-align: center;
    padding:15px;
    color: #666;
    flex: 1;
    display: flex;
	font-size:17px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.thiaide-welcome-icon {
    font-size: 48px;
    margin-bottom: 16px;
	width:100px;
}

.thiaide-welcome-message h3 {
    margin: 0 0 8px 0;
    color: #1a1a1a;
    font-size: 18px;
    font-weight: 600;
}

.thiaide-welcome-message p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Message Bubbles */
.thiaide-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
}

.thiaide-message-user {
    background: linear-gradient(135deg, #007cba, #005a87);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 6px;
}

.thiaide-message-ai {
    background: white;
    color: #333;
    margin-right: auto;
    border-bottom-left-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.thiaide-message-error {
    background: #ffeaea;
    color: #d63638;
    margin: 0 auto;
    text-align: center;
    font-size: 13px;
    border-radius: 10px;
    padding: 10px 15px;
}

.thiaide-message-content {
    font-size: 16px;
}

.thiaide-message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

.thiaide-message-ai .thiaide-message-time {
    text-align: left;
    color: #999;
}

.thiaide-message-user .thiaide-message-time {
    color: rgba(255,255,255,0.8);
}

/* Typing */
.thiaide-typing-indicator {
background:#FFFFFF;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 12px;
    font-style: italic;
}

.thiaide-typing-dots {
    display: flex;
    gap: 3px;
}

.thiaide-typing-dots span {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.thiaide-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.thiaide-typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.thiaide-typing-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input */
.thiaide-chat-input-container {
    padding: 16px;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(10px);
    border-top: 1px solid #e1e5e9;
}

.thiaide-chat-input {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.thiaide-input-wrapper {
    flex: 1;
    border: 1px solid #e1e5e9;
    border-radius: 24px;
    display: flex;
    align-items: center;
    background: #f8f9fa;
}

.thiaide-message-input {
    flex: 1 !important;
    border: none !important;
    background: none !important;
    outline: none !important;
    font-size: 16px !important;
    padding: 8px !important;
    font-family: inherit !important;
    min-height: 20px !important;
}

.thiaide-message-input::placeholder {
    color: #999;
}

.thiaide-send-btn {
    background: linear-gradient(135deg, #007cba, #005a87);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}



/* Scrollbar */
.thiaide-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.thiaide-chat-messages::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 3px;
}

.thiaide-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c7d0;
    border-radius: 3px;
}

.thiaide-message-ai .thiaide-message-content h1,
.thiaide-message-ai .thiaide-message-content h2,
.thiaide-message-ai .thiaide-message-content h3 {
    margin: 10px 0;
    color: #333;
}

.thiaide-message-ai .thiaide-message-content ul,
.thiaide-message-ai .thiaide-message-content ol {
    margin: 10px 0;
    padding-left: 20px;
}

.thiaide-message-ai .thiaide-message-content li {
    margin: 5px 0;
}

.thiaide-message-ai .thiaide-message-content strong {
    font-weight: bold;
    color: #2c3e50;
}

.thiaide-message-ai .thiaide-message-content em {
    font-style: italic;
}

.thiaide-message-ai .thiaide-message-content code {
    background: #f4f4f4;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
}

.thiaide-message-ai .thiaide-message-content pre {
    background: #f4f4f4;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
}

.thiaide-message-ai .thiaide-message-content table {
    border-collapse: collapse;
    margin: 10px 0;
    width: 100%;
}

.thiaide-message-ai .thiaide-message-content th,
.thiaide-message-ai .thiaide-message-content td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.thiaide-message-ai .thiaide-message-content th {
    background-color: #f2f2f2;
    font-weight: bold;
}

/* Welcome Popup */
.thiaide-welcome-popup {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 400px;
    background: white;
	font-size:16px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 99998;
    animation: thiaideSlideIn 0.3s ease-out;
}

.thiaide-welcome-content {

    position: relative;
}

.thiaide-welcome-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
}

.thiaide-dynamic-welcome {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

@keyframes thiaideSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}



/* =========================================== */
/* MOBILE ONLY ENHANCEMENTS                   */
/* =========================================== */

/* Mobile container */
.thiaide-mobile {
    /* Mobile specific container styles */
}

/* Mobile button - larger touch target */
.thiaide-mobile-button {
    padding: 18px 24px !important;
    font-size: 18px !important;
    bottom: 25px !important;
    right: 25px !important;
}

/* Mobile chat window - full screen */
.thiaide-mobile-window {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    transform: none !important;
    margin: 0 !important;
    z-index: 999999 !important;
}

/* Remove desktop positioning for mobile */
.thiaide-chat-position-bottom-left .thiaide-mobile-window,
.thiaide-chat-position-bottom-right .thiaide-mobile-window {
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    transform: none !important;
    border-radius: 0 !important;
}

/* Mobile header */
.thiaide-mobile-header {
    padding: 20px !important;
    min-height: 70px !important;
}

/* Mobile avatar */
.thiaide-mobile-avatar {
    width: 50px !important;
    height: 50px !important;
}

/* Mobile messages area */
.thiaide-mobile-messages {
    padding: 20px !important;
    gap: 20px !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Mobile input */
.thiaide-mobile-message-input {
    font-size: 18px !important;
    padding: 15px !important;
    min-height: 30px !important;
}


/* Mobile welcome popup */
.thiaide-mobile-popup {
    bottom: 100px !important;
    right: 15px !important;
    left: 15px !important;
    width: auto !important;
    max-width: calc(100% - 30px) !important;
}

/* Mobile welcome message */
.thiaide-mobile-welcome {
    padding: 40px 25px !important;
    font-size: 20px !important;
}

.thiaide-mobile-welcome-icon {
    width: 120px !important;
    height: 120px !important;
    margin-bottom: 30px !important;
}

.thiaide-mobile-welcome-title {
    font-size: 26px !important;
    margin-bottom: 15px !important;
}

.thiaide-mobile-welcome-text {
    font-size: 18px !important;
    line-height: 1.6 !important;
}

/* Safe area for modern phones */
@supports (padding: max(0px)) {
    .thiaide-mobile-window {
        padding-top: env(safe-area-inset-top) !important;
    }
    
    .thiaide-mobile-header {
        padding-top: max(20px, env(safe-area-inset-top)) !important;
    }
    
    .thiaide-mobile-input-container {
        padding-bottom: max(20px, env(safe-area-inset-bottom)) !important;
    }
    
    .thiaide-mobile-button {
        bottom: max(25px, env(safe-area-inset-bottom)) !important;
    }
}

/* Hide chat text on very small screens */
@media (max-width: 380px) {
    .thiaide-mobile-button span:not(.thiaide-chat-icon):not(.thiaide-mobile-badge) {
        display: none;
    }
    
    .thiaide-mobile-button {
        padding: 15px !important;
        min-width: 55px !important;
        min-height: 55px !important;
    }
}
/* Mobile keyboard optimization */
@media (max-width: 768px) {
    #thiaide-chat-window {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
        transition: all 0.3s ease;
    }
    
    #thiaide-chat-messages {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 80px; /* Space for input */
        max-height: calc(100vh - 150px) !important;
        transition: max-height 0.3s ease;
    }
    
    .thiaide-chat-input-container {
        position: sticky;
        bottom: 0;
        background: white;
        border-top: 1px solid #e1e5e9;
        padding: 15px 20px;
        z-index: 10;
    }
    
    #thiaide-message-input {
        font-size: 16px !important; /* Prevents iOS zoom */
        line-height: 1.5 !important;
    }
    
    /* When keyboard is active */
    .keyboard-visible #thiaide-chat-messages {
        max-height: calc(50vh - 100px) !important;
    }
    
    .keyboard-visible .thiaide-chat-input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    #thiaide-chat-container {
        height: -webkit-fill-available;
    }
    
    #thiaide-chat-window {
        height: -webkit-fill-available;
    }
    
    #thiaide-message-input {
        font-size: 16px !important;
    }
}

/* Android specific fixes */
@supports not (-webkit-touch-callout: none) {
    #thiaide-message-input:focus {
        font-size: 16px !important;
    }
}