/* ================= Floating Triggers ================= */
.egx-floating-btn {
    position: fixed;
    bottom: 96px;
    z-index: 1040;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
}
.egx-floating-btn:hover {
    transform: translateY(-4px) scale(1.03);
}
.egx-floating-btn:active {
    transform: translateY(0);
}

/* AI Button: Left side */
.ai-trigger {
    left: 24px;
    background: linear-gradient(135deg, #0284c7 0%, #7c3aed 100%);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.25);
}
.floating-pulse-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50px;
    border: 2px solid #00d2ff;
    animation: aiPulse 2.5s infinite;
    opacity: 0.7;
    pointer-events: none;
}
@keyframes aiPulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.08); opacity: 0; }
    100% { transform: scale(0.95); opacity: 0; }
}

/* Trading Floor Button: Right side */
.floor-trigger {
    right: 24px;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.25);
}
.floor-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 10px #22c55e;
    animation: pulse 1.8s infinite;
}

/* ================= Responsive Display Rules =================
   - Mobile & Tablet (<= 1024px): Icon ONLY (no text label)
   - Desktop / Computer (>= 1025px): Full Name Displayed */
@media (max-width: 1024px) {
    .egx-floating-btn {
        bottom: 76px;
        padding: 0 !important;
        border-radius: 50% !important;
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0 !important;
    }
    .egx-floating-btn .floating-btn-label {
        display: none !important;
    }
    .egx-floating-btn i {
        font-size: 1.35rem !important;
        margin: 0 !important;
    }
    .floating-pulse-ring {
        border-radius: 50% !important;
    }
    .ai-trigger { left: 16px !important; }
    .floor-trigger { right: 16px !important; }
}

@media (min-width: 1025px) {
    .egx-floating-btn {
        padding: 12px 22px !important;
        border-radius: 50px !important;
        width: auto !important;
        height: auto !important;
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
    }
    .egx-floating-btn .floating-btn-label {
        display: inline-block !important;
        font-size: 0.92rem !important;
        font-weight: 800 !important;
        font-family: 'Tajawal', sans-serif !important;
    }
    .egx-floating-btn i {
        font-size: 1.1rem !important;
    }
}

