/**
 * AI360 Nexus Chat — Stylesheet v1.8.0
 *
 * ChatGPT-style floating chat bubble + full-page mode (native integration).
 * Mobile-first, responsive, accessible, fullscreen-ready.
 *
 * @package AI360_Nexus_Chat
 */

/* ── CSS Variables ────────────────────────────────────────────────────────── */
:root {
    --ai360-primary: #81c8c0;
    --ai360-primary-dark: #6ab5ad;
    --ai360-primary-light: #a8ddd7;
    --ai360-accent: #e61773;
    --ai360-bg: #FFFFFF;
    --ai360-bg-secondary: #F7F7F8;
    --ai360-bg-chat: #FFFFFF;
    --ai360-text: #1A1A2E;
    --ai360-text-secondary: #6B7280;
    --ai360-border: #E5E7EB;
    --ai360-user-bubble: #81c8c0;
    --ai360-user-text: #FFFFFF;
    --ai360-bot-bubble: #F7F7F8;
    --ai360-bot-text: #1A1A2E;
    --ai360-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    --ai360-shadow-hover: 0 12px 40px rgba(129, 200, 192, 0.25);
    --ai360-radius: 16px;
    --ai360-radius-sm: 10px;
    --ai360-font: inherit;
    --ai360-z: 999999;
    --ai360-header-height: 70px;
}

/* ── Toggle Button (Floating Bubble) ───────────────────────────────────────── */
.ai360-nexus-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: calc(var(--ai360-z) + 1);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--ai360-primary);
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--ai360-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.ai360-nexus-toggle:hover {
    background: var(--ai360-primary-dark);
    box-shadow: var(--ai360-shadow-hover);
    transform: scale(1.05);
}

.ai360-nexus-toggle:active {
    transform: scale(0.95);
}

.ai360-nexus-toggle:focus-visible {
    outline: 3px solid var(--ai360-primary-light);
    outline-offset: 4px;
}

/* Pulse animation on idle */
@keyframes ai360-pulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(129, 200, 192, 0.15); }
    50% { box-shadow: 0 8px 32px rgba(129, 200, 192, 0.35); }
}

.ai360-nexus-toggle.ai360-nexus-idle {
    animation: ai360-pulse 3s ease-in-out infinite;
}

/* ── Chat Panel ────────────────────────────────────────────────────────────── */
.ai360-nexus-panel {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: var(--ai360-z);
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100dvh - 120px);
    background: var(--ai360-bg);
    border-radius: var(--ai360-radius);
    box-shadow: var(--ai360-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--ai360-border);
    font-family: var(--ai360-font);
    animation: ai360-slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes ai360-slideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.ai360-nexus-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--ai360-primary), var(--ai360-primary-dark));
    color: #FFFFFF;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.ai360-nexus-logo {
    font-size: 28px;
    line-height: 1;
}

.ai360-nexus-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.ai360-nexus-subtitle {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 2px;
}

.ai360-nexus-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ── Messages Area ─────────────────────────────────────────────────────────── */
.ai360-nexus-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--ai360-bg-secondary);
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Custom scrollbar */
.ai360-nexus-messages::-webkit-scrollbar {
    width: 6px;
}

.ai360-nexus-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai360-nexus-messages::-webkit-scrollbar-thumb {
    background: var(--ai360-border);
    border-radius: 3px;
}

.ai360-nexus-messages::-webkit-scrollbar-thumb:hover {
    background: var(--ai360-text-secondary);
}

/* ── Message Bubbles ───────────────────────────────────────────────────────── */
.ai360-nexus-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: ai360-fadeIn 0.3s ease;
}

@keyframes ai360-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai360-nexus-message-user {
    align-self: flex-end;
}

.ai360-nexus-message-bot {
    align-self: flex-start;
}

