/* ==========================================================================
   NTA Unified AI Chat Assistant - Modern Luxury Glassmorphism Styling
   ========================================================================== */

/* Fail-safe: Strictly hide chat widget on login and signup screens */
body:has(#unifiedLoginForm) #chatWidget,
body:has(#unifiedLoginForm) .chat-fab,
body:has(#loginCard) #chatWidget,
body:has(.login-card) #chatWidget,
body:has(.login-bg) #chatWidget,
body:has(#loginForm) #chatWidget,
body:has(#signupForm) #chatWidget,
body:has(#auxiliaryLoginForm) #chatWidget,
.login-card ~ #chatWidget,
.login-bg ~ #chatWidget {
    display: none !important;
}

/* Universal Floating Circular Chat FAB */
.chat-fab {
    position: fixed;
    bottom: 1.5rem;
    left: 1.75rem;
    z-index: 10000;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb, #1d4ed8, #0ea5e9);
    background-size: 200% 200%;
    color: #ffffff;
    box-shadow: 0 10px 25px -3px rgba(37, 99, 235, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.chat-fab:hover {
    transform: translateY(-4px) scale(1.06);
    box-shadow: 0 16px 35px -3px rgba(37, 99, 235, 0.65), 0 0 25px rgba(56, 189, 248, 0.5);
}

.chat-fab:active {
    transform: translateY(-1px) scale(0.98);
}

.chat-fab__icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.chat-fab svg {
    width: 28px !important;
    height: 28px !important;
    display: block !important;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.chat-fab__pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(56, 189, 248, 0.6);
    animation: chatPulseRing 2.5s infinite;
    pointer-events: none;
}

.chat-fab__badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0f172a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

@keyframes chatPulseRing {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.2);
        opacity: 0;
    }
    100% {
        transform: scale(0.95);
        opacity: 0;
    }
}

/* Chat Dialog Backdrop & Floating Window */
.chat-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: transparent;
    display: none;
    pointer-events: none;
}

.chat-dialog-backdrop.is-open {
    display: block;
    pointer-events: auto;
}

.chat-dialog {
    position: fixed;
    bottom: 5.75rem;
    left: 1.75rem;
    z-index: 10001;
    width: 410px;
    max-width: calc(100vw - 2.5rem);
    height: 590px;
    max-height: calc(100vh - 7.5rem);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(11, 19, 43, 0.99) 100%);
    border: 1px solid rgba(59, 130, 246, 0.35);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 35px rgba(37, 99, 235, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    direction: rtl;
    text-align: right;
    font-family: 'Tajawal', system-ui, -apple-system, sans-serif;
    pointer-events: auto;
}

/* Header */
.chat-dialog__header {
    padding: 0.9rem 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(90deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

.chat-dialog__header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-dialog__avatar {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.chat-dialog__avatar svg {
    width: 22px;
    height: 22px;
}

.chat-dialog__status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 11px;
    height: 11px;
    background: #10b981;
    border: 2px solid #0f172a;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

.chat-dialog__titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-dialog__title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #f8fafc;
}

.chat-dialog__role-badge {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.chat-dialog__subtitle {
    font-size: 0.75rem;
    color: #94a3b8;
}

.chat-dialog__header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-dialog__action-btn,
.chat-dialog__close {
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-dialog__action-btn:hover,
.chat-dialog__close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #f8fafc;
    transform: scale(1.05);
}

.chat-dialog__close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Chat Body */
.chat-dialog__body {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* Custom Sleek Scrollbar */
.chat-dialog__body::-webkit-scrollbar,
.chat-dialog__suggestions::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.chat-dialog__body::-webkit-scrollbar-track,
.chat-dialog__suggestions::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.3);
}

.chat-dialog__body::-webkit-scrollbar-thumb,
.chat-dialog__suggestions::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.25);
    border-radius: 999px;
}

.chat-dialog__body::-webkit-scrollbar-thumb:hover,
.chat-dialog__suggestions::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.5);
}

/* Welcome Card */
.chat-welcome-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.85));
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 16px;
    padding: 1.25rem 1rem;
    text-align: center;
    margin-top: 0.5rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.chat-welcome-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 0.75rem auto;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.chat-welcome-icon svg {
    width: 26px !important;
    height: 26px !important;
    display: block !important;
    flex-shrink: 0;
}

.chat-welcome-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 0.4rem;
}

