/* OZY AI Agent — Widget CSS v2.0 */

:root {
    --ozy-accent:     #CFF023;
    --ozy-accent-rgb: 207, 240, 35;
    --ozy-accent-dim: #a8c81c;
}

/* Reset theme button styles inside widgets so site CSS can't bleed in */
#ozy-widget-wrap button,
#ozy-modal button {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    text-transform: none !important;
    font-family: inherit;
    line-height: 1;
    margin: 0;
    letter-spacing: normal;
    text-decoration: none;
    min-height: 0;
    min-width: 0;
}
#ozy-widget-wrap button:hover,
#ozy-widget-wrap button:focus,
#ozy-widget-wrap button:active,
#ozy-modal button:hover,
#ozy-modal button:focus,
#ozy-modal button:active {
    outline: none !important;
    box-shadow: none !important;
    background-image: none !important;
}

#ozy-widget-wrap {
    --ozy-bg0:  #07142a;
    --ozy-bg1:  #0c1d35;
    --ozy-bg2:  #142a4a;
    --ozy-fg1:  #E6F0F8;
    --ozy-fg2:  #A4B5CC;
    --ozy-fg3:  #6A7A95;
    --ozy-bdr:  rgba(var(--ozy-accent-rgb), .14);
    --ozy-bdr2: rgba(var(--ozy-accent-rgb), .28);
}

/* ═══════════════════════════════════════════════════════════
   CENTER MODAL (popup)
   ═══════════════════════════════════════════════════════════ */
#ozy-modal {
    position: fixed;
    inset: 0;
    background: rgba(4, 10, 22, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}
#ozy-modal.ozy-visible {
    opacity: 1;
    pointer-events: auto;
}

#ozy-modal-card {
    background: var(--ozy-bg0);
    border: 1px solid var(--ozy-bdr2);
    border-radius: 20px;
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 40px 120px rgba(0,0,0,.75), inset 0 1px 0 rgba(var(--ozy-accent-rgb), .1);
    background-image: radial-gradient(circle, rgba(var(--ozy-accent-rgb), .04) 1px, transparent 1px);
    background-size: 24px 24px;
    transform: translateY(24px) scale(0.94);
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}
#ozy-modal-card::before {
    content: '';
    position: absolute;
    top: 0; left: 24px; right: 24px; height: 2px;
    background: linear-gradient(90deg, transparent, var(--ozy-accent), transparent);
    z-index: 1;
}
#ozy-modal.ozy-visible #ozy-modal-card { transform: translateY(0) scale(1); }

/* Modal topbar */
.ozy-mc-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 6px;
    flex-shrink: 0;
}
.ozy-mc-tag {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 9px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.4px;
    color: var(--ozy-accent); opacity: .75;
}
#ozy-modal-close {
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(255,255,255,.06);
    border: 1px solid var(--ozy-bdr2);
    color: var(--ozy-fg3); font-size: 13px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .18s, color .18s;
    line-height: 1; padding: 0;
}
#ozy-modal-close:hover { background: rgba(var(--ozy-accent-rgb),.12); color: var(--ozy-accent); }

/* Modal hero */
.ozy-mc-hero {
    display: flex; align-items: center; gap: 16px;
    padding: 6px 20px 16px;
    border-bottom: 1px solid var(--ozy-bdr);
    flex-shrink: 0;
}
.ozy-mc-icon {
    width: 60px; height: 60px; border-radius: 50%;
    background: rgba(var(--ozy-accent-rgb),.07);
    border: 1.5px solid var(--ozy-bdr2);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; position: relative; overflow: hidden;
}
.ozy-mc-icon img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.ozy-mc-icon::after {
    content: '';
    position: absolute; left: 0; right: 0; height: 40%; top: -40%;
    background: linear-gradient(to bottom, transparent, rgba(var(--ozy-accent-rgb),.18) 50%, transparent);
    border-radius: 50%;
    animation: ozy-scan 2.8s ease-in-out infinite;
    pointer-events: none;
}
@keyframes ozy-scan { 0% { top: -40%; } 100% { top: 100%; } }
.ozy-neural { width: 42px; height: 42px; filter: drop-shadow(0 0 6px rgba(var(--ozy-accent-rgb),.55)); }