/* ================= Floating Chat Windows ================= */
.egx-floating-window {
    position: fixed;
    bottom: 96px;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 580px;
    max-height: calc(100vh - 120px);
    background-color: #0b1120 !important;
    background: #0b1120 !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid #1e293b !important;
    border-radius: 20px;
    box-shadow: 0 25px 65px -10px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
    display: flex;
    flex-direction: column;
    z-index: 1050;
    overflow: hidden;
    animation: windowSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes windowSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.ai-window { left: 24px; }
.floor-window { right: 24px; }
@media (max-width: 768px) {
    .egx-floating-window {
        left: 16px !important;
        right: 16px !important;
        width: auto;
        bottom: 74px;
        height: 80vh;
    }
}

/* Window Header */
.window-header {
    padding: 13px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffffff !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}
.ai-header { 
    background: linear-gradient(135deg, #0284c7 0%, #1e40af 100%) !important; 
}
.floor-header { 
    background: linear-gradient(135deg, #047857 0%, #064e3b 100%) !important; 
}
.window-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    background: rgba(255, 255, 255, 0.22) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.35);
    flex-shrink: 0;
}
.window-title { 
    font-weight: 800; 
    font-size: 0.95rem; 
    color: #ffffff !important; 
    line-height: 1.3;
}
.window-subtitle { 
    font-size: 0.73rem; 
    color: rgba(255, 255, 255, 0.88) !important; 
    line-height: 1.2;
}
.live-pill.active {
    background: #10b981 !important;
    color: #ffffff !important;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 800;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}
.window-close-btn {
    background: rgba(255, 255, 255, 0.16) !important;
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    color: #ffffff !important;
    font-size: 1.25rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    transition: all 0.2s ease;
}
.window-close-btn:hover { 
    background: rgba(239, 68, 68, 0.9) !important; 
    border-color: #ef4444 !important;
    color: #ffffff !important;
    transform: scale(1.08);
}
.window-action-btn {
    background: rgba(255, 255, 255, 0.16) !important;
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    color: #ffffff !important;
    font-size: 0.88rem;
    cursor: pointer;
    padding: 6px 9px;
    line-height: 1;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.window-action-btn:hover {
    background: rgba(255, 255, 255, 0.32) !important;
    transform: scale(1.08);
}

/* Quick Chips */
.ai-quick-chips {
    padding: 9px 12px;
    background: #090e1a !important;
    border-bottom: 1px solid #1e293b !important;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    flex-shrink: 0;
}
.ai-quick-chips::-webkit-scrollbar { display: none; }
.ai-chip {
    background: #141e33 !important;
    border: 1px solid #293855 !important;
    color: #e2e8f0 !important;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.ai-chip:hover {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.45);
    transform: translateY(-1px);
}

/* Messages Body */
.window-messages-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #070b14 !important;
    color: #f1f5f9 !important;
}

/* Bubbles */
.chat-bubble {
    padding: 12px 15px;
    border-radius: 15px;
    max-width: 90%;
    font-size: 0.88rem;
    line-height: 1.6;
    position: relative;
}
.user-bubble {
    align-self: flex-start;
    background: linear-gradient(135deg, #0284c7 0%, #1d4ed8 100%) !important;
    color: #ffffff !important;
    border-bottom-right-radius: 4px;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4) !important;
}
.model-bubble {
    align-self: flex-end;
    background: #111827 !important;
    color: #f8fafc !important;
    border: 1px solid #1e293b !important;
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6) !important;
    max-width: 95%;
}
.formatted-ai-reply {
    direction: rtl;
    text-align: right;
    unicode-bidi: plaintext;
    line-height: 1.7;
    font-size: 0.88rem;
    color: #f1f5f9 !important;
}
.formatted-ai-reply p { margin-bottom: 8px; color: #f1f5f9 !important; }
.formatted-ai-reply strong, .formatted-ai-reply b { color: #38bdf8 !important; font-weight: 800; }
.formatted-ai-reply hr { border: none; border-top: 1px solid #1e293b !important; margin: 12px 0; }
.formatted-ai-reply blockquote {
    background: #0d1a2d !important;
    border-right: 3px solid #0284c7 !important;
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 4px;
    font-size: 0.84rem;
    color: #cbd5e1 !important;
}
.formatted-ai-reply table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    margin: 10px 0;
    border: 1px solid #293855 !important;
    border-radius: 8px;
    overflow: hidden;
    background: #0c121e !important;
}
.formatted-ai-reply th, .formatted-ai-reply td {
    padding: 7px 10px;
    border: 1px solid #1e293b !important;
    text-align: right;
}
.formatted-ai-reply th {
    background: #162033 !important;
    color: #38bdf8 !important;
    font-weight: 800;
    border-bottom: 1.5px solid #293855 !important;
}
.formatted-ai-reply td {
    background: #0c121e !important;
    color: #f1f5f9 !important;
}
.formatted-ai-reply tr:nth-child(even) td { 
    background: #111a2c !important; 
}
.formatted-ai-reply code {
    background: #141e33 !important;
    color: #38bdf8 !important;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.84rem;
    border: 1px solid #293855 !important;
}
.bubble-header {
    font-size: 0.76rem;
    font-weight: 800;
    margin-bottom: 6px;
    color: #38bdf8 !important;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* In-Chat Image Preview Bar */
.ai-image-preview-bar {
    background: #0f172a;
    border-top: 1px solid #1e293b;
    border-bottom: 1px solid #1e293b;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.ai-image-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #38bdf8;
}
.ai-image-thumb-info {
    display: flex;
    flex-direction: column;
}
.ai-image-thumb-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: #38bdf8;
}
.ai-image-thumb-sub {
    font-size: 0.68rem;
    color: #94a3b8;
}
.ai-image-clear-btn {
    background: transparent;
    border: none;
    color: #f87171;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.ai-attach-btn {
    background: #1e293b !important;
    color: #38bdf8 !important;
    border: 1px solid #334155 !important;
    flex-shrink: 0;
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.ai-attach-btn:hover {
    background: #334155 !important;
    color: #00e5ff !important;
}

/* Interactive In-Chat Visual Card */
.ai-visual-card {
    margin-top: 10px;
    background: linear-gradient(135deg, #0d1527 0%, #080c16 100%);
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}
.ai-visual-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.ai-visual-title {
    font-weight: 800;
    font-size: 0.90rem;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ai-visual-price {
    font-family: monospace;
    font-weight: 800;
    font-size: 0.88rem;
}

/* RSI Visual Gauge Meter */
.ai-rsi-container {
    margin-bottom: 10px;
    background: #111a2e;
    border-radius: 8px;
    padding: 8px 10px;
    border: 1px solid #1e293b;
}
.ai-rsi-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    margin-bottom: 4px;
}
.ai-rsi-track {
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #10b981 0%, #06b6d4 35%, #eab308 65%, #ef4444 100%);
    position: relative;
}
.ai-rsi-needle {
    position: absolute;
    top: -4px;
    width: 4px;
    height: 16px;
    background: #ffffff;
    border-radius: 2px;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.9);
    transform: translateX(-50%);
    transition: left 0.5s ease;
}
.ai-rsi-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.74rem;
    font-weight: 700;
    margin-top: 6px;
}

/* Support / Resistance Price Channel Bar */
.ai-channel-container {
    margin-bottom: 10px;
    background: #111a2e;
    border-radius: 8px;
    padding: 8px 10px;
    border: 1px solid #1e293b;
}
.ai-channel-track {
    height: 8px;
    border-radius: 4px;
    background: #1e293b;
    position: relative;
    margin: 10px 0 6px 0;
}
.ai-channel-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.4), rgba(56, 189, 248, 0.4));
    border-radius: 4px;
}
.ai-channel-marker {
    position: absolute;
    top: -5px;
    width: 10px;
    height: 18px;
    background: #38bdf8;
    border: 2px solid #ffffff;
    border-radius: 3px;
    transform: translateX(-50%);
    box-shadow: 0 0 8px #38bdf8;
}
.ai-channel-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    font-weight: 700;
}