.ai360-nexus-bubble {
    padding: 12px 16px;
    border-radius: var(--ai360-radius-sm);
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ai360-nexus-message-user .ai360-nexus-bubble {
    background: var(--ai360-user-bubble);
    color: var(--ai360-user-text);
    border-bottom-right-radius: 4px;
}

.ai360-nexus-message-bot .ai360-nexus-bubble {
    background: var(--ai360-bot-bubble);
    color: var(--ai360-bot-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Markdown styling inside bot messages */
.ai360-nexus-message-bot .ai360-nexus-bubble h1,
.ai360-nexus-message-bot .ai360-nexus-bubble h2,
.ai360-nexus-message-bot .ai360-nexus-bubble h3 {
    margin: 8px 0 4px;
    font-size: 15px;
    font-weight: 700;
}

.ai360-nexus-message-bot .ai360-nexus-bubble p {
    margin: 4px 0;
}

.ai360-nexus-message-bot .ai360-nexus-bubble ul,
.ai360-nexus-message-bot .ai360-nexus-bubble ol {
    margin: 4px 0;
    padding-left: 20px;
}

.ai360-nexus-message-bot .ai360-nexus-bubble li {
    margin: 2px 0;
}

.ai360-nexus-message-bot .ai360-nexus-bubble code {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.ai360-nexus-message-bot .ai360-nexus-bubble pre {
    background: #1A1A2E;
    color: #a8ddd7;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.ai360-nexus-message-bot .ai360-nexus-bubble pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: 13px;
}

.ai360-nexus-message-bot .ai360-nexus-bubble blockquote {
    border-left: 3px solid var(--ai360-primary-light);
    margin: 8px 0;
    padding: 4px 12px;
    color: var(--ai360-text-secondary);
}

.ai360-nexus-message-bot .ai360-nexus-bubble a {
    color: var(--ai360-primary-dark);
    text-decoration: underline;
}

.ai360-nexus-message-bot .ai360-nexus-bubble table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
    font-size: 13px;
}

.ai360-nexus-message-bot .ai360-nexus-bubble th,
.ai360-nexus-message-bot .ai360-nexus-bubble td {
    border: 1px solid var(--ai360-border);
    padding: 6px 10px;
    text-align: left;
}

.ai360-nexus-message-bot .ai360-nexus-bubble th {
    background: var(--ai360-bg-secondary);
    font-weight: 600;
}

/* ── Agents Indicator ──────────────────────────────────────────────────────── */
.ai360-nexus-agents {
    padding: 8px 16px;
    background: #e8f5f3;
    border-top: 1px solid var(--ai360-border);
    font-size: 12px;
    color: var(--ai360-primary-dark);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
    min-height: 36px;
}

.ai360-nexus-agents-label {
    font-weight: 600;
    white-space: nowrap;
}

.ai360-nexus-agents-list {
    font-weight: 400;
}

/* ── Loading Indicator ─────────────────────────────────────────────────────── */
.ai360-nexus-loading {
    padding: 12px 16px;
    background: var(--ai360-bg);
    border-top: 1px solid var(--ai360-border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ai360-nexus-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ai360-primary);
    animation: ai360-bounce 1.4s ease-in-out infinite both;
}

.ai360-nexus-dot:nth-child(1) { animation-delay: -0.32s; }
.ai360-nexus-dot:nth-child(2) { animation-delay: -0.16s; }
.ai360-nexus-dot:nth-child(3) { animation-delay: 0s; }

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

.ai360-nexus-loading-text {
    font-size: 13px;
    color: var(--ai360-text-secondary);
    margin-left: 4px;
}

/* ── Input Area ────────────────────────────────────────────────────────────── */
.ai360-nexus-input-area {
    padding: 12px 16px;
    background: var(--ai360-bg);
    border-top: 1px solid var(--ai360-border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ai360-nexus-input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--ai360-border);
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: var(--ai360-font);
    outline: none;
    transition: border-color 0.2s;
    background: var(--ai360-bg-secondary);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.ai360-nexus-input:focus {
    border-color: var(--ai360-primary);
    background: var(--ai360-bg);
    box-shadow: 0 0 0 3px rgba(129, 200, 192, 0.1);
}

.ai360-nexus-input::placeholder {
    color: var(--ai360-text-secondary);
}

.ai360-nexus-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ai360-primary);
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.ai360-nexus-send:hover {
    background: var(--ai360-primary-dark);
    transform: scale(1.05);
}

.ai360-nexus-send:active {
    transform: scale(0.95);
}

.ai360-nexus-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ai360-nexus-send:focus-visible {
    outline: 3px solid var(--ai360-primary-light);
    outline-offset: 2px;
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
.ai360-nexus-footer {
    padding: 8px 16px;
    background: var(--ai360-bg);
    border-top: 1px solid var(--ai360-border);
    text-align: center;
    font-size: 11px;
    color: var(--ai360-text-secondary);
    flex-shrink: 0;
}

.ai360-nexus-footer strong {
    color: var(--ai360-primary-dark);
}

/* ── Responsive: Mobile ────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .ai360-nexus-toggle {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
    }

    .ai360-nexus-panel {
        bottom: 80px;
        right: 8px;
        left: 8px;
        width: auto;
        max-width: none;
        height: calc(100dvh - 100px);
        max-height: none;
        border-radius: var(--ai360-radius) var(--ai360-radius) 0 0;
    }

    .ai360-nexus-message {
        max-width: 90%;
    }

    .ai360-nexus-input {
        font-size: 14px;
        padding: 10px 12px;
    }

    .ai360-nexus-send {
        width: 36px;
        height: 36px;
    }

    .ai360-nexus-input-area {
        padding: 8px 10px;
        gap: 6px;
    }
}

/* ── Accessibility: Reduced Motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .ai360-nexus-toggle,
    .ai360-nexus-panel,
    .ai360-nexus-message,
    .ai360-nexus-dot {
        animation: none !important;
        transition: none !important;
    }
}

/* ── Toolbar: Agents & Model ───────────────────────────────────────────────── */
.ai360-nexus-toolbar {
    display: flex;
    gap: 6px;
    padding: 4px 12px 2px;
    border-top: 1px solid #e5e7eb;
    align-items: center;
    font-size: 12px;
}

.ai360-nexus-agents-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 2px 10px;
    cursor: pointer;
    color: #374151;
    font-size: 11px;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
}

.ai360-nexus-agents-btn:hover {
    background: #e5e7eb;
}

.ai360-nexus-agents-btn.ai360-nexus-active {
    background: #e8f5f3;
    border-color: var(--ai360-primary);
    color: var(--ai360-primary-dark);
}

.ai360-nexus-agents-badge {
    background: var(--ai360-primary-dark);
    color: #fff;
    border-radius: 8px;
    padding: 0 5px;
    font-size: 10px;
    min-width: 14px;
    text-align: center;
    line-height: 1.4;
}

.ai360-nexus-model-select {
    margin-left: auto;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 11px;
    color: #374151;
    cursor: pointer;
}

/* ── Agents Selection Panel ────────────────────────────────────────────────── */
.ai360-nexus-agents-panel {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    height: 260px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--ai360-radius);
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
    z-index: 5;
}

.ai360-nexus-agents-panel-header {
    padding: 10px 14px;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
}

.ai360-nexus-agents-panel-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 14px;
    font-size: 12px;
}

/* ══════════════════════════════════════════════════════════════════════
   FLATSOME COLUMN PADDING OVERRIDE
   Counter Flatsome's .col-inner + .large-12 + .row padding/max-width
   ONLY on the content column chain — NOT on #wrapper/#content/#main
   (those keep the header + footer intact).
   ══════════════════════════════════════════════════════════════════════ */

.row:has(.ai360-nexus-fullpage),
.large-12:has(.ai360-nexus-fullpage),
.col-inner:has(.ai360-nexus-fullpage) {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.row:has(.ai360-nexus-fullpage) {
    max-width: none !important;
}

/* ══════════════════════════════════════════════════════════════════════
   FULL-PAGE MODE — Natural Flow (Native Integration)
   
   Design principles:
   - No fixed height → chat grows with content, browser scrollbar rules
   - No internal scroll → messages push page down naturally
   - Input always at bottom of chat area (sticky inside panel)
   - 100% width, edge-to-edge (overrides Flatsome container)
   - Clean light theme, integrated with 360group.ai
   - Minimal header with close/back button to return to site
   ══════════════════════════════════════════════════════════════════════ */

.ai360-nexus-fullpage {
    position: relative;
    width: 100%;
    margin: 0;
    font-family: inherit;
    background: #FFFFFF;
}

.ai360-nexus-fullpage .ai360-nexus-toggle {
    display: none;
}

/* Full-page panel: natural flow, NO fixed height → page scrollbar rules */
.ai360-nexus-fullpage .ai360-nexus-panel {
    display: flex !important;
    flex-direction: column;
    position: relative;
    width: 100%;
    min-height: 85vh;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    background: #FFFFFF;
    border: none;
    border-top: 1px solid #E5E7EB;
    /* NO height, NO max-height, NO overflow: hidden */
}

/* Header: minimal, light, with close/back button */
.ai360-nexus-fullpage .ai360-nexus-header {
    padding: 14px 24px;
    background: #FFFFFF;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai360-nexus-fullpage .ai360-nexus-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai360-nexus-fullpage .ai360-nexus-logo {
    font-size: 22px;
    line-height: 1;
}

.ai360-nexus-fullpage .ai360-nexus-title {
    font-size: 15px;
    font-weight: 600;
    color: #1A1A2E;
}

.ai360-nexus-fullpage .ai360-nexus-subtitle {
    display: none; /* Hidden: backend handles model routing, users don't need to see it */
}

.ai360-nexus-fullpage .ai360-nexus-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Close / Back to site button */
.ai360-nexus-close-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    color: #6B7280;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.ai360-nexus-close-btn:hover {
    background: #E5E7EB;
    color: #374151;
}

.ai360-nexus-close-btn:focus-visible {
    outline: 2px solid #81c8c0;
    outline-offset: 2px;
}

/* ══════════════════════════════════════════════════════════════════════
   OVERLAY FULLSCREEN — position:fixed above entire site (z-index:99999)
   
   When the EXPANDIR button is clicked, the fullpage chat becomes a
   fixed overlay covering the entire viewport — ABOVE the site header,
   menu, footer, everything.  The CERRAR button returns to normal.
   ══════════════════════════════════════════════════════════════════════ */

.ai360-nexus-fullpage.ai360-nexus-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    width: 100dvw !important;
    height: 100vh !important;
    height: 100dvh !important;
    margin: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100vw !important;
    max-width: 100dvw !important;
    z-index: 99999 !important;
    overflow: hidden;
    background: #FFFFFF;
}