.ozy-mc-intro { flex: 1; min-width: 0; }
.ozy-mc-name {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter Tight', sans-serif;
    font-size: 26px; font-weight: 800;
    color: var(--ozy-fg1); letter-spacing: -.5px; line-height: 1.1;
    margin-bottom: 4px;
}
.ozy-mc-name em { color: var(--ozy-accent); font-style: normal; }
.ozy-mc-sub { font-size: 13px; color: var(--ozy-fg2); margin-bottom: 8px; }
.ozy-mc-badge {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.25);
    border-radius: 20px; padding: 3px 10px;
    font-family: monospace; font-size: 9px; font-weight: 700;
    color: #22c55e; letter-spacing: .6px; text-transform: uppercase;
}
.ozy-online-dot {
    width: 5px; height: 5px; border-radius: 50%; background: #22c55e; flex-shrink: 0;
    animation: ozy-blink 2.2s ease infinite;
}
@keyframes ozy-blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* Modal messages */
#ozy-modal-msgs {
    flex: 1; overflow-y: auto; padding: 14px 18px;
    display: flex; flex-direction: column; gap: 10px;
    scroll-behavior: smooth; min-height: 80px; max-height: 300px;
}
#ozy-modal-msgs::-webkit-scrollbar { width: 3px; }
#ozy-modal-msgs::-webkit-scrollbar-thumb { background: rgba(var(--ozy-accent-rgb),.18); border-radius: 2px; }

/* Modal input row */
.ozy-mc-input-row {
    display: flex; align-items: flex-end; gap: 8px;
    padding: 10px 14px;
    background: rgba(12,29,53,.85);
    border-top: 1px solid var(--ozy-bdr); flex-shrink: 0;
}
#ozy-modal-input {
    flex: 1; background: var(--ozy-bg0);
    border: 1px solid var(--ozy-bdr); border-radius: 10px;
    padding: 9px 13px; font-size: 13.5px; color: var(--ozy-fg1);
    resize: none; outline: none; min-height: 42px; max-height: 110px;
    line-height: 1.5; transition: border-color .18s;
    font-family: inherit;
}
#ozy-modal-input::placeholder { color: var(--ozy-fg3); }
#ozy-modal-input:focus { border-color: rgba(var(--ozy-accent-rgb),.4); }
#ozy-modal-send {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--ozy-accent) !important; border: none !important; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: background .18s, transform .15s, opacity .15s;
    padding: 0; color: #0c1d35;
}
#ozy-modal-send:hover:not(:disabled) { background: var(--ozy-accent-dim) !important; transform: scale(1.06); }
#ozy-modal-send:disabled { opacity: .35; cursor: not-allowed; }
#ozy-modal-send svg { width: 16px; height: 16px; fill: #0c1d35; display: block; }

