/* Delta Force AI Assistant — Tactical Gaming / Google Stitch UI */
:root {
    --dfai-primary: #84cc16;
    --dfai-primary-bright: #9ee939;
    --dfai-bg: #0b0e14;
    --dfai-surface: #151a21;
    --dfai-surface-high: #1d2026;
    --dfai-border: rgba(132, 204, 22, 0.35);
    --dfai-text: #e1e2eb;
    --dfai-muted: #9ca3af;
    --dfai-bubble-size: 60px;
    --dfai-win-w: 390px;
    --dfai-win-h: 580px;
}

.dfai-root {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 9990;
    font-family: "Be Vietnam Pro", ui-sans-serif, system-ui, sans-serif;
    color: var(--dfai-text);
    pointer-events: none;
}

.dfai-root.dfai-pos-left {
    right: auto;
    left: 22px;
}

.dfai-root * {
    box-sizing: border-box;
}

/* Launcher + Tooltip */
.dfai-launcher-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
}

.dfai-pos-left .dfai-launcher-wrap {
    flex-direction: row-reverse;
}

.dfai-tooltip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--dfai-bg);
    color: var(--dfai-text);
    border: 1px solid var(--dfai-border);
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.48), 0 0 12px rgba(132, 204, 22, 0.16);
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.dfai-tooltip.is-hidden {
    display: none;
}

.dfai-tooltip-dot {
    width: 7px;
    height: 7px;
    background: var(--dfai-primary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--dfai-primary);
    flex-shrink: 0;
}

.dfai-tooltip-close {
    background: transparent;
    border: none;
    color: var(--dfai-muted);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 0 2px;
}

.dfai-tooltip-close:hover {
    color: var(--dfai-primary);
}

.dfai-launcher {
    position: relative;
    width: var(--dfai-bubble-size);
    height: var(--dfai-bubble-size);
    border-radius: 14px;
    border: 1.5px solid var(--dfai-primary);
    background: radial-gradient(circle at 30% 30%, #1d2616, var(--dfai-bg) 75%);
    color: var(--dfai-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), 0 0 18px rgba(132, 204, 22, 0.32);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dfai-launcher:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.6), 0 0 24px rgba(132, 204, 22, 0.55);
}

.dfai-launcher-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.dfai-fx-on .dfai-launcher-ring {
    position: absolute;
    inset: -4px;
    border-radius: 16px;
    border: 1.5px solid var(--dfai-primary);
    opacity: 0.45;
    animation: dfaiPulse 2.4s ease-out infinite;
    pointer-events: none;
}

.dfai-fx-off .dfai-launcher-ring {
    display: none;
}

@keyframes dfaiPulse {
    0% { transform: scale(0.96); opacity: 0.65; }
    70% { transform: scale(1.16); opacity: 0; }
    100% { transform: scale(1.16); opacity: 0; }
}

.dfai-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--dfai-primary);
    color: #0b0e14;
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--dfai-bg);
}

.dfai-unread-badge.is-hidden {
    display: none;
}

/* Chat Window */
.dfai-window {
    pointer-events: auto;
    width: min(var(--dfai-win-w), calc(100vw - 24px));
    height: min(var(--dfai-win-h), calc(100vh - 104px));
    background: var(--dfai-bg);
    border: 1px solid var(--dfai-border);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.72), 0 0 24px rgba(132, 204, 22, 0.14);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 12px;
    position: relative;
}

.dfai-window[hidden] {
    display: none !important;
}

.dfai-window.is-expanded {
    width: min(680px, calc(100vw - 32px));
    height: min(760px, calc(100vh - 96px));
}

/* Header */
.dfai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
    background: linear-gradient(90deg, #131820, #192218);
    border-bottom: 1px solid var(--dfai-border);
}

.dfai-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.dfai-brand-logo {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border: 1px solid var(--dfai-border);
    background: var(--dfai-bg);
    padding: 3px;
}

.dfai-brand-meta {
    min-width: 0;
}

.dfai-brand-name {
    font-family: "Space Grotesk", "Be Vietnam Pro", sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--dfai-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dfai-brand-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: "JetBrains Mono", monospace;
    font-size: 10px;
    color: var(--dfai-primary);
    text-transform: uppercase;
}