.ai360-nexus-fullpage.ai360-nexus-overlay .ai360-nexus-panel {
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
}

/* In overlay mode we need internal scroll on messages */
.ai360-nexus-fullpage.ai360-nexus-overlay .ai360-nexus-messages {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

/* Messages area: natural flow, NO internal scroll */
.ai360-nexus-fullpage .ai360-nexus-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    padding: 32px 24px;
    background: #FAFAFA;
    /* NO overflow-y, NO max-height — grows naturally */
    /* Full-width responsive: no max-width, fills container */
    width: 100%;
    margin: 0;
}

/* Bot message: white bubble, left aligned, clean */
.ai360-nexus-fullpage .ai360-nexus-message {
    max-width: 75%;
}

.ai360-nexus-fullpage .ai360-nexus-message-bot .ai360-nexus-bubble {
    background: #FFFFFF;
    color: #1A1A2E;
    border: 1px solid #F0F0F0;
    border-radius: 0 14px 14px 14px;
    padding: 14px 18px;
    font-size: 15px;
    line-height: 1.6;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

/* User message: teal bubble, right aligned */
.ai360-nexus-fullpage .ai360-nexus-message-user .ai360-nexus-bubble {
    background: #81c8c0;
    color: #FFFFFF;
    border-radius: 14px 0 14px 14px;
    padding: 14px 18px;
    font-size: 15px;
    line-height: 1.6;
}

/* Input area: pinned at bottom of panel */
.ai360-nexus-fullpage .ai360-nexus-input-area {
    border-top: 1px solid #E5E7EB;
    padding: 16px 24px;
    background: #FFFFFF;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai360-nexus-fullpage .ai360-nexus-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.ai360-nexus-fullpage .ai360-nexus-input {
    flex: 1;
    border: 1.5px solid #E5E7EB;
    border-radius: 14px;
    padding: 14px 18px;
    font-size: 15px;
    font-family: inherit;
    background: #FFFFFF;
    color: #1A1A2E;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ai360-nexus-fullpage .ai360-nexus-input:focus {
    border-color: #81c8c0;
    box-shadow: 0 0 0 3px rgba(129, 200, 192, 0.12);
}

.ai360-nexus-fullpage .ai360-nexus-input::placeholder {
    color: #9CA3AF;
}

.ai360-nexus-fullpage .ai360-nexus-send {
    background: #81c8c0;
    color: #FFFFFF;
    border: none;
    border-radius: 12px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai360-nexus-fullpage .ai360-nexus-send:hover {
    background: #6ab5ad;
    transform: scale(1.04);
}

.ai360-nexus-fullpage .ai360-nexus-send:active {
    transform: scale(0.96);
}

.ai360-nexus-fullpage .ai360-nexus-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Loading indicator */
.ai360-nexus-fullpage .ai360-nexus-loading {
    padding: 12px 24px;
    background: #FAFAFA;
    justify-content: center;
}

/* Agents indicator — hidden from users (backend info only) */
.ai360-nexus-fullpage .ai360-nexus-agents {
    background: #F0F9F6;
    justify-content: center;
    font-size: 11px;
}

/* ══════════════════════════════════════════════════════════════════════
   FULLSCREEN MODE (F11) — optional, natural-flow compatible
   ══════════════════════════════════════════════════════════════════════ */
.ai360-nexus-fullpage:fullscreen,
.ai360-nexus-fullpage:-webkit-full-screen,
.ai360-nexus-fullpage:-moz-full-screen {
    background: #FFFFFF;
    overflow-y: auto;
}

.ai360-nexus-fullpage:fullscreen .ai360-nexus-panel,
.ai360-nexus-fullpage:-webkit-full-screen .ai360-nexus-panel,
.ai360-nexus-fullpage:-moz-full-screen .ai360-nexus-panel {
    min-height: 100vh;
    border-top: none;
}

/* ── Fullpage Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .ai360-nexus-fullpage .ai360-nexus-panel {
        min-height: 80vh;
    }

    .ai360-nexus-fullpage .ai360-nexus-header {
        padding: 10px 16px;
    }

    .ai360-nexus-fullpage .ai360-nexus-title {
        font-size: 14px;
    }

    .ai360-nexus-fullpage .ai360-nexus-messages {
        padding: 20px 16px;
        gap: 12px;
    }

    .ai360-nexus-fullpage .ai360-nexus-message {
        max-width: 88%;
    }

    .ai360-nexus-fullpage .ai360-nexus-message-bot .ai360-nexus-bubble {
        font-size: 14px;
        padding: 12px 16px;
    }

    .ai360-nexus-fullpage .ai360-nexus-input-area {
        padding: 12px 16px;
    }

    .ai360-nexus-fullpage .ai360-nexus-input-row {
        gap: 8px;
    }

    .ai360-nexus-fullpage .ai360-nexus-input {
        flex: 1;
        min-width: 0;
        font-size: 14px;
        padding: 12px 16px;
    }

    .ai360-nexus-fullpage .ai360-nexus-send {
        width: 42px;
        height: 42px;
        flex-shrink: 0;
    }

    .ai360-nexus-fullpage .ai360-nexus-close-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .ai360-nexus-fullpage .ai360-nexus-panel {
        min-height: 70vh;
    }

    .ai360-nexus-fullpage .ai360-nexus-messages {
        padding: 16px 12px;
    }

    .ai360-nexus-fullpage .ai360-nexus-message {
        max-width: 92%;
    }

    .ai360-nexus-fullpage .ai360-nexus-message-bot .ai360-nexus-bubble {
        font-size: 13px;
    }

    .ai360-nexus-fullpage .ai360-nexus-input-area {
        padding: 10px 12px;
    }

    .ai360-nexus-fullpage .ai360-nexus-input {
        font-size: 14px;
        padding: 12px 14px;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   RTL SUPPORT
   ══════════════════════════════════════════════════════════════════════ */
[dir="rtl"] .ai360-nexus-chat {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .ai360-nexus-message {
    text-align: right;
}

[dir="rtl"] .ai360-nexus-input-area {
    flex-direction: row-reverse;
}

[dir="rtl"] .ai360-nexus-send {
    transform: scaleX(-1);
}

[dir="rtl"] .ai360-nexus-toggle {
    left: 20px;
    right: auto;
}

[dir="rtl"] .ai360-nexus-panel {
    left: 20px;
    right: auto;
}

/* ══════════════════════════════════════════════════════════════════════
   DARK MODE — Override for dark theme toggle (fullpage + bubble)
   ══════════════════════════════════════════════════════════════════════ */
.ai360-nexus-fullpage[data-theme="dark"] {
    background: #0F172A;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-panel {
    background: #1E293B;
    border-top-color: #334155;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-header {
    background: #1E293B;
    border-bottom-color: #334155;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-title {
    color: #E2E8F0;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-close-btn {
    background: #334155;
    border-color: #475569;
    color: #CBD5E1;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-close-btn:hover {
    background: #475569;
    color: #E2E8F0;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-messages {
    background: #0F172A;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-message-bot .ai360-nexus-bubble {
    background: #1E293B;
    color: #E2E8F0;
    border-color: #334155;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-message-user .ai360-nexus-bubble {
    background: #1e4d48;
    color: #E0E7FF;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-input-area {
    background: #1E293B;
    border-top-color: #334155;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-input {
    background: #0F172A !important;
    color: #E2E8F0 !important;
    border-color: #334155 !important;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-input::placeholder {
    color: #64748B !important;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-send {
    background: #4a9d94 !important;
    color: #fff !important;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-send:hover {
    background: #3d857d !important;
}

/* Bubble-mode dark overrides */
.ai360-nexus-chat[data-theme="dark"] .ai360-nexus-panel {
    background: #1E293B;
    border-color: #334155;
}

.ai360-nexus-chat[data-theme="dark"] .ai360-nexus-panel .ai360-nexus-messages {
    background: #0F172A;
}

.ai360-nexus-chat[data-theme="dark"] .ai360-nexus-panel .ai360-nexus-input {
    background: #0F172A !important;
    color: #E2E8F0 !important;
    border-color: #334155 !important;
}

.ai360-nexus-chat[data-theme="dark"] .ai360-nexus-panel .ai360-nexus-input::placeholder {
    color: #64748B !important;
}

.ai360-nexus-chat[data-theme="dark"] .ai360-nexus-panel .ai360-nexus-message-user .ai360-nexus-bubble {
    background: #1e4d48;
    color: #E0E7FF;
}

.ai360-nexus-chat[data-theme="dark"] .ai360-nexus-panel .ai360-nexus-message-bot .ai360-nexus-bubble {
    background: #1E293B;
    color: #E2E8F0;
}

/* ══════════════════════════════════════════════════════════════════════
   DARK MODE — Enhanced CSS custom properties override
   ══════════════════════════════════════════════════════════════════════ */
.ai360-nexus-chat[data-theme="dark"] {
    --ai360-bg: #0F172A;
    --ai360-surface: #1E293B;
    --ai360-border: #334155;
    --ai360-text: #E2E8F0;
    --ai360-text-secondary: #94A3B8;
    --ai360-primary: #4a9d94;
    --ai360-primary-dark: #3d857d;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-header {
    background: linear-gradient(135deg, #1E293B, #0F172A);
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-header * {
    color: #E2E8F0 !important;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-messages {
    background: #0F172A;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-message-user .ai360-nexus-bubble {
    background: #1e4d48;
    color: #E0E7FF;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-message-bot .ai360-nexus-bubble {
    background: #1E293B;
    color: #E2E8F0;
    border-color: #334155;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-input-area {
    background: #1E293B;
    border-top-color: #334155;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-input {
    background: #0F172A !important;
    color: #E2E8F0 !important;
    border-color: #334155 !important;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-input::placeholder {
    color: #64748B !important;
}


.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-send {
    background: #4a9d94 !important;
    color: #fff !important;
}

.ai360-nexus-fullpage[data-theme="dark"] .ai360-nexus-send:hover {
    background: #3d857d !important;
}

.ai360-nexus-chat[data-theme="dark"] .ai360-nexus-panel {
    background: #1E293B;
    border-color: #334155;
}

.ai360-nexus-chat[data-theme="dark"] .ai360-nexus-panel .ai360-nexus-header,
.ai360-nexus-chat[data-theme="dark"] .ai360-nexus-panel .ai360-nexus-header * {
    background: linear-gradient(135deg, #1E293B, #0F172A);
    color: #E2E8F0 !important;
}

.ai360-nexus-chat[data-theme="dark"] .ai360-nexus-panel .ai360-nexus-messages {
    background: #0F172A;
}

.ai360-nexus-chat[data-theme="dark"] .ai360-nexus-panel .ai360-nexus-input {
    background: #0F172A !important;
    color: #E2E8F0 !important;
    border-color: #334155 !important;
}

.ai360-nexus-chat[data-theme="dark"] .ai360-nexus-panel .ai360-nexus-input::placeholder {
    color: #64748B !important;
}

.ai360-nexus-chat[data-theme="dark"] .ai360-nexus-panel .ai360-nexus-message-user .ai360-nexus-bubble {
    background: #1e4d48;
    color: #E0E7FF;
}

.ai360-nexus-chat[data-theme="dark"] .ai360-nexus-panel .ai360-nexus-message-bot .ai360-nexus-bubble {
    background: #1E293B;
    color: #E2E8F0;
}