.ozy-mc-foot {
    text-align: center; padding: 6px 0 7px;
    font-family: monospace; font-size: 9px; color: #3E4E68;
    letter-spacing: .5px; background: rgba(12,29,53,.9); flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   SHARED MESSAGE BUBBLES
   ═══════════════════════════════════════════════════════════ */
.ozy-msg {
    display: flex; flex-direction: column; max-width: 86%;
    animation: ozy-in .22s ease;
}
@keyframes ozy-in { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
.ozy-msg.agent { align-self: flex-start; align-items: flex-start; }
.ozy-msg.user  { align-self: flex-end;   align-items: flex-end; }
.ozy-bubble {
    padding: 10px 14px; border-radius: 13px;
    font-size: 13.5px; line-height: 1.62; word-break: break-word;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.ozy-msg.agent .ozy-bubble {
    background: var(--ozy-bg2); color: var(--ozy-fg1);
    border: 1px solid var(--ozy-bdr); border-bottom-left-radius: 4px;
}
.ozy-msg.user .ozy-bubble {
    background: var(--ozy-accent); color: #0c1d35;
    font-weight: 500; border-bottom-right-radius: 4px;
}
.ozy-bubble p           { margin: 0 0 6px; }
.ozy-bubble p:last-child { margin-bottom: 0; }
.ozy-msg.agent .ozy-bubble strong { color: var(--ozy-fg2); font-weight: 700; }
.ozy-msg.user  .ozy-bubble strong { color: #0c1d35; font-weight: 700; }
.ozy-bubble em          { font-style: italic; color: var(--ozy-fg2); }
.ozy-bubble code        { font-family: monospace; font-size: .88em; background: rgba(var(--ozy-accent-rgb),.1); padding: 1px 5px; border-radius: 3px; color: var(--ozy-accent); }
.ozy-bubble ul          { margin: 6px 0 6px 16px; padding: 0; }
.ozy-bubble li          { margin-bottom: 3px; }
.ozy-bubble a           { color: var(--ozy-accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; transition: color .15s; }
.ozy-bubble a:hover     { color: #fff; }
.ozy-msg.user .ozy-bubble a       { color: #07142a; }
.ozy-msg.user .ozy-bubble a:hover { opacity: .7; }
.ozy-time {
    font-family: monospace; font-size: 9px;
    color: var(--ozy-fg3); margin-top: 3px; padding: 0 3px;
}
.ozy-stream-text { white-space: pre-wrap; word-break: break-word; }

/* Typing indicator */
#ozy-typing {
    display: flex; align-items: center; gap: 4px;
    padding: 11px 14px; background: var(--ozy-bg2);
    border: 1px solid var(--ozy-bdr); border-radius: 13px;
    border-bottom-left-radius: 4px; align-self: flex-start;
    width: fit-content; animation: ozy-in .22s ease;
}
.ozy-td {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--ozy-fg3); animation: ozy-bounce 1.3s ease infinite;
}
.ozy-td:nth-child(2) { animation-delay: .18s; }
.ozy-td:nth-child(3) { animation-delay: .36s; }
@keyframes ozy-bounce { 0%,60%,100%{transform:translateY(0);opacity:.45} 30%{transform:translateY(-5px);opacity:1} }

/* ═══════════════════════════════════════════════════════════
   FLOATING WIDGET (button + panel)
   ═══════════════════════════════════════════════════════════ */
#ozy-widget-wrap { position: relative; z-index: 9998; }

/* Trigger button */
#ozy-trigger {
    position: fixed; bottom: 88px; right: 28px;
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--ozy-bg1);
    border: 1.5px solid rgba(var(--ozy-accent-rgb),.3);
    cursor: pointer; z-index: 9998;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 28px rgba(var(--ozy-accent-rgb),.22), 0 2px 10px rgba(0,0,0,.5);
    transition: transform .22s, box-shadow .22s, border-color .22s;
    outline: none;
}
#ozy-trigger:hover {
    transform: scale(1.1);
    border-color: rgba(var(--ozy-accent-rgb),.6);
    box-shadow: 0 6px 38px rgba(var(--ozy-accent-rgb),.44), 0 2px 10px rgba(0,0,0,.5);
}
#ozy-trigger::before {
    content: ''; position: absolute; inset: -8px; border-radius: 50%;
    border: 1.5px solid var(--ozy-accent); opacity: 0;
    animation: ozy-pulse 3s ease-out infinite;
}
@keyframes ozy-pulse { 0%{transform:scale(1);opacity:.7} 100%{transform:scale(1.7);opacity:0} }

.ozy-ai-icon {
    position: absolute; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    transition: opacity .25s, transform .28s;
}
#ozy-trigger .ozy-ai-icon { opacity: 1; transform: scale(1) rotate(0deg); }
#ozy-trigger .icon-close  {
    opacity: 0; transform: rotate(-90deg) scale(0.6);
    position: absolute; width: 22px; height: 22px; fill: var(--ozy-fg2);
    transition: transform .3s, opacity .22s;
}
#ozy-trigger.open .ozy-ai-icon  { opacity: 0; transform: scale(0.6) rotate(90deg); pointer-events: none; }
#ozy-trigger.open .icon-close   { opacity: 1; transform: rotate(0deg) scale(1); }

#ozy-badge {
    position: absolute; top: 2px; right: 2px;
    width: 14px; height: 14px; border-radius: 50%;
    background: #ef4444; border: 2px solid var(--ozy-bg1); display: none;
}
#ozy-badge.show { display: block; }

/* Notification bubble */
#ozy-bubble {
    position: fixed; bottom: 162px; right: 28px;
    background: var(--ozy-bg1); border: 1px solid var(--ozy-bdr2);
    border-radius: 14px; padding: 13px 38px 13px 15px;
    max-width: 260px; z-index: 9997;
    cursor: pointer; opacity: 0;
    transform: translateY(14px) scale(0.91);
    transition: opacity .35s cubic-bezier(0.34,1.56,0.64,1), transform .35s cubic-bezier(0.34,1.56,0.64,1);
    pointer-events: none;
    box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
