@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

/* Reset and base styles for the widget */
.ThinkMegas-chat-widget {
    font-family: 'Inter', sans-serif;
    color: #333;
}

.ThinkMegas-chat-widget * {
    box-sizing: border-box;
}

.ThinkMegas-chat-widget .logo-of {
    width: 35px;
    height: 35px;
}

/* Floating Button */
.ThinkMegas-chat-widget .chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    z-index: 10000;
}

.ThinkMegas-chat-widget .chat-button:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.4);
}

.ThinkMegas-chat-widget .chat-button i {
    transition: transform 0.3s ease;
}

.ThinkMegas-chat-widget .chat-button.open i {
    transform: rotate(180deg);
}

/* Glassmorphism Panel */
.ThinkMegas-chat-widget .panel {
    position: fixed;
    right: 24px;
    bottom: -700px;
    width: 360px;
    max-width: calc(100vw - 48px);
    height: 540px;
    max-height: calc(100dvh - 120px);
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    transition: bottom 0.5s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.5s ease;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    opacity: 0;
    overflow: hidden;
}

.ThinkMegas-chat-widget .panel.open {
    bottom: 104px;
    opacity: 1;
}

/* Header & Tabs */
.ThinkMegas-chat-widget .tabs-container {
    padding: 20px 20px 10px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.95), rgba(30, 64, 175, 0.95));
    border-radius: 20px 20px 0 0;
    color: white;
}

.ThinkMegas-chat-widget .widget-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.ThinkMegas-chat-widget .widget-header i {
    font-size: 24px;
}

.ThinkMegas-chat-widget .widget-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.ThinkMegas-chat-widget .tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 30px;
    padding: 4px;
    gap: 4px;
}

.ThinkMegas-chat-widget .tabs button {
    flex: 1;
    border: none;
    padding: 8px 0;
    cursor: pointer;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-family: inherit;
    font-weight: 500;
    font-size: 13px;
    border-radius: 26px;
    transition: all 0.3s ease;
}

.ThinkMegas-chat-widget .tabs button:hover {
    color: white;
}

.ThinkMegas-chat-widget .tabs button.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Content Area */
.ThinkMegas-chat-widget .content {
    position: relative;
    flex: 1;
    overflow: hidden;
    background: transparent;
}

/* Tabs Content */
.ThinkMegas-chat-widget .tab {
    position: absolute;
    width: 100%;
    height: 100%;
    padding: 20px;
    left: 100%;
    /* Slide from right */
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    visibility: hidden;
}

.ThinkMegas-chat-widget .tab.active {
    left: 0;
    opacity: 1;
    visibility: visible;
}

.ThinkMegas-chat-widget .tab.slide-left {
    left: -100%;
}

/* Custom Scrollbar for messages */
.ThinkMegas-chat-widget .scrollable {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ThinkMegas-chat-widget .scrollable::-webkit-scrollbar {
    width: 6px;
}

.ThinkMegas-chat-widget .scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.ThinkMegas-chat-widget .scrollable::-webkit-scrollbar-thumb {
    background: rgba(37, 99, 235, 0.25);
    border-radius: 10px;
}

.ThinkMegas-chat-widget .scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(37, 99, 235, 0.4);
}

/* Chat Messages */
.ThinkMegas-chat-widget .message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ThinkMegas-chat-widget .message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.ThinkMegas-chat-widget .message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.15);
}

/* Send Message Area */
.ThinkMegas-chat-widget .send-message {
    display: flex;
    margin-top: 16px;
    gap: 10px;
    background: rgba(255, 255, 255, 0.6);
    padding: 8px;
    border-radius: 30px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.ThinkMegas-chat-widget .text-msg {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    color: #333;
}

.ThinkMegas-chat-widget .text-msg::placeholder {
    color: #999;
}

.ThinkMegas-chat-widget .msg-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.ThinkMegas-chat-widget .msg-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.ThinkMegas-chat-widget .msg-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Form Styles */
.ThinkMegas-chat-widget .form-group {
    margin-bottom: 16px;
}

.ThinkMegas-chat-widget .form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.ThinkMegas-chat-widget .form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.8);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.3s;
    outline: none;
}

.ThinkMegas-chat-widget .form-control:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    background: #fff;
}

.ThinkMegas-chat-widget textarea.form-control {
    resize: none;
    height: 100px;
}

.ThinkMegas-chat-widget .btn-primary {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    color: white;
    border: none;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 8px;
}

.ThinkMegas-chat-widget .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.25);
}

/* Notifications List */
.ThinkMegas-chat-widget .notification-item {
    padding: 16px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    border-left: 4px solid #2563eb;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.3s ease;
}

.ThinkMegas-chat-widget .notif-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #333;
}

.ThinkMegas-chat-widget .notif-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.ThinkMegas-chat-widget .notif-time {
    font-size: 11px;
    color: #999;
    margin-top: 8px;
    display: block;
}

/* Empty States & Loading */
.ThinkMegas-chat-widget .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #888;
    text-align: center;
    padding: 20px;
}

.ThinkMegas-chat-widget .empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: rgba(37, 99, 235, 0.4);
}

.ThinkMegas-chat-widget .empty-state p {
    font-size: 14px;
    line-height: 1.5;
}

/* Typing Indicator */
.ThinkMegas-chat-widget .typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: max-content;
    align-self: flex-start;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.ThinkMegas-chat-widget .typing-dot {
    width: 6px;
    height: 6px;
    background: #2563eb;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.ThinkMegas-chat-widget .typing-dot:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes typing {

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

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

/* Feedback messages */
.ThinkMegas-chat-widget .feedback-msg {
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    text-align: center;
    display: none;
    animation: fadeIn 0.3s ease;
}

.ThinkMegas-chat-widget .feedback-msg.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
    display: block;
}

.ThinkMegas-chat-widget .feedback-msg.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    display: block;
}

/* Responsive adjustments for mobile devices */
@media (max-width: 480px) {
    .ThinkMegas-chat-widget .panel {
        width: calc(100vw - 32px);
        max-width: 100vw;
        right: 16px;
        /* Use dynamic viewport height and account for the open widget bottom offset */
        max-height: calc(100dvh - 110px);
    }
    
    .ThinkMegas-chat-widget .panel.open {
        bottom: 90px;
    }

    .ThinkMegas-chat-widget .chat-button {
        right: 16px;
        bottom: 16px;
    }
}