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

/* Chatbot Widget Scope Wrapper to prevent global styling pollution */
.ie-chatbot-widget {
    --ie-saffron: #FF671F;
    --ie-navy: #000080;
    --ie-green: #046A38;
    --ie-saffron-light: rgba(255, 103, 31, 0.08);
    --ie-navy-light: rgba(0, 0, 128, 0.06);
    --ie-green-light: rgba(4, 106, 56, 0.08);
    --ie-bg-white: #ffffff;
    --ie-bg-light: #f8fafc;
    --ie-text-dark: #1e293b;
    --ie-text-gray: #64748b;
    --ie-border: #e2e8f0;
    --ie-shadow-window: 0 12px 40px rgba(0, 0, 0, 0.15);
    --ie-shadow-button: 0 4px 20px rgba(255, 103, 31, 0.3);
    --ie-font: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    font-family: var(--ie-font);
    box-sizing: border-box;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 999999;
}

.ie-chatbot-widget * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--ie-font);
}

/* Floating Trigger Button */
.ie-chatbot-trigger {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ie-saffron) 0%, var(--ie-navy) 50%, var(--ie-green) 100%);
    box-shadow: var(--ie-shadow-button);
    border: 3px solid var(--ie-bg-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: absolute;
    bottom: 30px;
    right: 30px;
    pointer-events: auto;
    z-index: 999999;
}

.ie-chatbot-trigger:hover {
    transform: scale(1.08) rotate(5deg);
    box-shadow: 0 6px 24px rgba(255, 103, 31, 0.45);
}

.ie-chatbot-trigger:active {
    transform: scale(0.95);
}

.ie-chatbot-trigger svg {
    width: 30px;
    height: 30px;
    fill: var(--ie-bg-white);
    transition: transform 0.3s ease;
}

.ie-chatbot-trigger.active svg {
    transform: rotate(90deg);
}

/* Notification Badge */
.ie-chatbot-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--ie-bg-white);
    animation: ie-pulse-badge 2s infinite;
}

@keyframes ie-pulse-badge {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Backdrop Overlay */
.ie-chatbot-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 999998;
    display: none;
}

.ie-chatbot-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Chat Window Container */
.ie-chatbot-window {
    position: relative;
    width: 420px;
    height: 600px;
    max-height: 90vh;
    max-width: 90vw;
    background-color: var(--ie-bg-white);
    border-radius: 18px;
    box-shadow: var(--ie-shadow-window);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
    border: 1px solid var(--ie-border);
    z-index: 999999;
}

.ie-chatbot-window.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* Indian Flag Top Accent Stripe */
.ie-chatbot-stripe {
    height: 4px;
    display: flex;
    width: 100%;
}
.ie-chatbot-stripe-saffron { flex: 1; background-color: var(--ie-saffron); }
.ie-chatbot-stripe-white { flex: 1; background-color: #ffffff; }
.ie-chatbot-stripe-green { flex: 1; background-color: var(--ie-green); }

/* Chat Header */
.ie-chatbot-header {
    background-color: var(--ie-navy);
    color: var(--ie-bg-white);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 128, 0.1);
}

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

/* Indian Emblem Circular Shield */
.ie-chatbot-avatar-container {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--ie-bg-white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ie-chatbot-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.ie-chatbot-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background-color: #10b981;
    border-radius: 50%;
    border: 2px solid var(--ie-navy);
    animation: ie-pulse-status 2s infinite;
}

@keyframes ie-pulse-status {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.ie-chatbot-header-text h3 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
    color: #fff;
}

.ie-chatbot-header-text p {
    font-size: 11px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ie-chatbot-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ie-chatbot-restart-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease, transform 0.4s ease;
}

.ie-chatbot-restart-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    transform: rotate(-180deg);
}

.ie-chatbot-restart-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.ie-chatbot-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.ie-chatbot-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
}

.ie-chatbot-close-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Chat Messages Container */
.ie-chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: var(--ie-bg-light);
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.ie-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.ie-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ie-chatbot-messages::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 20px;
}

.ie-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