.chat-welcome-desc {
    font-size: 0.8rem;
    line-height: 1.6;
    color: #94a3b8;
}

/* Message Rows */
.chat-message-row {
    display: flex;
    gap: 0.6rem;
    width: 100%;
    animation: chatMessageFadeIn 0.25s ease-out;
}

.chat-message-row--bot {
    align-items: flex-start;
}

.chat-message-row--user {
    justify-content: flex-start;
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.chat-message-avatar svg {
    width: 16px;
    height: 16px;
}

.chat-message-content {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    min-width: 0;
}

.chat-message-row--user .chat-message-content {
    align-items: flex-start;
}

.chat-message-row--bot .chat-message-content {
    align-items: flex-start;
}

/* Bubbles */
.chat-dialog__bubble {
    padding: 0.85rem 1rem;
    border-radius: 16px;
    font-size: 0.85rem;
    line-height: 1.65;
    position: relative;
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-wrap: break-word;
    word-break: break-word;
}

.chat-dialog__bubble--bot {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.15);
    color: #e2e8f0;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.chat-dialog__bubble--user {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-top-left-radius: 4px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.chat-message-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.25rem 0.4rem;
}

.chat-message-time {
    font-size: 0.68rem;
    color: #64748b;
}

.chat-message-copy {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 0.68rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 0;
    transition: color 0.2s ease;
}

.chat-message-copy:hover {
    color: #38bdf8;
}

.chat-message-copy.is-copied {
    color: #10b981;
    font-weight: 700;
}

/* Rich Content Elements Inside Bot Bubble */
.chat-paragraph {
    margin: 0 0 0.45rem 0;
}

.chat-paragraph:last-child {
    margin-bottom: 0;
}

.chat-spacer {
    height: 0.4rem;
}

.chat-heading {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.92rem;
    font-weight: 700;
    color: #38bdf8;
    margin: 0.6rem 0 0.35rem 0;
    padding-bottom: 3px;
    border-bottom: 1px dashed rgba(56, 189, 248, 0.2);
}

.chat-heading:first-child {
    margin-top: 0;
}

.chat-heading-bullet {
    color: #f59e0b;
    font-size: 0.8rem;
}

/* Lists */
.chat-list {
    margin: 0.4rem 0;
    padding-right: 1.1rem;
    padding-left: 0;
    list-style-type: disc;
}

.chat-list--ordered {
    list-style-type: decimal;
}

.chat-list li {
    margin-bottom: 0.35rem;
    line-height: 1.55;
}

.chat-list li:last-child {
    margin-bottom: 0;
}

/* Badges & Highlights */
.chat-highlight {
    background: rgba(56, 189, 248, 0.12);
    color: #7dd3fc;
    padding: 1px 6px;
    border-radius: 6px;
    font-weight: 600;
    border: 1px solid rgba(56, 189, 248, 0.25);
    display: inline-block;
    margin: 0 2px;
}

.chat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    margin: 2px 3px;
    vertical-align: middle;
}

.badge-icon {
    font-size: 0.82rem;
}