.dfai-online-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--dfai-primary);
    box-shadow: 0 0 8px var(--dfai-primary);
}

.dfai-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.dfai-icon-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--dfai-text);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.dfai-icon-btn:hover {
    border-color: var(--dfai-primary);
    color: var(--dfai-primary);
}

.dfai-btn-close:hover {
    border-color: #ef4444;
    color: #ef4444;
}

/* Privacy Notice */
.dfai-privacy-bar {
    background: rgba(132, 204, 22, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 12px;
    font-size: 11px;
    color: #c1cab0;
    line-height: 1.35;
}

/* Messages */
.dfai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background:
        linear-gradient(rgba(132, 204, 22, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(132, 204, 22, 0.03) 1px, transparent 1px),
        var(--dfai-bg);
    background-size: 24px 24px;
}

.dfai-msg {
    display: flex;
    gap: 8px;
    max-width: 90%;
    align-items: flex-end;
}

.dfai-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.dfai-msg-assistant {
    align-self: flex-start;
}

.dfai-msg-avatar {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--dfai-border);
    background: var(--dfai-surface);
    flex-shrink: 0;
}

.dfai-msg-bubble {
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dfai-msg-assistant .dfai-msg-bubble {
    background: var(--dfai-surface-high);
    color: var(--dfai-text);
    border-left: 2px solid var(--dfai-primary);
}

.dfai-msg-user .dfai-msg-bubble {
    background: var(--dfai-primary);
    color: #0b0e14;
    font-weight: 500;
    border-color: var(--dfai-primary);
}

.dfai-msg-bubble a {
    color: var(--dfai-primary-bright);
    text-decoration: underline;
}

.dfai-msg-user .dfai-msg-bubble a {
    color: #0b0e14;
}

.dfai-msg-handoff-cta {
    margin-top: 8px;
    display: inline-block;
    background: rgba(132, 204, 22, 0.14);
    border: 1px solid var(--dfai-primary);
    color: var(--dfai-primary);
    font-size: 11px;
    font-weight: 700;
    padding: 5px 10px;
    cursor: pointer;
    text-transform: uppercase;
}

/* Typing indicator */
.dfai-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 10px;
    background: var(--dfai-bg);
}

.dfai-typing[hidden] {
    display: none !important;
}

.dfai-typing-bubble {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--dfai-surface-high);
    border: 1px solid var(--dfai-border);
    padding: 7px 10px;
    font-size: 11px;
    color: var(--dfai-muted);
}

.dfai-typing-bubble span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--dfai-primary);
    animation: dfaiBounce 1.2s infinite ease-in-out;
}

.dfai-typing-bubble span:nth-child(2) { animation-delay: 0.18s; }
.dfai-typing-bubble span:nth-child(3) { animation-delay: 0.36s; }
.dfai-typing-bubble em { font-style: normal; margin-left: 4px; }

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

/* Quick Questions */
.dfai-quick-wrap {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding: 8px 12px;
    background: var(--dfai-surface);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    scrollbar-width: thin;
}

.dfai-quick-btn {
    flex: 0 0 auto;
    background: rgba(132, 204, 22, 0.1);
    border: 1px solid rgba(132, 204, 22, 0.35);
    color: var(--dfai-text);
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.dfai-quick-btn:hover {
    background: var(--dfai-primary);
    color: #0b0e14;
}

/* Handoff Panel */
.dfai-handoff-panel {
    position: absolute;
    inset: 58px 0 0 0;
    background: var(--dfai-bg);
    z-index: 20;
    display: flex;
    flex-direction: column;
    padding: 14px;
    overflow-y: auto;
}

.dfai-handoff-panel[hidden] {
    display: none !important;
}

.dfai-handoff-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: var(--dfai-primary);
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
}

.dfai-handoff-head button {
    background: transparent;
    border: none;
    color: var(--dfai-text);
    font-size: 20px;
    cursor: pointer;
}

.dfai-handoff-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dfai-handoff-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.dfai-handoff-form input,
.dfai-handoff-form select,
.dfai-handoff-form textarea {
    width: 100%;
    background: var(--dfai-surface-high);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--dfai-text);
    padding: 8px 10px;
    font-size: 12px;
}