#ozy-bubble.ozy-visible { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
#ozy-bubble::before {
    content: ''; position: absolute; top: 0; left: 14px; right: 14px; height: 1px;
    background: linear-gradient(90deg, transparent, var(--ozy-accent), transparent);
}
#ozy-bubble::after {
    content: ''; position: absolute; bottom: -7px; right: 26px;
    width: 12px; height: 12px; background: var(--ozy-bg1);
    border-right: 1px solid var(--ozy-bdr2); border-bottom: 1px solid var(--ozy-bdr2);
    transform: rotate(45deg);
}
.ozy-bubble-header { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.ozy-bubble-label  { font-family: monospace; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--ozy-accent); }
.ozy-bubble-dots   { display: flex; align-items: center; gap: 3px; }
.ozy-bubble-dot    { width: 4px; height: 4px; border-radius: 50%; background: var(--ozy-accent); animation: ozy-dot-blink 1.4s ease infinite; }
.ozy-bubble-dot:nth-child(2) { animation-delay: .2s; }
.ozy-bubble-dot:nth-child(3) { animation-delay: .4s; }
@keyframes ozy-dot-blink { 0%,60%,100%{opacity:.3;transform:scale(1)} 30%{opacity:1;transform:scale(1.4)} }
.ozy-bubble-text { font-size: 13px; line-height: 1.5; color: var(--ozy-fg2); }
.ozy-bubble-close {
    position: absolute; top: 8px; right: 8px;
    width: 20px; height: 20px; border-radius: 50%;
    background: rgba(255,255,255,.06); border: 1px solid var(--ozy-bdr);
    color: var(--ozy-fg3); font-size: 10px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .18s, color .18s; padding: 0;
}
.ozy-bubble-close:hover { background: rgba(var(--ozy-accent-rgb),.12); color: var(--ozy-accent); }

/* Chat panel */
#ozy-panel {
    position: fixed; bottom: 162px; right: 28px;
    width: 380px; height: 540px;
    background: var(--ozy-bg0); border: 1px solid var(--ozy-bdr);
    border-radius: 14px; z-index: 9999;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 32px 96px rgba(0,0,0,.6);
    opacity: 0; transform: translateY(16px) scale(0.97);
    pointer-events: none;
    transition: opacity .3s cubic-bezier(0.34,1.56,0.64,1), transform .3s cubic-bezier(0.34,1.56,0.64,1);
}
#ozy-panel.ozy-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* Panel header */
#ozy-panel-header {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 15px; background: var(--ozy-bg1);
    border-bottom: 1px solid var(--ozy-bdr); flex-shrink: 0;
}
.ozy-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--ozy-accent); color: #0c1d35;
    font-family: monospace; font-weight: 700; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; box-shadow: 0 0 0 2px rgba(var(--ozy-accent-rgb),.25);
    overflow: hidden;
}
.ozy-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.ozy-hinfo { flex: 1; min-width: 0; }
.ozy-hname {
    font-size: 13.5px; font-weight: 700; color: var(--ozy-fg1);
    display: flex; align-items: center; gap: 6px;
}
.ozy-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #22c55e; flex-shrink: 0; animation: ozy-blink 2.2s ease infinite;
}
.ozy-hmodel { font-family: monospace; font-size: 9px; color: var(--ozy-fg3); margin-top: 2px; letter-spacing: .4px; text-transform: uppercase; }
#ozy-panel-close {
    width: 28px; height: 28px; border-radius: 50%;
    border: 1px solid var(--ozy-bdr); background: transparent;
    color: var(--ozy-fg3); font-size: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .18s, color .18s; flex-shrink: 0; padding: 0;
}
#ozy-panel-close:hover { background: rgba(var(--ozy-accent-rgb),.12); color: var(--ozy-accent); }

#ozy-panel-msgs {
    flex: 1; overflow-y: auto; padding: 14px 13px;
    display: flex; flex-direction: column; gap: 10px;
    scroll-behavior: smooth; overscroll-behavior: contain;
}
#ozy-panel-msgs::-webkit-scrollbar { width: 3px; }
#ozy-panel-msgs::-webkit-scrollbar-thumb { background: rgba(var(--ozy-accent-rgb),.15); border-radius: 2px; }

