/* ============================================================
   OZY — AI Project Advisor  |  modal + bottom-right panel
   ============================================================ */

/* ── Shared variables (on widget root) ───────────────────── */
#dan-widget {
  --ozy-bg0:    #07142a;
  --ozy-bg1:    #0c1d35;
  --ozy-bg2:    #142a4a;
  --ozy-lime:   #CFF023;
  --ozy-ldim:   #A8C81C;
  --ozy-lsoft:  rgba(207,240,35,.12);
  --ozy-fg1:    #E6F0F8;
  --ozy-fg2:    #A4B5CC;
  --ozy-fg3:    #6A7A95;
  --ozy-bdr:    rgba(207,240,35,.14);
  --ozy-bdr2:   rgba(207,240,35,.28);
  --ozy-mono:   'JetBrains Mono', ui-monospace, monospace;
  --ozy-sans:   'Inter Tight', -apple-system, system-ui, sans-serif;
}

/* ═══════════════════════════════════════════════════════════
   CENTER MODAL
   ═══════════════════════════════════════════════════════════ */

#ozy-modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 22, 0.52);
  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.4s ease;
}
#ozy-modal.visible {
  opacity: 1;
  pointer-events: auto;
}

#ozy-modal-card {
  background: #07142a;
  border: 1px solid rgba(207,240,35,.28);
  border-radius: 20px;
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 40px 120px rgba(0,0,0,.8),
    0 0 0 1px rgba(207,240,35,.07),
    inset 0 1px 0 rgba(207,240,35,.1);
  /* dot-grid texture */
  background-image: radial-gradient(circle, rgba(207,240,35,.045) 1px, transparent 1px);
  background-size: 24px 24px;
  transform: translateY(28px) scale(0.93);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
#ozy-modal.visible #ozy-modal-card {
  transform: translateY(0) scale(1);
}

/* Lime accent bar */
#ozy-modal-card::before {
  content: '';
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #CFF023, transparent);
  border-radius: 20px 20px 0 0;
  z-index: 1;
}

/* Topbar: tag + close */
.ozy-mc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
  flex-shrink: 0;
}
.ozy-mc-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #CFF023;
  opacity: .8;
}
#ozy-modal-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(207,240,35,.18);
  color: #6A7A95;
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .18s, color .18s, border-color .18s;
  line-height: 1;
}
#ozy-modal-close:hover { background: rgba(207,240,35,.12); color: #CFF023; border-color: rgba(207,240,35,.4); }

/* Hero header */
.ozy-mc-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 4px 20px 18px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(207,240,35,.1);
}
.ozy-mc-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(207,240,35,.06);
  border: 1.5px solid rgba(207,240,35,.28);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.ozy-mc-icon::after {
  content: '';
  position: absolute; left: 0; right: 0; height: 40%;
  top: -40%;
  background: linear-gradient(to bottom, transparent, rgba(207,240,35,.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-mc-icon .dan-neural { width: 44px; height: 44px; filter: drop-shadow(0 0 6px rgba(207,240,35,.55)); }

.ozy-mc-intro { flex: 1; min-width: 0; }
.ozy-mc-name {
  font-family: 'Inter Tight', sans-serif;
  font-size: 28px; font-weight: 800;
  color: #E6F0F8; letter-spacing: -0.5px; line-height: 1.1;
  margin-bottom: 4px;
}
.ozy-mc-name em { color: #CFF023; font-style: normal; }
.ozy-mc-sub {
  font-family: 'Inter Tight', sans-serif;
  font-size: 13px; color: #A4B5CC; 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: 'JetBrains Mono', 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;
  animation: ozy-blink 2.2s ease infinite;
  flex-shrink: 0;
}
@keyframes ozy-blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* Modal messages */
#ozy-modal-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
  min-height: 100px;
  max-height: 300px;
}
#ozy-modal-msgs::-webkit-scrollbar { width: 3px; }
#ozy-modal-msgs::-webkit-scrollbar-thumb { background: rgba(207,240,35,.18); border-radius: 2px; }

/* Modal input row */
.ozy-mc-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 16px;
  background: rgba(12,29,53,.8);
  border-top: 1px solid rgba(207,240,35,.12);
  flex-shrink: 0;
}
#ozy-modal-input {
  flex: 1;
  background: #07142a;
  border: 1px solid rgba(207,240,35,.18);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: 'Inter Tight', sans-serif;
  font-size: 13.5px; color: #E6F0F8;
  resize: none; outline: none;
  min-height: 44px; max-height: 110px; line-height: 1.5;
  transition: border-color .18s;
}
#ozy-modal-input::placeholder { color: #6A7A95; }
#ozy-modal-input:focus { border-color: rgba(207,240,35,.42); }
#ozy-modal-send {
  width: 42px; height: 42px; border-radius: 12px;
  background: #CFF023; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .18s, transform .15s, opacity .15s;
}
#ozy-modal-send:hover:not(:disabled) { background: #A8C81C; transform: scale(1.06); }
#ozy-modal-send:disabled { opacity: .38; cursor: not-allowed; }
#ozy-modal-send svg { width: 17px; height: 17px; fill: #0c1d35; }