/* Action buttons */
.ai-visual-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.ai-action-btn {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 6px;
    border: 1px solid #293855;
    background: #162035;
    color: #e2e8f0;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.2s ease;
}
.ai-action-btn:hover {
    background: #223252;
    color: #38bdf8;
    border-color: #38bdf8;
}

/* Proactive Portfolio Watchdog Banner */
.ai-watchdog-banner {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    color: #fca5a5;
    font-size: 0.8rem;
}
.ai-watchdog-banner-header {
    font-weight: 800;
    color: #f87171;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Trading Floor Message Card */
.floor-msg-item {
    display: flex;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid #141e33 !important;
}
.floor-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #334155;
}
.floor-msg-content {
    flex: 1;
    min-width: 0;
}
.floor-msg-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    margin-bottom: 3px;
}
.floor-user-name { font-weight: 800; color: #34d399 !important; }
.floor-msg-time { font-size: 0.72rem; color: #94a3b8 !important; }
.floor-msg-text {
    font-size: 0.88rem;
    color: #f8fafc !important;
    word-break: break-word;
    line-height: 1.5;
}

/* Disambiguation Buttons */
.disambig-chip-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}
.disambig-btn {
    background: #131d31 !important;
    border: 1px solid #293855 !important;
    border-radius: 10px;
    padding: 9px 13px;
    text-align: right;
    font-size: 0.84rem;
    font-weight: 700;
    color: #ffffff !important;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}
.disambig-btn:hover {
    background: #0284c7 !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
    transform: translateX(-3px);
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

/* Notice Bar */
.floor-session-notice {
    background: #064e3b !important;
    border-bottom: 1px solid #059669 !important;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #d1fae5 !important;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Legal Disclaimer Bar */
.ai-legal-disclaimer-bar {
    background: #181d11 !important;
    border-top: 1px solid #3d3416 !important;
    padding: 7px 12px;
    font-size: 0.74rem;
    font-weight: 600;
    color: #fde68a !important;
    display: flex;
    align-items: center;
    gap: 7px;
    line-height: 1.4;
    flex-shrink: 0;
}
.ai-legal-disclaimer-bar strong {
    color: #fbbf24 !important;
}

/* Input Footer */
.window-input-footer {
    padding: 10px 14px;
    background: #090e1a !important;
    border-top: 1px solid #1e293b !important;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.window-text-input {
    flex: 1;
    padding: 11px 16px;
    border-radius: 22px;
    border: 1.5px solid #293855 !important;
    background: #131d31 !important;
    color: #ffffff !important;
    font-size: 0.88rem;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s ease;
}
.window-text-input::placeholder {
    color: #64748b !important;
}
.window-text-input:focus {
    outline: none;
    border-color: #0284c7 !important;
    background: #18233c !important;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.25) !important;
    color: #ffffff !important;
}
.window-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    color: #ffffff !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: transform 0.2s, filter 0.2s;
    flex-shrink: 0;
}
.window-send-btn:hover { 
    transform: scale(1.08); 
    filter: brightness(1.15);
}
.ai-send-btn { 
    background: linear-gradient(135deg, #0284c7, #2563eb) !important; 
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.45) !important;
}
.floor-send-btn { 
    background: linear-gradient(135deg, #059669, #10b981) !important; 
    box-shadow: 0 2px 10px rgba(5, 150, 105, 0.45) !important;
}