.chat-badge--track {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.chat-badge--date {
    background: rgba(14, 165, 233, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(14, 165, 233, 0.3);
}

.chat-badge--time {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.chat-badge--success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.chat-badge--warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.chat-badge--danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Callout Box */
.chat-callout {
    display: flex;
    gap: 0.6rem;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
    border-right: 3px solid #38bdf8;
    border-radius: 0 10px 10px 0;
    padding: 0.6rem 0.75rem;
    margin: 0.55rem 0;
    border-top: 1px solid rgba(56, 189, 248, 0.15);
    border-bottom: 1px solid rgba(56, 189, 248, 0.15);
    border-left: 1px solid rgba(56, 189, 248, 0.15);
}

.chat-callout__icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.chat-callout__content {
    font-size: 0.82rem;
    line-height: 1.55;
    color: #f1f5f9;
}

/* Code */
.chat-inline-code {
    background: rgba(15, 23, 42, 0.8);
    color: #38bdf8;
    padding: 1px 5px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.78rem;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.chat-code-block {
    background: #090d16;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    margin: 0.5rem 0;
    direction: ltr;
    text-align: left;
    overflow-x: auto;
}

.chat-code-block code {
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: #38bdf8;
}

/* Typing Indicator */
.chat-typing-bubble {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 0.9rem;
}

.chat-typing-dots {
    display: flex;
    gap: 4px;
}

.chat-typing-dots span {
    width: 6px;
    height: 6px;
    background: #38bdf8;
    border-radius: 50%;
    animation: chatTypingBounce 1.4s infinite ease-in-out both;
}

.chat-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.chat-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

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

.chat-typing-label {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Suggested Action Chips Tray */
.chat-dialog__suggestions-wrap {
    padding: 0.5rem 0.9rem 0.3rem 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(15, 23, 42, 0.6);
}

.chat-dialog__suggestions-title {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 0.35rem;
}

.chat-dialog__suggestions {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    white-space: nowrap;
}

.chat-chip {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #cbd5e1;
    font-size: 0.73rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-family: inherit;
}

.chat-chip:hover {
    background: rgba(37, 99, 235, 0.25);
    border-color: #38bdf8;
    color: #ffffff;
    transform: translateY(-1px);
}

/* Footer / Input Container */
.chat-dialog__footer {
    padding: 0.65rem 0.9rem;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.9);
}

.chat-dialog__input-container {
    flex: 1;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 14px;
    padding: 0.45rem 0.75rem;
    display: flex;
    align-items: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-dialog__input-container:focus-within {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
    background: rgba(30, 41, 59, 0.95);
}

.chat-dialog__input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #f8fafc;
    font-family: inherit;
    font-size: 0.83rem;
    resize: none;
    max-height: 90px;
    line-height: 1.4;
    direction: rtl;
}

.chat-dialog__input::placeholder {
    color: #64748b;
}

.chat-dialog__send {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.chat-dialog__send svg {
    width: 18px;
    height: 18px;
    transform: rotate(-45deg) translate(1px, -1px);
    transition: transform 0.2s ease;
}

.chat-dialog__send:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5);
}

.chat-dialog__send:hover svg {
    transform: rotate(-45deg) translate(3px, -3px);
}

.chat-dialog__send:active {
    transform: scale(0.96);
}

/* Animations */
@keyframes chatSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes chatFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Mobile Responsive Adjustments */
@media (max-width: 640px) {
    .chat-fab {
        bottom: 1rem;
        left: 1rem;
        width: 52px;
        height: 52px;
    }
    .chat-dialog {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 4.75rem;
        width: auto;
        max-width: none;
        height: calc(100vh - 6rem);
        border-radius: 16px;
    }
}


/* ==========================================================================
   Trainee Dual-Mode Human Technical Support Switcher & Live Thread Styles
   ========================================================================== */
.chat-mode-switcher {
    display: flex;
    gap: 6px;
    padding: 0.45rem 0.9rem;
    background: rgba(15, 23, 42, 0.92);
    border-bottom: 1px solid rgba(56, 189, 248, 0.18);
}

.chat-mode-tab {
    flex: 1;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(30, 41, 59, 0.65);
    color: #cbd5e1;
    border-radius: 10px;
    padding: 0.42rem 0.5rem;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.chat-mode-tab.is-active {
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.chat-message-escalate {
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 6px;
    padding: 2px 7px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.chat-message-escalate:hover {
    background: rgba(16, 185, 129, 0.28);
    color: #ffffff;
}

.chat-human-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.96);
}

.chat-human-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(30, 41, 59, 0.55);
}

.chat-human-btn {
    border: 1px solid rgba(56, 189, 248, 0.25);
    background: rgba(30, 41, 59, 0.85);
    color: #e2e8f0;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
}

.chat-human-btn--primary {
    background: rgba(37, 99, 235, 0.3);
    border-color: #38bdf8;
    color: #ffffff;
}

.chat-human-link {
    margin-right: auto;
    color: #38bdf8;
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
}

.chat-human-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.85rem;
    overflow-y: auto;
}

.chat-human-intro {
    font-size: 0.76rem;
    color: #94a3b8;
    line-height: 1.5;
    background: rgba(30, 41, 59, 0.6);
    padding: 0.5rem 0.65rem;
    border-radius: 10px;
    border-right: 3px solid #38bdf8;
}

.chat-human-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #e2e8f0;
    margin-top: 2px;
}

.chat-human-select,
.chat-human-input,
.chat-human-textarea,
.chat-human-file {
    width: 100%;
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 10px;
    padding: 0.45rem 0.65rem;
    color: #f8fafc;
    font-family: inherit;
    font-size: 0.78rem;
    outline: none;
    box-sizing: border-box;
}

.chat-human-submit {
    margin-top: 0.35rem;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    border-radius: 10px;
    padding: 0.6rem;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    font-family: inherit;
}

.chat-human-status {
    font-size: 0.75rem;
    color: #fbbf24;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.12);
}

.chat-human-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-human-ticket-card {
    background: rgba(30, 41, 59, 0.75);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 12px;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-human-ticket-card:hover {
    border-color: #38bdf8;
    background: rgba(30, 41, 59, 0.95);
}

.chat-human-ticket-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.chat-human-ticket-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #f8fafc;
}

.chat-human-ticket-status {
    font-size: 0.68rem;
    padding: 1px 6px;
    border-radius: 6px;
    font-weight: 700;
}

.chat-human-ticket-status.is-open {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
}

.chat-human-ticket-status.is-closed {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.chat-human-ticket-desk {
    font-size: 0.72rem;
    color: #38bdf8;
    margin-bottom: 3px;
}

.chat-human-ticket-preview {
    font-size: 0.73rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-human-thread-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.78rem;
    color: #f8fafc;
}

.chat-human-thread-header span {
    font-size: 0.7rem;
    color: #38bdf8;
}

.chat-human-thread-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    padding: 0.4rem 0;
}

.chat-human-msg {
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
    font-size: 0.78rem;
    line-height: 1.5;
    max-width: 90%;
}

.chat-human-msg--me {
    align-self: flex-start;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
}

.chat-human-msg--staff {
    align-self: flex-end;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #e2e8f0;
}

.chat-human-msg-sender {
    font-size: 0.68rem;
    font-weight: 700;
    opacity: 0.85;
    margin-bottom: 2px;
}

.chat-human-msg-attach a {
    color: #38bdf8;
    font-size: 0.72rem;
    text-decoration: underline;
}

.chat-human-reply-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-human-attach-btn {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 8px;
    padding: 0.4rem 0.55rem;
    cursor: pointer;
    color: #e2e8f0;
}

.chat-human-reply-input {
    flex: 1;
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.78rem;
    resize: none;
}

.chat-human-reply-send {
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    border: none;
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.76rem;
    cursor: pointer;
    font-family: inherit;
}

.chat-human-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 0.78rem;
    padding: 1.5rem 0.75rem;
}

