/* OzySolutions AI Search — Chat UI */

:root {
    --ozy-primary: #0A1A2F;
    --ozy-accent: #CFF023;
    --ozy-accent-hover: #EFF7CF;
    --ozy-accent-dark: #a8c41a;
    --ozy-bg: #0A1A2F;
    --ozy-bg-2: #0e2038;
    --ozy-bg-3: #0c1d35;
    --ozy-border: rgba(207, 240, 35, 0.12);
    --ozy-border-bright: rgba(207, 240, 35, 0.22);
    --ozy-text: rgba(255,255,255,0.88);
    --ozy-text-muted: rgba(255,255,255,0.45);
    --ozy-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --ozy-radius: 12px;
}

/* ============================================================
   INLINE SHORTCODE CHAT WIDGET
   ============================================================ */
.ostech-chat-widget {
    width: 100%;
    max-width: 560px;
    background: var(--ozy-bg);
    border: 1px solid var(--ozy-border-bright);
    border-radius: 18px;
    box-shadow: 0 32px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(207,240,35,0.04), inset 0 1px 0 rgba(207,240,35,0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--ozy-font);
    font-size: 14px;
    position: relative;
}
.ostech-chat-widget::before {
    content: '';
    position: absolute;
    top: -1px; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--ozy-accent) 50%, transparent 100%);
    opacity: 0.7;
    pointer-events: none;
}

/* Header */
.ostech-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--ozy-border);
    flex-shrink: 0;
    background: var(--ozy-bg-2);
}
.ostech-chat-agent { display: flex; align-items: center; gap: 10px; }
.ostech-chat-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--ozy-accent);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ostech-chat-avatar svg { width: 17px; height: 17px; color: var(--ozy-primary); }
.ostech-chat-agent-name { font-size: 0.84rem; font-weight: 600; color: #fff; line-height: 1.2; }
.ostech-chat-agent-sub { font-size: 0.67rem; color: var(--ozy-text-muted); margin-top: 1px; }
.ostech-chat-status {
    display: flex; align-items: center; gap: 5px;
    font-size: 0.67rem; font-weight: 700; color: var(--ozy-accent); letter-spacing: 0.04em;
}
.ostech-chat-status-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--ozy-accent); box-shadow: 0 0 6px var(--ozy-accent);
    animation: ostechDotPulse 2s ease-in-out infinite;
}
@keyframes ostechDotPulse { 0%,100%{opacity:1;transform:scale(1);}50%{opacity:0.5;transform:scale(0.85);} }

/* Chat Body */
.ostech-chat-body {
    flex: 1; overflow-y: auto; padding: 14px 14px;
    display: flex; flex-direction: column; gap: 12px;
    min-height: 300px; max-height: 400px; scroll-behavior: smooth;
    background: var(--ozy-bg-3);
}
.ostech-chat-body::-webkit-scrollbar { width: 3px; }
.ostech-chat-body::-webkit-scrollbar-track { background: transparent; }
.ostech-chat-body::-webkit-scrollbar-thumb { background: rgba(207,240,35,0.15); border-radius: 2px; }

/* Messages */
.ostech-msg-row { display: flex; align-items: flex-start; gap: 8px; }
.ostech-msg-row.user-row { flex-direction: row-reverse; }
.ostech-msg-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: rgba(207,240,35,0.1); border: 1px solid rgba(207,240,35,0.2);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px;
}
.ostech-msg-avatar svg { width: 13px; height: 13px; color: var(--ozy-accent); }
.ostech-msg-bubble {
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07);
    border-radius: 4px 12px 12px 12px;
    padding: 10px 13px; max-width: calc(100% - 44px);
    font-size: 0.83rem; line-height: 1.7; color: var(--ozy-text) !important; letter-spacing: 2px !important;
}
.ostech-msg-row.user-row .ostech-msg-bubble {
    background: rgba(207,240,35,0.07); border-color: rgba(207,240,35,0.16);
    border-radius: 12px 4px 12px 12px; color: rgba(255,255,255,0.92);
}
.ostech-msg-bubble h3 { font-size: 0.88rem !important; font-weight: 600 !important; color: #fff !important; margin: 10px 0 5px !important; letter-spacing: 2px !important;}
.ostech-msg-bubble h3:first-child { margin-top: 0 !important; }
.ostech-msg-bubble h4 { font-size: 0.82rem; font-weight: 600; color: rgba(255,255,255,0.88); margin: 8px 0 4px; }
.ostech-msg-bubble p { margin: 5px 0; }
.ostech-msg-bubble p:first-child { margin-top: 0; }
.ostech-msg-bubble p:last-child { margin-bottom: 0; }
.ostech-msg-bubble ul,.ostech-msg-bubble ol { margin: 5px 0; padding-left: 15px; }
.ostech-msg-bubble li { margin: 3px 0; line-height: 1.6; }
.ostech-msg-bubble li::marker { color: var(--ozy-accent); }
.ostech-msg-bubble strong { color: #fff; font-weight: 600; }
.ostech-msg-bubble a { color: var(--ozy-accent); text-decoration: none; border-bottom: 1px solid rgba(207,240,35,0.3); transition: border-color 0.2s; }
.ostech-msg-bubble a:hover { border-color: var(--ozy-accent); }

/* Cursor & typing */
.ostech-cursor {
    display: inline-block; width: 2px; height: 1em;
    background: var(--ozy-accent); vertical-align: text-bottom; margin-left: 2px;
    animation: ostechBlink 0.9s ease-in-out infinite;
}
@keyframes ostechBlink { 0%,100%{opacity:1;}50%{opacity:0;} }
.ostech-typing-dots { display: flex; align-items: center; gap: 4px; padding: 4px 2px; }
.ostech-typing-dots span {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--ozy-accent); opacity: 0.4;
    animation: ostechDot 1.2s ease-in-out infinite;
}
.ostech-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ostech-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ostechDot { 0%,80%,100%{opacity:0.2;transform:scale(0.85);}40%{opacity:1;transform:scale(1.1);} }

/* Suggestion chips */
.ostech-chat-suggestions {
    padding: 8px 14px 6px; display: flex; flex-wrap: wrap; gap: 6px;
    flex-shrink: 0; border-top: 1px solid var(--ozy-border); background: var(--ozy-bg-2);
}
.ostech-sug-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px !important;
    border-radius: 14px !important;
    background: rgba(207, 240, 35, 0.06) !important;
    border: 1px solid rgba(207, 240, 35, 0.14) !important;
    font-size: 0.69rem !important;
    color: rgba(255, 255, 255, 0.6) !important;
    cursor: pointer;
    transition: all 0.18s;
    font-family: var(--ozy-font) !important;
    white-space: nowrap;
}
.ostech-sug-chip svg { width: 11px; height: 11px; flex-shrink: 0; color: rgba(255,255,255,0.3); }
.ostech-sug-chip:hover { background: rgba(207,240,35,0.13); border-color: rgba(207,240,35,0.3); color: var(--ozy-accent); }
.ostech-sug-chip:hover svg { color: var(--ozy-accent); }