#ozy-panel-input-row {
    display: flex; align-items: flex-end; gap: 7px;
    padding: 9px 11px; background: var(--ozy-bg1);
    border-top: 1px solid var(--ozy-bdr); flex-shrink: 0;
}
#ozy-panel-input {
    flex: 1; background: var(--ozy-bg0);
    border: 1px solid var(--ozy-bdr); border-radius: 9px;
    padding: 8px 12px; font-size: 13.5px; color: var(--ozy-fg1);
    resize: none; outline: none; min-height: 38px; max-height: 110px;
    line-height: 1.5; transition: border-color .18s; font-family: inherit;
}
#ozy-panel-input::placeholder { color: var(--ozy-fg3); }
#ozy-panel-input:focus { border-color: rgba(var(--ozy-accent-rgb),.4); }
#ozy-panel-send {
    width: 36px; height: 36px; border-radius: 9px;
    background: var(--ozy-accent) !important; border: none !important; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: background .18s, transform .15s, opacity .15s;
    padding: 0; color: #0c1d35;
}
#ozy-panel-send:hover:not(:disabled) { background: var(--ozy-accent-dim) !important; transform: scale(1.06); }
#ozy-panel-send:disabled { opacity: .35; cursor: not-allowed; }
#ozy-panel-send svg { width: 15px; height: 15px; fill: #0c1d35; display: block; }

#ozy-panel-foot {
    text-align: center; padding: 5px 0 5px;
    font-family: monospace; font-size: 9px; color: #3E4E68;
    letter-spacing: .5px; background: var(--ozy-bg1); flex-shrink: 0;
}

/* Voice buttons */
.ozy-mic-btn {
    flex-shrink: 0; width: 33px; height: 33px; border-radius: 50%;
    border: none !important; cursor: pointer;
    background: transparent !important; color: var(--ozy-fg2);
    display: flex; align-items: center; justify-content: center;
    transition: color .2s, transform .2s, background .2s; padding: 0;
}
.ozy-mic-btn:hover { color: var(--ozy-accent); background: rgba(var(--ozy-accent-rgb),.08) !important; }
.ozy-mic-btn.recording { color: #ff4444; background: rgba(255,68,68,.12) !important; animation: ozy-mic-pulse 1s ease-in-out infinite; }
.ozy-mic-btn.speaking  { color: var(--ozy-accent); background: rgba(var(--ozy-accent-rgb),.12) !important; animation: ozy-mic-pulse 1.6s ease-in-out infinite; }
.ozy-mic-btn svg { width: 18px; height: 18px; pointer-events: none; display: block; fill: currentColor; }
@keyframes ozy-mic-pulse { 0%,100%{transform:scale(1);opacity:1} 50%{transform:scale(1.28);opacity:.6} }

/* ── Left position variant ───────────────────────────────── */
#ozy-widget-wrap.ozy-pos-left #ozy-trigger { right: auto; left: 28px; }
#ozy-widget-wrap.ozy-pos-left #ozy-panel   { right: auto; left: 28px; }
#ozy-widget-wrap.ozy-pos-left #ozy-bubble  { right: auto; left: 28px; }
#ozy-widget-wrap.ozy-pos-left #ozy-bubble::after { right: auto; left: 26px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 520px) {
    #ozy-modal-card { border-radius: 16px; max-height: 95vh; }
    .ozy-mc-name    { font-size: 20px; }
    .ozy-mc-hero    { padding: 4px 14px 12px; gap: 11px; }
    .ozy-mc-icon    { width: 50px; height: 50px; }
    #ozy-panel      { bottom: 0; right: 0; left: 0; width: 100%; height: 88dvh; border-radius: 18px 18px 0 0; border-bottom: none; }
    #ozy-trigger    { bottom: 78px; right: 18px; }
    #ozy-bubble     { right: 14px; bottom: 150px; max-width: calc(100vw - 68px); }
    #ozy-widget-wrap.ozy-pos-left #ozy-trigger { left: 18px; right: auto; }
    #ozy-widget-wrap.ozy-pos-left #ozy-bubble  { left: 14px; right: auto; }
}

/* Keep widget dark in any theme */
@media (prefers-color-scheme: light) {
    #ozy-trigger { box-shadow: 0 4px 28px rgba(var(--ozy-accent-rgb),.5), 0 2px 14px rgba(12,29,53,.25); }
}