/* ==========================================================================
   Light Mode Overrides — Full Contrast & Clarity for AI & Human Support Chat
   ========================================================================== */
html.light-mode .chat-fab__badge {
    border-color: #ffffff;
}

html.light-mode .chat-dialog {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-color: #cbd5e1;
    box-shadow: 0 22px 55px -12px rgba(15, 23, 42, 0.2), 0 0 24px rgba(59, 130, 246, 0.12);
}

html.light-mode .chat-dialog__header {
    background: linear-gradient(90deg, #f8fafc, #f1f5f9);
    border-bottom-color: #e2e8f0;
}

html.light-mode .chat-dialog__status-dot {
    border-color: #ffffff;
}

html.light-mode .chat-dialog__title {
    color: #0f172a;
}

html.light-mode .chat-dialog__role-badge {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #7dd3fc;
}

html.light-mode .chat-dialog__subtitle {
    color: #64748b;
}

html.light-mode .chat-dialog__action-btn,
html.light-mode .chat-dialog__close {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
}

html.light-mode .chat-dialog__action-btn:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3;
}

html.light-mode .chat-dialog__close:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

html.light-mode .chat-dialog__body::-webkit-scrollbar-track,
html.light-mode .chat-dialog__suggestions::-webkit-scrollbar-track {
    background: #f1f5f9;
}

html.light-mode .chat-dialog__body::-webkit-scrollbar-thumb,
html.light-mode .chat-dialog__suggestions::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