/* Input row */
.ostech-chat-input-row {
    padding: 10px 13px; border-top: 1px solid var(--ozy-border);
    display: flex; align-items: center; gap: 8px;
    background: var(--ozy-bg-2); flex-shrink: 0;
}
.ostech-chat-input {
    flex: 1; background: none; border: none !important; outline: none !important;
    font-size: 0.82rem; color: rgba(255,255,255,0.75);
    font-family: var(--ozy-font); padding: 3px 0 !important; box-shadow: none !important;
}
.ostech-chat-input::placeholder { color: rgba(255,255,255,0.25); }
.ostech-chat-send {
    width: 30px !important; height: 30px !important; border-radius: 8px !important;
    background: var(--ozy-accent) !important; border: none !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    cursor: pointer !important; color: var(--ozy-primary) !important;
    transition: all 0.18s !important; flex-shrink: 0 !important;
    padding: 0 !important; box-shadow: none !important;
}
.ostech-chat-send:hover { background: var(--ozy-accent-hover) !important; box-shadow: 0 4px 14px rgba(207,240,35,0.3) !important; }
.ostech-chat-send svg { width: 13px !important; height: 13px !important; stroke: currentColor !important; fill: none !important; }

/* Footer */
.ostech-chat-footer {
    padding: 8px 18px 10px; border-top: 1px solid var(--ozy-border);
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0; background: var(--ozy-bg-2);
}
.ostech-chat-footer-actions { display: flex; align-items: center; gap: 14px; }
.ostech-chat-footer-btn {
    display: flex; align-items: center; gap: 4px;
    font-size: 0.89rem !important; color: rgba(255,255,255,0.35) !important;
    background: none !important; border: none; cursor: pointer;
    transition: color 0.18s; font-family: var(--ozy-font); padding: 0 !important;
}
.ostech-chat-footer-btn:hover,.ostech-chat-footer-btn:focus,.ostech-chat-footer-btn:focus-visible,.ostech-chat-footer-btn:active {
    background: none !important; background-color: transparent !important;
    box-shadow: none !important; outline: none !important; color: var(--ozy-accent) !important;
}
.ostech-chat-footer-btn svg { width: 11px; height: 11px; }
.ostech-chat-powered { font-size: 0.93rem; color: rgba(255,255,255,0.2) !important; display: flex; align-items: center; gap: 4px; }
.ostech-chat-powered svg { width: 9px; height: 9px; color: var(--ozy-accent); }

/* Sources */
.ostech-sources-section { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--ozy-border); }
.ostech-sources-title { font-size: 0.69rem; font-weight: 700; color: rgba(255,255,255,0.35); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 6px; display: flex; align-items: center; gap: 5px; }
.ostech-source-item {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 9px; margin: 3px 3px 0 0;
    font-size: 0.75rem; color: var(--ozy-accent);
    background: rgba(207,240,35,0.07); border: 1px solid rgba(207,240,35,0.18);
    border-radius: 7px; text-decoration: none; transition: all 0.2s;
}
.ostech-source-item:hover { background: rgba(207,240,35,0.15); border-color: rgba(207,240,35,0.35); }

/* Error */
.ostech-chat-error {
    padding: 9px 13px; background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2); border-radius: 9px;
    color: rgba(255,150,150,0.9); font-size: 0.81rem; line-height: 1.5;
}

/* Popup */
.ostech-popup-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    z-index: 99998; display: none; align-items: center; justify-content: center;
    padding: 20px; animation: ostechFadeIn 0.25s ease;
}
.ostech-popup-overlay.active { display: flex; }
@keyframes ostechFadeIn { from{opacity:0;}to{opacity:1;} }
.ostech-popup-chat { width: 520px; max-height: 85vh; animation: ostechSlideUp 0.35s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes ostechSlideUp { from{opacity:0;transform:translateY(30px) scale(0.95);}to{opacity:1;transform:translateY(0) scale(1);} }
.ostech-popup-chat .ostech-chat-widget { max-width: 100%; max-height: 85vh; }
.ostech-popup-chat .ostech-chat-body { min-height: 260px; max-height: 50vh; }
.ostech-popup-close { display: none; }

/* Responsive */
@media (max-width: 600px) {
    .ostech-popup-overlay { padding: 0 0 90px 0; align-items: flex-end; justify-content: center; }
    .ostech-popup-chat { width: 100%; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
    .ostech-chat-body { max-height: 45vh; }
}
