/* --- WIDGET CONTAINER & BUTTON --- */
#gn-ai-root {
    font-family: 'ur', sans-serif;
    z-index: 99999;
    position: fixed;
}

/* Floating Action Button */
.gn-ai-fab {
    position: fixed;
    bottom: 30px;
    right: 70px;
    background: linear-gradient(135deg, #9F00FF, #7B00C7);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(159, 0, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100000;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.gn-ai-fab:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 15px 35px rgba(159, 0, 255, 0.6);
}

.gn-ai-fab i { font-size: 22px; }
.gn-ai-fab span { font-size: 18px; font-weight: bold; letter-spacing: 0.5px; }

/* --- FULL SCREEN CHAT OVERLAY --- */
.gn-ai-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: 0.4s ease;
    z-index: 10001;
}

.gn-ai-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* --- CHAT BOX (Dark Mode Default) --- */
.gn-ai-box {
    width: 90%;
    max-width: 1000px;
    height: 85vh;
    max-height: 800px;
    background: #121212 !important; /* Force Dark BG */
    border: 1px solid rgba(159, 0, 255, 0.3);
    border-radius: 25px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(159, 0, 255, 0.2);
    overflow: hidden;
    transform: scale(0.9);
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gn-ai-overlay.active .gn-ai-box {
    transform: scale(1);
}

/* Header */
.gn-ai-header {
    padding: 20px 30px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.gn-ai-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.gn-bot-avatar {
    width: 50px; height: 50px;
    background: #9F00FF;
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 24px; color: white;
    box-shadow: 0 0 15px #9F00FF;
}

.gn-ai-info h3 { margin: 0; color: white !important; font-size: 22px; }
.gn-ai-info p { margin: 0; color: #aaa !important; font-size: 14px; }

.gn-ai-close {
    background: none; border: none; color: #aaa;
    font-size: 28px; cursor: pointer; transition: 0.2s;
}
.gn-ai-close:hover { color: #fff; transform: rotate(90deg); }

/* Messages Area */
.gn-ai-messages {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #0e0e0e !important; /* Force Dark BG */
}

.msg {
    max-width: 85%;
    padding: 15px 20px;
    border-radius: 18px;
    font-size: 16px;
    line-height: 1.5;
    position: relative;
    animation: msgPop 0.3s ease;
}

.msg.bot {
    align-self: flex-start;
    background: #252525;
    border: 1px solid #333;
    color: #eee !important;
    border-bottom-left-radius: 2px;
}

.msg.user {
    align-self: flex-end;
    background: #9F00FF;
    color: white !important;
    border-bottom-right-radius: 2px;
    box-shadow: 0 5px 15px rgba(159, 0, 255, 0.3);
}

/* --- MANUAL MODE MENU (REPAIRED COLORS & GLOSSY LOOK) --- */
.gn-ai-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 90%;
    max-width: 400px;
    background: transparent !important; 
    border: none !important;
    padding: 0 !important;
    margin-top: 5px;
}

.gn-ai-option-btn {
    width: 100%;
    padding: 16px 22px;
    
    /* FORCE DARK BACKGROUND IN DEFAULT MODE */
    background: linear-gradient(145deg, #2b2b2b, #1a1a1a) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-left: 4px solid #9F00FF !important; /* Purple Accent */
    border-radius: 16px;
    
    /* FORCE WHITE TEXT to be visible against Dark Button */
    color: #ffffff !important; 
    
    font-size: 16px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 15px;
    
    /* Glossy Shadow */
    box-shadow: 0 4px 10px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
}

.gn-ai-option-btn:hover {
    background: #9F00FF !important;
    border-color: #9F00FF !important;
    color: #ffffff !important;
    transform: translateX(6px);
    box-shadow: 0 6px 20px rgba(159, 0, 255, 0.3);
}

/* --- INPUT AREA --- */
.gn-ai-input-area {
    padding: 15px 20px;
    background: #121212;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.gn-ai-input {
    flex: 1;
    background: #ffffff;
    border: 2px solid #fff;
    padding: 12px 20px;
    border-radius: 30px;
    color: #000000 !important; /* Force Black Text */
    font-size: 16px;
    font-weight: 500;
    outline: none;
    transition: 0.3s;
    height: 50px;
    box-sizing: border-box;
}
.gn-ai-input::placeholder { color: #666; }
.gn-ai-input:focus { 
    border-color: #9F00FF; 
    box-shadow: 0 0 0 3px rgba(159, 0, 255, 0.3);
}

.gn-ai-btn {
    width: 50px; height: 50px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex; justify-content: center; align-items: center;
    font-size: 20px;
    transition: 0.2s;
    background: #2a2a2a;
    color: #ddd !important;
    flex-shrink: 0;
}
.gn-ai-btn:hover { background: #3a3a3a; color: #fff !important; transform: scale(1.05); }
.gn-ai-btn.active { background: #ff4444; color: white !important; animation: pulse 1.5s infinite; }
.gn-ai-btn.speak-active { color: #00e676 !important; border: 1px solid #00e676; }

#btn-send { 
    background: #aa00ff; 
    color: white !important; 
    width: 50px; height: 50px;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(170, 0, 255, 0.4);
}
#btn-send:hover { 
    background: #bf33ff; 
    transform: scale(1.1) rotate(-10deg); 
    box-shadow: 0 6px 15px rgba(170, 0, 255, 0.6);
}

@keyframes msgPop { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }

/* Scrollbar */
.gn-ai-messages::-webkit-scrollbar { width: 8px; }
.gn-ai-messages::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }


/* ============================================================
   LIGHT MODE OVERRIDES
============================================================ */

body.light-mode .gn-ai-box {
    background: #f5f5f5 !important;
    border-color: #9F00FF33 !important;
    box-shadow: 0 0 50px rgba(0,0,0,0.15) !important;
}

body.light-mode .gn-ai-header {
    background: #ffffff !important;
    border-bottom-color: #eee !important;
}

body.light-mode .gn-ai-info h3 { color: #111 !important; }
body.light-mode .gn-ai-info p { color: #666 !important; }
body.light-mode .gn-ai-close { color: #444 !important; }

body.light-mode .gn-ai-messages {
    background: #ffffff !important;
}

body.light-mode .msg.bot {
    background: #f0f0f0 !important;
    border: 1px solid #e0e0e0 !important;
    color: #111 !important;
}

body.light-mode .msg.user {
    background: #9F00FF !important;
    color: #ffffff !important;
    box-shadow: 0 5px 15px rgba(159, 0, 255, 0.2) !important;
}

/* Manual Mode Buttons in LIGHT Mode */
body.light-mode .gn-ai-option-btn {
    background: linear-gradient(145deg, #ffffff, #f0f0f0) !important;
    border: 1px solid rgba(0,0,0,0.08) !important;
    color: #333333 !important; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.05) !important;
}

body.light-mode .gn-ai-option-btn:hover {
    background: #9F00FF !important;
    color: #ffffff !important;
    border-color: #9F00FF !important;
}

body.light-mode .gn-ai-input-area {
    background: #ffffff !important;
    border-top-color: #eee !important;
}

body.light-mode .gn-ai-input {
    background: #f0f0f0 !important;
    border: 1px solid #ccc !important;
    color: #000000 !important;
}

body.light-mode .gn-ai-btn {
    background: #e0e0e0 !important;
    color: #555 !important;
}
body.light-mode .gn-ai-btn:hover {
    background: #d0d0d0 !important;
    color: #000 !important;
}

body.light-mode #btn-send {
    background: #aa00ff !important;
    color: #ffffff !important;
}
@media (max-width: 768px) {

    /* --- 1. FLOATING CLOSE BUTTON (Position Only) --- */
    /* We remove the text injection to fix the "Close Close" bug */
    .gn-ai-fab {
        bottom: 110px !important;
        right: 20px !important;
        border-radius: 30px !important;
        padding: 8px 20px !important;
        z-index: 20000 !important;
        display: flex !important;
        align-items: center;
        width: auto !important;
        height: auto !important;
    }
    
    /* Ensure the icon/text your JS adds is visible */
    .gn-ai-fab i { display: block !important; }
    .gn-ai-fab span { display: block !important; }
    
    /* REMOVED ::after content to prevent double text */
    .gn-ai-fab::after { content: none !important; }

    /* --- 2. MAIN CONTAINER --- */
    .gn-ai-box { width: 100% !important; height: 100% !important; border-radius: 0 !important; border: none !important; }
    .gn-ai-close { display: none !important; } /* Hide desktop header X */
    .gn-ai-messages { padding-bottom: 0 !important; }

    /* --- 3. INPUT AREA PARENT --- */
    .gn-ai-input-area {
        position: relative;
        display: block;
        padding: 20px 10px; /* Spacing for the pill */
        background: #121212; 
        width: 100%;
        min-height: 90px;
        box-sizing: border-box;
    }
    .gn-ai-input-area::before { content: none !important; }

    /* --- 4. ACTION ROW (Mic & Speaker) --- */
    /* This div must float ON TOP of the input pill */
    .gn-ai-action-row {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        left: 30px; /* Inside the pill's left edge */
        z-index: 20; /* Layer above input */
        display: flex !important;
        gap: 5px;
    }

    /* Style the buttons inside the row */
    .gn-ai-action-row .gn-ai-btn {
        background: transparent !important;
        border: none !important;
        width: 35px;
        height: 35px;
        display: flex;
        justify-content: center;
        align-items: center;
        
        /* COLOR FIX: Dark Grey to be visible on White */
        color: #555555 !important; 
        font-size: 18px !important;
        padding: 0;
        margin: 0;
    }
    #btn-mic{color: #000000 !important;}
    #btn-speaker{color: #000000 !important;}
    .gn-ai-btn{
        i{
 color: #000000 !important;
 gap: -5px;
 font-size: 20px;
        }
        }
    /* Active colors */
    #btn-mic.active { color: #ff4444 !important; }
    #btn-speaker.speak-active { color: #00e676 !important; }

    /* --- 5. INPUT FIELD ROW --- */
    .gn-ai-input-field-row {
        position: relative;
        width: 100%;
        height: 55px; /* Pill height */
    }

    /* --- 6. WHITE INPUT PILL --- */
    .gn-ai-input {
        width: 100%;
        height: 100%;
        border-radius: 30px;
        background: #ffffff !important;
        border: none !important;
        margin: 0;
        
        /* PADDING IS CRITICAL: Reserves space for the floating buttons */
        padding-left: 100px !important; /* Space for Mic + Speaker */
        padding-right: 60px !important; /* Space for Send Button */
        
        font-size: 16px;
        color: #000000 !important; /* Black text */
        box-shadow: 0 4px 20px rgba(0,0,0,0.3);
        box-sizing: border-box;
    }
    .gn-ai-input::placeholder { color: #aaa; }

    /* --- 7. SEND BUTTON --- */
    /* Positioned inside .gn-ai-input-field-row */
    .gn-ai-input-field-row #btn-send {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        right: 10px !important; /* 10px from right edge = INSIDE */
        z-index: 20;
        
        width: 42px;
        height: 42px;
        border-radius: 50%;
        background: #9F00FF !important; /* Purple */
        color: white !important;
        border: none;
        box-shadow: none !important;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0;
        margin: 0;
    }
    
    #btn-send i {
        margin-left: -3px; 
        margin-top: 2px;
        font-size: 18px;
        color: white !important;
    }
}