.dfai-consent-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 11px;
    color: #c1cab0;
    line-height: 1.4;
    background: rgba(132, 204, 22, 0.07);
    border: 1px solid rgba(132, 204, 22, 0.25);
    padding: 8px;
}

.dfai-consent-check input {
    width: auto;
    margin-top: 2px;
}

.dfai-handoff-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.dfai-btn-primary {
    flex: 1;
    background: var(--dfai-primary);
    color: #0b0e14;
    border: none;
    font-weight: 700;
    font-size: 12px;
    padding: 9px 12px;
    cursor: pointer;
    text-transform: uppercase;
}

.dfai-btn-ghost {
    background: transparent;
    color: var(--dfai-text);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 12px;
    padding: 9px 12px;
    cursor: pointer;
}

/* Footer & Input */
.dfai-footer {
    background: var(--dfai-surface);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 10px 10px;
}

.dfai-footer-tools {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 6px;
}

.dfai-staff-btn {
    background: transparent;
    border: 1px solid rgba(255, 185, 95, 0.45);
    color: #ffb95f;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    cursor: pointer;
}

.dfai-staff-btn:hover {
    background: rgba(255, 185, 95, 0.14);
}

.dfai-input-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.dfai-input-form textarea {
    flex: 1;
    background: var(--dfai-bg);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--dfai-text);
    padding: 9px 10px;
    font-size: 13px;
    line-height: 1.35;
    resize: none;
    max-height: 92px;
}

.dfai-input-form textarea:focus {
    outline: none;
    border-color: var(--dfai-primary);
}

.dfai-send-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: var(--dfai-primary);
    color: #0b0e14;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 700;
}

.dfai-send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Support 24/7 Hub Addon */
.dfai-support-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.dfai-support-card {
    background: rgba(11, 14, 20, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dfai-support-card-primary {
    border-color: var(--dfai-border);
}

.dfai-sc-tag {
    font-family: "JetBrains Mono", monospace;
    font-size: 10px;
    color: var(--dfai-primary);
    letter-spacing: 0.08em;
}

.dfai-support-card h3 {
    font-family: "Space Grotesk", sans-serif;
    font-size: 17px;
    font-weight: 700;
    text-transform: uppercase;
    margin: 0;
}

.dfai-support-card p {
    font-size: 13px;
    color: #c1cab0;
    margin: 0;
    flex: 1;
}

.dfai-channel-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dfai-ch-btn {
    display: inline-block;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--dfai-border);
    color: var(--dfai-primary);
    text-decoration: none;
}

.dfai-ch-muted {
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--dfai-muted);
}

.dfai-support-split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    align-items: start;
}

.dfai-support-col > .max-w-3xl {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
}

.dfai-faq-accordion {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dfai-faq-item {
    background: rgba(11, 14, 20, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 14px;
}

.dfai-faq-item summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--dfai-text);
}

.dfai-faq-ans {
    margin-top: 8px;
    font-size: 13px;
    color: #c1cab0;
    line-height: 1.55;
}

/* Home card quick AI trigger */
.dfai-home-ai-btn {
    margin-top: 6px;
    width: 100%;
    padding: 7px 10px;
    background: rgba(132, 204, 22, 0.12);
    border: 1px solid var(--dfai-primary);
    color: var(--dfai-primary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
}

.dfai-home-ai-btn:hover {
    background: var(--dfai-primary);
    color: #0b0e14;
}

/* Responsive Tablet & Mobile */
@media (max-width: 768px) {
    .dfai-root.dfai-hide-mobile {
        display: none !important;
    }
    .dfai-root {
        bottom: 14px;
        right: 14px;
    }
    .dfai-root.dfai-pos-left {
        left: 14px;
    }
    .dfai-tooltip {
        display: none;
    }
    .dfai-window,
    .dfai-window.is-expanded {
        position: fixed;
        inset: 10px;
        width: auto;
        height: auto;
        margin: 0;
        z-index: 9995;
    }
    .dfai-handoff-row {
        grid-template-columns: 1fr;
    }
}