.ozy-mc-foot {
  text-align: center;
  padding: 7px 0 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; color: #3E4E68; letter-spacing: .5px;
  background: rgba(12,29,53,.9);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   SHARED MESSAGE BUBBLES (used in both modal + panel)
   ═══════════════════════════════════════════════════════════ */

.dan-msg {
  display: flex; flex-direction: column; max-width: 86%;
  animation: dan-in .22s ease;
}
@keyframes dan-in {
  from { opacity:0; transform:translateY(6px); }
  to   { opacity:1; transform:translateY(0); }
}
.dan-msg.agent { align-self: flex-start; align-items: flex-start; }
.dan-msg.user  { align-self: flex-end;   align-items: flex-end; }
.dan-bubble {
  padding: 10px 14px; border-radius: 13px;
  font-family: 'Inter Tight', sans-serif;
  font-size: 13.5px; line-height: 1.62; word-break: break-word;
}
.dan-msg.agent .dan-bubble {
  background: #142a4a; color: #E6F0F8;
  border: 1px solid rgba(207,240,35,.14); border-bottom-left-radius: 4px;
}
.dan-msg.user .dan-bubble {
  background: #CFF023; color: #0c1d35;
  font-weight: 500; border-bottom-right-radius: 4px;
}
.dan-bubble p       { margin: 0 0 6px; }
.dan-bubble p:last-child { margin-bottom: 0; }
.dan-bubble strong  { color: #CFF023; font-weight: 700; }
.dan-msg.user .dan-bubble strong { color: #0c1d35; }
.dan-bubble em      { font-style: italic; color: #A4B5CC; }
.dan-bubble code    { font-family: 'JetBrains Mono', monospace; font-size: .88em; background: rgba(207,240,35,.1); padding: 1px 5px; border-radius: 3px; color: #CFF023; }
.dan-bubble ul      { margin: 6px 0 6px 16px; padding: 0; }
.dan-bubble li      { margin-bottom: 3px; }
.dan-bubble a       { color: #CFF023; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; transition: color .15s, opacity .15s; }
.dan-bubble a:hover { color: #fff; opacity: .9; }
.dan-msg.user .dan-bubble a       { color: #07142a; }
.dan-msg.user .dan-bubble a:hover { color: #0c1d35; opacity: .7; }
.dan-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; color: #6A7A95; margin-top: 3px; padding: 0 3px;
}

/* ── Stream text ─────────────────────────────────────────── */
.ozy-stream-text { white-space: pre-wrap; word-break: break-word; }

/* Draft offer */
.dan-draft-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.dan-draft-yes {
  background: #CFF023; color: #0c1d35;
  border: none; border-radius: 8px;
  padding: 7px 14px; font-family: 'Inter Tight', sans-serif;
  font-size: 12.5px; font-weight: 700; cursor: pointer;
  transition: background .18s, transform .15s;
}
.dan-draft-yes:hover { background: #A8C81C; transform: translateY(-1px); }
.dan-draft-no {
  background: rgba(255,255,255,.06); color: #6A7A95;
  border: 1px solid rgba(207,240,35,.14); border-radius: 8px;
  padding: 7px 14px; font-family: 'Inter Tight', sans-serif;
  font-size: 12.5px; cursor: pointer;
  transition: background .18s, color .18s;
}
.dan-draft-no:hover { background: rgba(255,255,255,.1); color: #A4B5CC; }

/* Typing indicator */
#dan-typing {
  display: flex; align-items: center; gap: 4px;
  padding: 11px 14px; background: #142a4a;
  border: 1px solid rgba(207,240,35,.14);
  border-radius: 13px; border-bottom-left-radius: 4px;
  align-self: flex-start; width: fit-content;
  animation: dan-in .22s ease;
}
.dan-td {
  width: 6px; height: 6px; border-radius: 50%;
  background: #6A7A95; animation: dan-bounce 1.3s ease infinite;
}
.dan-td:nth-child(2) { animation-delay: .18s; }
.dan-td:nth-child(3) { animation-delay: .36s; }
@keyframes dan-bounce {
  0%,60%,100% { transform: translateY(0);    opacity: .45; }
  30%          { transform: translateY(-5px); opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════
   BOTTOM-RIGHT WIDGET
   ═══════════════════════════════════════════════════════════ */

/* ── Floating trigger ────────────────────────────────────── */
#dan-trigger {
  position: fixed;
  bottom: 88px; right: 28px;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: #0c1d35;
  border: 1.5px solid rgba(207,240,35,.3);
  cursor: pointer; z-index: 9998;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 28px rgba(207,240,35,.25), 0 2px 10px rgba(0,0,0,.55);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
  outline: none;
}
#dan-trigger:hover {
  transform: scale(1.1);
  border-color: rgba(207,240,35,.65);
  box-shadow: 0 6px 38px rgba(207,240,35,.48), 0 2px 10px rgba(0,0,0,.55);
}
#dan-trigger::before {
  content: ''; position: absolute; inset: -8px; border-radius: 50%;
  border: 1.5px solid #CFF023; 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; }
}

/* ── Neural icon (used in both trigger and modal) ────────── */
.dan-ai-icon {
  position: absolute; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .25s ease, transform .28s ease;
}
.dan-neural {
  width: 38px; height: 38px;
  filter: drop-shadow(0 0 5px rgba(207,240,35,.55));
}
/* No CSS spin needed — animateTransform handles it in SVG */

/* open/close swap */
#dan-trigger .dan-ai-icon { opacity: 1; transform: scale(1) rotate(0deg); }
#dan-trigger .icon-close  {
  opacity: 0; transform: rotate(-90deg) scale(0.6);
  position: absolute; width: 22px; height: 22px; fill: #A4B5CC;
  transition: transform .3s ease, opacity .22s;
}
#dan-trigger.open .dan-ai-icon { opacity: 0; transform: scale(0.6) rotate(90deg); pointer-events: none; }
#dan-trigger.open .icon-close  { opacity: 1; transform: rotate(0deg) scale(1); }

/* Badge */
#dan-badge {
  position: absolute; top: 2px; right: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #ef4444; border: 2px solid #0c1d35; display: none;
}
#dan-badge.show { display: block; }

/* ── Notification bubble ─────────────────────────────────── */
#dan-bubble {
  position: fixed; bottom: 162px; right: 28px;
  background: #0c1d35; border: 1px solid rgba(207,240,35,.28);
  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,.55), inset 0 1px 0 rgba(207,240,35,.1);
}
#dan-bubble.visible { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
#dan-bubble::before {
  content: ''; position: absolute; top: 0; left: 14px; right: 14px; height: 1px;
  background: linear-gradient(90deg, transparent, #CFF023, transparent);
}
#dan-bubble::after {
  content: ''; position: absolute; bottom: -7px; right: 26px;
  width: 12px; height: 12px; background: #0c1d35;
  border-right: 1px solid rgba(207,240,35,.28); border-bottom: 1px solid rgba(207,240,35,.28);
  transform: rotate(45deg);
}
.dan-bubble-header { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.dan-bubble-label  { font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: #CFF023; }
.dan-bubble-dots   { display: flex; align-items: center; gap: 3px; }
.dan-bubble-dot    { width: 4px; height: 4px; border-radius: 50%; background: #CFF023; animation: ozy-dot-blink 1.4s ease infinite; }
.dan-bubble-dot:nth-child(2) { animation-delay: .2s; }
.dan-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)} }
.dan-bubble-text   { font-family: 'Inter Tight', sans-serif; font-size: 13px; line-height: 1.5; color: #A4B5CC; }
.dan-bubble-close  {
  position: absolute; top: 8px; right: 8px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,.06); border: 1px solid rgba(207,240,35,.14);
  color: #6A7A95; font-size: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; line-height: 1;
  transition: background .18s, color .18s;
}
.dan-bubble-close:hover { background: rgba(207,240,35,.12); color: #CFF023; }

/* ── Chat panel ──────────────────────────────────────────── */
#dan-panel {
  position: fixed; bottom: 162px; right: 28px;
  width: 384px; height: 548px;
  background: #07142a;
  border: 1px solid rgba(207,240,35,.14);
  border-radius: 14px; z-index: 9999;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 32px 96px rgba(0,0,0,.65), inset 0 1px 0 rgba(207,240,35,.07);
  opacity: 0; transform: translateY(18px) scale(0.96);
  pointer-events: none;
  transition: opacity .32s cubic-bezier(0.34,1.56,0.64,1), transform .32s cubic-bezier(0.34,1.56,0.64,1);
}
#dan-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* Panel header */
#dan-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; background: #0c1d35;
  border-bottom: 1px solid rgba(207,240,35,.14); flex-shrink: 0;
}
.dan-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #CFF023; color: #0c1d35;
  font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(207,240,35,.28);
}
.dan-hinfo { flex: 1; min-width: 0; }
.dan-hname {
  font-family: 'Inter Tight', sans-serif; font-size: 13.5px; font-weight: 700;
  color: #E6F0F8; display: flex; align-items: center; gap: 7px; letter-spacing: -.01em;
}
.dan-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #22c55e; flex-shrink: 0;
  animation: ozy-blink 2.2s ease infinite;
}
.dan-hmodel {
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  color: #6A7A95; margin-top: 2px; letter-spacing: .4px; text-transform: uppercase;
}
#dan-close {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid rgba(207,240,35,.14); background: transparent;
  color: #6A7A95; font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .18s, color .18s; flex-shrink: 0; line-height: 1;
}
#dan-close:hover { background: rgba(207,240,35,.12); color: #CFF023; }