/* Message Item Layout */
.ie-chatbot-msg-wrapper {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: ie-fade-in-up 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes ie-fade-in-up {
    0% {
        opacity: 0;
        transform: translateY(12px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.ie-chatbot-msg-wrapper.bot {
    align-self: flex-start;
}

.ie-chatbot-msg-wrapper.user {
    align-self: flex-end;
    flex-direction: row-reverse;
    max-width: 80%;
}

.ie-chatbot-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--ie-navy);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: white;
    font-weight: 700;
    flex-shrink: 0;
    border: 1px solid var(--ie-border);
}

.ie-chatbot-msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.ie-chatbot-msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ie-chatbot-msg-wrapper.bot .ie-chatbot-msg-bubble {
    background-color: var(--ie-bg-white);
    color: var(--ie-text-dark);
    border-top-left-radius: 4px;
    border: 1px solid var(--ie-border);
}

.ie-chatbot-msg-wrapper.user .ie-chatbot-msg-bubble {
    background: linear-gradient(135deg, var(--ie-saffron) 0%, #e05a10 100%);
    color: white;
    border-top-right-radius: 4px;
}

.ie-chatbot-msg-time {
    font-size: 10px;
    color: var(--ie-text-gray);
    margin-top: 4px;
    display: block;
    text-align: right;
}

.ie-chatbot-msg-wrapper.user .ie-chatbot-msg-time {
    color: rgba(255, 255, 255, 0.85);
}

/* Links within bot replies */
.ie-chatbot-msg-bubble a {
    color: var(--ie-navy);
    font-weight: 600;
    text-decoration: underline;
    word-break: break-all;
    display: inline-block;
    margin-top: 6px;
    transition: color 0.2s;
}

.ie-chatbot-msg-bubble a:hover {
    color: var(--ie-saffron);
}

.ie-chatbot-msg-bubble ul, .ie-chatbot-msg-bubble ol {
    margin-top: 8px;
    margin-bottom: 4px;
    padding-left: 20px;
}

.ie-chatbot-msg-bubble li {
    margin-bottom: 4px;
}

/* Quick Options Component */
.ie-chatbot-options-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 5px;
    animation: ie-fade-in-up 0.4s ease 0.1s both;
}

.ie-chatbot-option-btn {
    background-color: var(--ie-bg-white);
    border: 1.5px solid var(--ie-navy);
    color: var(--ie-navy);
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    display: block;
    line-height: 1.3;
    outline: none;
    box-shadow: 0 2px 4px rgba(0, 0, 128, 0.03);
}

.ie-chatbot-option-btn:hover {
    background-color: var(--ie-navy);
    color: var(--ie-bg-white);
    transform: translateX(4px);
    box-shadow: 0 4px 8px rgba(0, 0, 128, 0.15);
}

.ie-chatbot-option-btn:active {
    transform: translateX(2px);
}

/* Highlighted alternative color for loops/resets */
.ie-chatbot-option-btn.alt-option {
    border-color: var(--ie-saffron);
    color: var(--ie-saffron);
}

.ie-chatbot-option-btn.alt-option:hover {
    background-color: var(--ie-saffron);
    color: white;
    box-shadow: 0 4px 8px rgba(255, 103, 31, 0.2);
}

/* Chat Footer / Input area */
.ie-chatbot-footer {
    padding: 15px 20px;
    background-color: var(--ie-bg-white);
    border-top: 1px solid var(--ie-border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ie-chatbot-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ie-chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 24px;
    border: 1.5px solid var(--ie-border);
    font-size: 14px;
    color: var(--ie-text-dark);
    outline: none;
    transition: all 0.2s ease;
    background-color: var(--ie-bg-light);
}

.ie-chatbot-input:focus {
    border-color: var(--ie-navy);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(0, 0, 128, 0.1);
}

.ie-chatbot-input:disabled {
    background-color: var(--ie-bg-light);
    color: var(--ie-text-gray);
    cursor: not-allowed;
    border-color: var(--ie-border);
}

.ie-chatbot-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--ie-navy);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 128, 0.15);
}

.ie-chatbot-send-btn:hover {
    background-color: #0000a5;
    transform: scale(1.05);
}

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

.ie-chatbot-send-btn:disabled {
    background-color: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.ie-chatbot-send-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    margin-left: 2px;
}

.ie-chatbot-branding {
    font-size: 10px;
    color: var(--ie-text-gray);
    text-align: center;
    letter-spacing: 0.2px;
}

.ie-chatbot-branding span {
    font-weight: 600;
    color: var(--ie-navy);
}

/* Typing Indicator Animation */
.ie-chatbot-typing-bubble {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 18px !important;
}

.ie-chatbot-typing-bubble span {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--ie-text-gray);
    opacity: 0.4;
    animation: ie-typing-bounce 1.4s infinite both;
}

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

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

@keyframes ie-typing-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Mobile Screen Responsiveness */
@media screen and (max-width: 480px) {
    .ie-chatbot-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 60px);
        max-height: calc(100vh - 60px);
    }
}

@media screen and (max-width: 360px) {
    .ie-chatbot-window {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
}




.ie-chatbot-window{
    position: absolute;
    right: 40px;
    max-height: 75vh;
    top:20px;
}