html.light-mode .chat-welcome-card {
    background: linear-gradient(135deg, #f8fafc, #eff6ff);
    border-color: #bfdbfe;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

html.light-mode .chat-welcome-title {
    color: #0f172a;
}

html.light-mode .chat-welcome-desc {
    color: #475569;
}

html.light-mode .chat-message-avatar {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border-color: #93c5fd;
    color: #1d4ed8;
}

html.light-mode .chat-dialog__bubble--bot {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

html.light-mode .chat-heading {
    color: #0369a1;
    border-bottom-color: rgba(2, 132, 199, 0.25);
}

html.light-mode .chat-highlight {
    background: #e0f2fe;
    color: #0c4a6e;
    border-color: #7dd3fc;
}

html.light-mode .chat-badge--track {
    background: #eef2ff;
    color: #3730a3;
    border-color: #c7d2fe;
}

html.light-mode .chat-badge--date {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #7dd3fc;
}

html.light-mode .chat-badge--time,
html.light-mode .chat-badge--warning {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

html.light-mode .chat-badge--success {
    background: #ecfdf5;
    color: #065f46;
    border-color: #6ee7b7;
}

html.light-mode .chat-badge--danger {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fca5a5;
}

html.light-mode .chat-callout {
    background: #f0f9ff;
    border-right-color: #0284c7;
    border-top-color: #bae6fd;
    border-bottom-color: #bae6fd;
    border-left-color: #bae6fd;
}

html.light-mode .chat-callout__content {
    color: #0f172a;
}

html.light-mode .chat-inline-code {
    background: #e2e8f0;
    color: #0369a1;
    border-color: #cbd5e1;
}

html.light-mode .chat-code-block {
    background: #f8fafc;
    border-color: #cbd5e1;
}

html.light-mode .chat-code-block code {
    color: #0c4a6e;
}

html.light-mode .chat-typing-label {
    color: #475569;
}

html.light-mode .chat-dialog__suggestions-wrap {
    background: #f8fafc;
    border-top-color: #e2e8f0;
}

html.light-mode .chat-dialog__suggestions-title {
    color: #475569;
}

html.light-mode .chat-chip {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #1e293b;
}

html.light-mode .chat-chip:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
}

html.light-mode .chat-dialog__footer {
    background: #f8fafc;
    border-top-color: #e2e8f0;
}

html.light-mode .chat-dialog__input-container {
    background: #ffffff;
    border-color: #cbd5e1;
}

html.light-mode .chat-dialog__input-container:focus-within {
    background: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

html.light-mode .chat-dialog__input {
    color: #0f172a;
}

html.light-mode .chat-dialog__input::placeholder {
    color: #94a3b8;
}

html.light-mode .chat-mode-switcher {
    background: #f1f5f9;
    border-bottom-color: #e2e8f0;
}

html.light-mode .chat-mode-tab:not(.is-active) {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #334155;
}

html.light-mode .chat-message-escalate {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #047857;
}

html.light-mode .chat-message-escalate:hover {
    background: #059669;
    color: #ffffff;
}

html.light-mode .chat-human-pane {
    background: #ffffff;
}

html.light-mode .chat-human-toolbar {
    background: #f8fafc;
    border-bottom-color: #e2e8f0;
}

html.light-mode .chat-human-btn {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #1e293b;
}

html.light-mode .chat-human-btn--primary {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
}

html.light-mode .chat-human-link {
    color: #0284c7;
}

html.light-mode .chat-human-intro {
    background: #f0f9ff;
    color: #334155;
    border-right-color: #0284c7;
}

html.light-mode .chat-human-label {
    color: #1e293b;
}

html.light-mode .chat-human-select,
html.light-mode .chat-human-input,
html.light-mode .chat-human-textarea,
html.light-mode .chat-human-file {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

html.light-mode .chat-human-status {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fcd34d;
}

html.light-mode .chat-human-ticket-card {
    background: #f8fafc;
    border-color: #cbd5e1;
}

html.light-mode .chat-human-ticket-card:hover {
    background: #eff6ff;
    border-color: #3b82f6;
}

html.light-mode .chat-human-ticket-title {
    color: #0f172a;
}

html.light-mode .chat-human-ticket-status.is-open {
    background: #ecfdf5;
    color: #047857;
}

html.light-mode .chat-human-ticket-status.is-closed {
    background: #e2e8f0;
    color: #475569;
}

html.light-mode .chat-human-ticket-desk {
    color: #0284c7;
}

html.light-mode .chat-human-ticket-preview {
    color: #64748b;
}

html.light-mode .chat-human-thread-header {
    color: #0f172a;
    border-bottom-color: #e2e8f0;
}

html.light-mode .chat-human-thread-header span {
    color: #0284c7;
}

html.light-mode .chat-human-msg--staff {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}

html.light-mode .chat-human-msg-attach a {
    color: #0284c7;
}

html.light-mode .chat-human-reply-bar {
    border-top-color: #e2e8f0;
}

html.light-mode .chat-human-attach-btn {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #334155;
}

html.light-mode .chat-human-reply-input {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}

html.light-mode .chat-human-empty {
    color: #64748b;
}