/* Panel messages */
#dan-messages {
  flex: 1; overflow-y: auto; padding: 16px 14px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth; overscroll-behavior: contain;
}
#dan-messages::-webkit-scrollbar { width: 3px; }
#dan-messages::-webkit-scrollbar-thumb { background: rgba(207,240,35,.16); border-radius: 2px; }

/* Panel input */
#dan-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px; background: #0c1d35;
  border-top: 1px solid rgba(207,240,35,.14); flex-shrink: 0;
}
#dan-input {
  flex: 1; background: #07142a;
  border: 1px solid rgba(207,240,35,.14); border-radius: 10px;
  padding: 9px 13px; font-family: 'Inter Tight', sans-serif;
  font-size: 13.5px; color: #E6F0F8; resize: none; outline: none;
  min-height: 40px; max-height: 110px; line-height: 1.5; transition: border-color .18s;
}
#dan-input::placeholder { color: #6A7A95; }
#dan-input:focus { border-color: rgba(207,240,35,.4); }
#dan-send {
  width: 38px; height: 38px; border-radius: 10px;
  background: #CFF023; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .18s, transform .15s, opacity .15s;
}
#dan-send:hover:not(:disabled) { background: #A8C81C; transform: scale(1.06); }
#dan-send:disabled { opacity: .38; cursor: not-allowed; }
#dan-send svg { width: 16px; height: 16px; fill: #0c1d35; }

