/* ==============================================================================
   S&R CoreSync Sovereign Agent Floating Widget Styles
   ============================================================================== */

:root {
    --sr-widget-bg: rgba(6, 15, 12, 0.95);
    --sr-widget-border: rgba(var(--sr-gold-rgb, 212, 175, 55), 0.35);
    --sr-widget-gold: #d4af37;
    --sr-widget-gold-bright: #dfc299;
    --sr-widget-emerald: #10b981;
    --sr-widget-emerald-glow: rgba(16, 185, 129, 0.4);
    --sr-widget-text: #f3f4f6;
    --sr-widget-text-muted: #9ca3af;
    --sr-widget-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.8), 0 0 25px rgba(var(--sr-gold-rgb, 212, 175, 55), 0.15);
}

/* Eradicate all legacy floating hubs, support tools, and launchers */
#esFloatingSuite,
.es-floating-suite,
#esFloatingMinBtn,
.es-feedback-fab-min,
#esGdprBanner,
.es-gdpr-banner,
.srx-concierge-fab,
.concierge-fab,
#concierge-fab,
.sr-agent-launcher {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
}

/* Floating Launcher Trigger */
.sr-agent-launcher {
    display: none !important;
}

.sr-agent-launcher:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.75), 0 0 25px rgba(var(--sr-gold-rgb, 212, 175, 55), 0.45);
    border-color: var(--sr-widget-gold-bright);
}

.sr-agent-launcher-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.sr-agent-pulse-dot {
    position: relative;
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    background: var(--sr-widget-emerald);
    border: 1.5px solid #06150f;
    border-radius: 50%;
    animation: srPulse 2s infinite;
}

.sr-agent-launcher-text {
    white-space: nowrap;
    letter-spacing: 0.02em;
}
@keyframes srPulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Chat Window Box */
.sr-agent-window {
    position: fixed !important;
    bottom: 24px !important;
    left: 72px !important;
    right: auto !important;
    z-index: 9999999 !important;
    width: 410px !important;
    max-width: calc(100vw - 88px) !important;
    height: 600px !important;
    max-height: calc(100vh - 48px) !important;
    background: var(--sr-widget-bg, rgba(6, 15, 12, 0.96)) !important;
    border: 1px solid var(--sr-widget-border, rgba(var(--sr-gold-rgb, 212, 175, 55), 0.35)) !important;
    border-radius: 20px !important;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.8), 0 0 25px rgba(var(--sr-gold-rgb, 212, 175, 55), 0.15) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: translateY(20px) scale(0.96);
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease !important;
    direction: rtl !important;
    text-align: right !important;
    font-family: 'Alexandria', 'Tajawal', system-ui, sans-serif !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
}

#sr-agent-widget-container .sr-agent-window.sr-open,
.sr-agent-window.sr-open {
    display: flex !important;
    transform: translateY(0) scale(1) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    visibility: visible !important;
}

html:not([dir="rtl"]) .sr-agent-window {
    left: auto !important;
    right: 72px !important;
    direction: ltr !important;
    text-align: left !important;
}

@media (max-width: 640px) {
    .sr-agent-window {
        left: 10px !important;
        right: 10px !important;
        bottom: 10px !important;
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        height: min(80vh, 580px) !important;
        max-height: calc(100vh - 20px) !important;
    }
}

/* Header */
.sr-agent-header {
    padding: 16px 20px;
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.12) 0%, rgba(6, 15, 12, 0) 100%);
    border-bottom: 1px solid rgba(var(--sr-gold-rgb, 212, 175, 55), 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sr-agent-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sr-agent-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid var(--sr-widget-gold);
    background: #020705;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sr-agent-logo-text {
    color: var(--sr-widget-gold-bright);
    font-weight: 900;
    font-size: 0.9rem;
}

.sr-agent-status-indicator {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--sr-widget-emerald);
    border-radius: 50%;
}

.sr-agent-title h3 {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--sr-widget-gold-bright);
}

.sr-agent-title span {
    font-size: 0.75rem;
    color: var(--sr-widget-emerald);
    display: flex;
    align-items: center;
    gap: 5px;
}

.sr-agent-header-actions button {
    background: transparent;
    border: none;
    color: var(--sr-widget-text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s;
}

.sr-agent-header-actions button:hover {
    color: #fff;
}

/* Messages Area */
.sr-agent-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.sr-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.55;
    word-break: break-word;
}