/* Panel footer */
#dan-foot {
  text-align: center; padding: 5px 0 6px;
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  color: #3E4E68; letter-spacing: .5px; background: #0c1d35; flex-shrink: 0;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 520px) {
  #ozy-modal-card { border-radius: 16px; max-height: 95vh; }
  .ozy-mc-name    { font-size: 22px; }
  .ozy-mc-hero    { padding: 4px 14px 14px; gap: 12px; }
  .ozy-mc-icon    { width: 52px; height: 52px; }
  .ozy-mc-icon .dan-neural { width: 36px; height: 36px; }
  #dan-panel  { bottom: 0; right: 0; left: 0; width: 100%; height: 88dvh; border-radius: 18px 18px 0 0; border-bottom: none; }
  #dan-trigger { bottom: 80px; right: 18px; }
  #dan-bubble  { right: 14px; bottom: 152px; max-width: calc(100vw - 70px); }
}

/* ── Light theme (keep widget dark) ─────────────────────── */
@media (prefers-color-scheme: light) {
  #dan-trigger { box-shadow: 0 4px 28px rgba(207,240,35,.55), 0 2px 14px rgba(12,29,53,.3); border-color: rgba(207,240,35,.5); }
}
[data-theme="light"] #dan-trigger { box-shadow: 0 4px 28px rgba(207,240,35,.55), 0 2px 14px rgba(12,29,53,.3); border-color: rgba(207,240,35,.5); }