.sr-msg-user {
    align-self: flex-start;
    background: linear-gradient(135deg, #12382b 0%, #0c261d 100%);
    color: #ffffff;
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-bottom-right-radius: 3px;
}

.sr-msg-agent {
    align-self: flex-end;
    background: rgba(var(--sr-gold-rgb, 212, 175, 55), 0.08);
    color: var(--sr-widget-text);
    border: 1px solid rgba(var(--sr-gold-rgb, 212, 175, 55), 0.25);
    border-bottom-left-radius: 3px;
}

.sr-msg-actions {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sr-action-btn {
    padding: 6px 12px;
    background: rgba(var(--sr-gold-rgb, 212, 175, 55), 0.15);
    border: 1px solid var(--sr-widget-gold);
    color: var(--sr-widget-gold-bright);
    font-size: 0.78rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.sr-action-btn:hover {
    background: var(--sr-widget-gold);
    color: #020705;
}

/* Quick Suggestion Chips */
.sr-agent-chips {
    padding: 8px 16px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    -ms-overflow-style: none;
    /* scrollbar-width: none; (removed for compatibility) */
}

.sr-agent-chips::-webkit-scrollbar {
    display: none;
}

.sr-chip {
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(var(--sr-gold-rgb, 212, 175, 55), 0.2);
    border-radius: 20px;
    color: var(--sr-widget-gold);
    font-size: 0.76rem;
    cursor: pointer;
    transition: all 0.2s;
}

.sr-chip:hover {
    background: rgba(var(--sr-gold-rgb, 212, 175, 55), 0.15);
    border-color: var(--sr-widget-gold-bright);
}

/* Typing Indicator */
.sr-typing {
    align-self: flex-end;
    display: none;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    background: rgba(var(--sr-gold-rgb, 212, 175, 55), 0.06);
    border-radius: 12px;
    border: 1px solid rgba(var(--sr-gold-rgb, 212, 175, 55), 0.15);
}

.sr-typing-dot {
    width: 6px;
    height: 6px;
    background: var(--sr-widget-gold);
    border-radius: 50%;
    animation: srBounce 1.4s infinite ease-in-out;
}

.sr-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.sr-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes srBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input Area */
.sr-agent-input-box {
    padding: 12px 16px;
    background: rgba(2, 7, 5, 0.8);
    border-top: 1px solid rgba(var(--sr-gold-rgb, 212, 175, 55), 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sr-agent-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(var(--sr-gold-rgb, 212, 175, 55), 0.25);
    border-radius: 10px;
    padding: 10px 14px;
    color: #ffffff;
    font-size: 0.86rem;
    outline: none;
    direction: rtl;
    font-family: inherit;
    transition: border-color 0.2s;
}

.sr-agent-input:focus {
    border-color: var(--sr-widget-gold-bright);
    background: rgba(255, 255, 255, 0.07);
}

.sr-agent-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #d4af37 0%, #a38258 100%);
    border: none;
    color: #020705;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

.sr-agent-send-btn:hover {
    transform: scale(1.05);
}

.sr-agent-send-btn:active {
    transform: scale(0.96);
}

/* Voice & Audio Controls (Speech-to-Text & Text-to-Speech) */
.sr-agent-upload-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(var(--sr-gold-rgb, 212, 175, 55), 0.12);
    border: 1px solid rgba(var(--sr-gold-rgb, 212, 175, 55), 0.35);
    color: var(--sr-widget-gold-bright);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.sr-agent-upload-btn:hover {
    background: rgba(var(--sr-gold-rgb, 212, 175, 55), 0.25);
    border-color: var(--sr-widget-gold-bright);
    color: #ffffff;
    transform: scale(1.05);
}

.sr-agent-mic-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: var(--sr-widget-emerald);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    padding: 0;
}

.sr-agent-mic-btn:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: var(--sr-widget-emerald);
    color: #ffffff;
    transform: scale(1.05);
}

.sr-agent-mic-btn.sr-listening {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    border-color: #f87171;
    color: #ffffff;
    animation: srMicPulse 1.2s infinite;
}

@keyframes srMicPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
        transform: scale(1);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
        transform: scale(1.08);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
        transform: scale(1);
    }
}

.sr-voice-lang-btn {
    background: rgba(var(--sr-gold-rgb, 212, 175, 55), 0.1);
    border: 1px solid rgba(var(--sr-gold-rgb, 212, 175, 55), 0.3);
    color: var(--sr-widget-gold-bright);
    font-size: 0.72rem;
    font-weight: 800;
    padding: 4px 7px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.sr-voice-lang-btn:hover {
    background: rgba(var(--sr-gold-rgb, 212, 175, 55), 0.25);
    border-color: var(--sr-widget-gold-bright);
}

.sr-agent-tts-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(var(--sr-gold-rgb, 212, 175, 55), 0.2);
    color: var(--sr-widget-text-muted);
    border-radius: 6px;
    padding: 3px 6px;
    font-size: 0.78rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    transition: all 0.2s;
}

.sr-agent-tts-btn:hover {
    color: var(--sr-widget-gold-bright);
    border-color: var(--sr-widget-gold);
    background: rgba(var(--sr-gold-rgb, 212, 175, 55), 0.15);
}

.sr-agent-tts-btn.sr-speaking {
    color: var(--sr-widget-emerald);
    border-color: var(--sr-widget-emerald);
    background: rgba(16, 185, 129, 0.15);
    animation: srPulse 1.5s infinite;
}



/* Trust Badge & Footer */
.sr-agent-foot-trust {
    padding: 7px 14px;
    font-size: 0.7rem;
    color: var(--sr-widget-text-muted);
    text-align: center;
    border-top: 1px solid rgba(var(--sr-gold-rgb, 212, 175, 55), 0.15);
    background: rgba(6, 21, 15, 0.7);
    letter-spacing: 0.01em;
}

@media (max-width: 640px) {
    .sr-agent-window {
        bottom: 12px;
        left: 12px;
        right: 12px;
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        height: calc(100vh - 24px);
        max-height: calc(100vh - 24px);
    }
}
    .sr-agent-window {
        bottom: 68px;
        inset-inline-end: 12px;
        width: calc(100vw - 24px);
        height: calc(100vh - 82px);
    }
}


