/* Phind AI chat widget — dark glass panel */
.phind-ai-container,
.phind-ai-container * { box-sizing: border-box; }

.phind-ai-container {
  --phind-primary: #c084fc;
  --phind-secondary: #4f46e5;
  --phind-accent: #22d3ee;
  --phind-radius: 28px;
  --phind-border: rgba(255, 255, 255, 0.11);
  --phind-text: #f8fbff;
  --phind-muted: rgba(226, 232, 240, 0.66);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  position: relative;
  width: 100%;
  min-height: 560px;
  color: var(--phind-text);
  line-height: 1.5;
}
.phind-ai-container button { appearance: none; margin: 0; padding: 0; font: inherit; box-shadow: none; outline: none; }
.phind-ai-container button:focus-visible { outline: 2px solid var(--phind-accent); outline-offset: 2px; }

.phind-chat-shell {
  position: relative;
  height: 620px;
  border-radius: var(--phind-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--phind-border);
  background:
    radial-gradient(circle at 18% 10%, rgba(192, 132, 252, 0.24), transparent 30%),
    radial-gradient(circle at 88% 18%, rgba(79, 70, 229, 0.24), transparent 32%),
    radial-gradient(circle at 82% 86%, rgba(34, 211, 238, 0.16), transparent 34%),
    linear-gradient(145deg, #111633 0%, #070918 54%, #02030b 100%);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  isolation: isolate;
}
.phind-chat-shell:fullscreen { border-radius: 0; height: 100vh; }
.phind-chat-shell::before,
.phind-chat-shell::after { content: ''; position: absolute; inset: -20%; pointer-events: none; z-index: -1; }
.phind-chat-shell::before {
  background: linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 92px 92px;
  -webkit-mask-image: radial-gradient(circle at center, #000 42%, transparent 83%);
  mask-image: radial-gradient(circle at center, #000 42%, transparent 83%);
}
.phind-chat-shell::after {
  background: conic-gradient(from 130deg, transparent, rgba(192,132,252,0.16), transparent, rgba(34,211,238,0.13), transparent);
  opacity: 0.7; filter: blur(58px);
  animation: phindAmbientSpin 20s linear infinite;
}
@keyframes phindAmbientSpin { to { transform: rotate(360deg); } }

/* header */
.phind-header {
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  padding: 18px 22px; min-height: 92px; flex-shrink: 0; z-index: 20;
  background: rgba(5, 8, 24, 0.66); border-bottom: 1px solid var(--phind-border);
  backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%);
}
.phind-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.phind-brand-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.phind-logo-text { color: #fff; font-size: 25px; font-weight: 800; line-height: 1; letter-spacing: -0.045em; text-shadow: 0 0 18px rgba(255,255,255,0.18); }
.phind-logo-subtitle { color: var(--phind-muted); font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* animated orb */
.phind-siri-mark {
  position: relative; width: 60px; height: 60px; flex: 0 0 60px; border-radius: 999px; display: grid; place-items: center;
  background:
    radial-gradient(circle at 34% 26%, rgba(255,255,255,0.92), rgba(255,255,255,0.06) 24%, transparent 28%),
    conic-gradient(from 180deg, var(--phind-accent), var(--phind-primary), #ff4fd8, var(--phind-secondary), var(--phind-accent));
  box-shadow: 0 0 26px rgba(192,132,252,0.35), 0 0 48px rgba(34,211,238,0.22), inset 0 0 18px rgba(255,255,255,0.18);
  animation: phindSiriFloat 4.4s ease-in-out infinite;
}
.phind-siri-mark::before { content: ''; position: absolute; inset: -8px; border-radius: inherit; background: inherit; filter: blur(14px); opacity: 0.42; z-index: -1; animation: phindSiriGlow 2.7s ease-in-out infinite; }
.phind-siri-core { width: 34px; height: 34px; border-radius: inherit; z-index: 3; background: radial-gradient(circle at 40% 30%, rgba(255,255,255,0.94), rgba(255,255,255,0.16) 30%, rgba(5,8,24,0.55) 70%); box-shadow: inset 0 0 18px rgba(255,255,255,0.18); }
.phind-siri-ring, .phind-siri-wave { position: absolute; border-radius: 999px; pointer-events: none; }
.phind-siri-ring { inset: 5px; border: 1px solid rgba(255,255,255,0.45); animation: phindSiriRing 2.6s ease-in-out infinite; }
.phind-siri-ring.ring-b { inset: -2px; opacity: 0.42; animation-delay: 0.6s; }
.phind-siri-wave { inset: 12px; border: 2px solid rgba(34,211,238,0.34); animation: phindSiriWave 2.8s ease-out infinite; }
.phind-siri-wave.wave-b { border-color: rgba(255,79,216,0.3); animation-delay: 1.1s; }
@keyframes phindSiriFloat { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-2px) scale(1.03); } }
@keyframes phindSiriGlow { 0%,100% { opacity: 0.33; transform: scale(0.96); } 50% { opacity: 0.58; transform: scale(1.08); } }
@keyframes phindSiriRing { 0%,100% { transform: rotate(0) scale(0.94); opacity: 0.42; } 50% { transform: rotate(18deg) scale(1.05); opacity: 0.82; } }
@keyframes phindSiriWave { 0% { transform: scale(0.7); opacity: 0.7; } 100% { transform: scale(2.05); opacity: 0; } }

/* header tools */
.phind-header-tools { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 999px; background: rgba(255,255,255,0.045); border: 1px solid rgba(255,255,255,0.09); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.phind-tooltip-wrap { position: relative; display: inline-flex; }
.phind-tool-btn {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.13); background: rgba(255,255,255,0.075); color: rgba(255,255,255,0.92);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .22s ease, border-color .22s ease, background .22s ease, box-shadow .22s ease;
}
.phind-tool-btn:hover, .phind-tool-btn:focus-visible { transform: translateY(-1px); background: rgba(192,132,252,0.16); border-color: rgba(192,132,252,0.45); box-shadow: 0 12px 34px rgba(192,132,252,0.18); }
.phind-tool-btn svg { width: 19px; height: 19px; }
.phind-tooltip {
  position: absolute; top: calc(100% + 14px); right: 0; width: min(320px, 82vw); z-index: 60;
  padding: 14px 16px; border-radius: 18px; color: #fff; font-size: 13px; line-height: 1.5;
  background: rgba(7, 10, 24, 0.88); border: 1px solid rgba(192,132,252,0.28);
  backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
  opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-8px) scale(0.98);
  transition: opacity .22s ease, visibility .22s ease, transform .22s ease;
}
.phind-tooltip.show { opacity: 1; visibility: visible; pointer-events: auto; transform: none; }
.phind-tooltip::before { content: ''; position: absolute; top: -7px; right: 20px; width: 14px; height: 14px; background: rgba(7,10,24,0.88); border-left: 1px solid rgba(192,132,252,0.28); border-top: 1px solid rgba(192,132,252,0.28); transform: rotate(45deg); }
.phind-tooltip-content { display: grid; gap: 7px; }
.phind-tooltip-content p { margin: 0; color: rgba(255,255,255,0.86); font-size: 13px; }
.phind-tooltip-content a { color: var(--phind-primary); font-weight: 700; text-decoration: none; border-bottom: 1px dashed rgba(192,132,252,0.45); }

/* messages */
.phind-messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 26px; display: flex; flex-direction: column; gap: 18px; background: rgba(2, 4, 14, 0.24); scroll-behavior: smooth; }

.phind-messages::-webkit-scrollbar { width: 6px; }
.phind-messages::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--phind-primary), var(--phind-accent)); border-radius: 999px; }
.phind-message { display: flex; gap: 13px; align-items: flex-start; animation: phindMessageIn .28s cubic-bezier(.2,.85,.2,1) both; }
.phind-message.user { flex-direction: row-reverse; }
@keyframes phindMessageIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.phind-message-avatar { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 999px; display: grid; place-items: center; color: rgba(255,255,255,0.84); background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12); }
.phind-message-avatar svg { width: 19px; height: 19px; }
.phind-mini-orb { position: relative; width: 26px; height: 26px; border-radius: 999px; background: conic-gradient(from 160deg, var(--phind-accent), var(--phind-primary), #ff4fd8, var(--phind-secondary), var(--phind-accent)); box-shadow: 0 0 18px rgba(192,132,252,0.38); animation: phindMiniOrb 3.2s ease-in-out infinite; }
.phind-mini-orb i { position: absolute; inset: 7px; border-radius: inherit; background: rgba(255,255,255,0.58); filter: blur(1px); }
@keyframes phindMiniOrb { 0%,100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.08) rotate(18deg); } }
.phind-message-content { max-width: min(78%, 780px); min-width: 0; }
.phind-message.user .phind-message-content { display: flex; flex-direction: column; align-items: flex-end; }
.phind-message-text {
  padding: 15px 18px; border-radius: 20px; font-size: 15px; line-height: 1.65; word-break: break-word; color: var(--phind-text);
  border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.07);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 12px 34px rgba(0,0,0,0.16);
  backdrop-filter: blur(18px) saturate(130%); -webkit-backdrop-filter: blur(18px) saturate(130%);
}
.phind-message.bot .phind-message-text { border-top-left-radius: 8px; background: rgba(255,255,255,0.08); }
.phind-message.user .phind-message-text { border-top-right-radius: 8px; background: linear-gradient(135deg, rgba(192,132,252,0.34), rgba(79,70,229,0.26)); border-color: rgba(192,132,252,0.28); }
.phind-message-text h3, .phind-message-text h4 { color: #fff; margin: 10px 0 6px; font-size: 1.05em; }
.phind-message-text ul { margin: 6px 0 6px 18px; padding: 0; }
.phind-message-text a { color: var(--phind-accent); }
.phind-message-time { margin-top: 7px; padding: 0 4px; color: rgba(226,232,240,0.55); font-size: 11px; font-weight: 600; }
.phind-message-text pre { margin: 12px 0; padding: 15px; border-radius: 14px; background: rgba(2,4,14,0.56); border: 1px solid rgba(255,255,255,0.11); overflow-x: auto; }
.phind-message-text code { font-family: 'JetBrains Mono', monospace; font-size: 13px; border-radius: 6px; padding: 2px 6px; color: #f0d5ff; background: rgba(192,132,252,0.16); }
.phind-message-text pre code { padding: 0; background: transparent; color: #e8f2ff; }
.phind-thinking { display: inline-flex; align-items: center; gap: 12px; font-weight: 650; color: rgba(255,255,255,0.86); }
.phind-thinking-wave { display: inline-flex; align-items: center; gap: 3px; height: 18px; }
.phind-thinking-wave i { width: 4px; height: 8px; border-radius: 999px; background: linear-gradient(180deg, var(--phind-accent), var(--phind-primary)); animation: phindWaveBars .9s ease-in-out infinite; }
.phind-thinking-wave i:nth-child(2) { animation-delay: .1s; }
.phind-thinking-wave i:nth-child(3) { animation-delay: .2s; }
.phind-thinking-wave i:nth-child(4) { animation-delay: .3s; }
@keyframes phindWaveBars { 0%,100% { height: 7px; opacity: .45; } 50% { height: 18px; opacity: 1; } }

/* composer */
.phind-input-dock { flex-shrink: 0; padding: 18px 22px; border-top: 1px solid var(--phind-border); background: rgba(5, 8, 24, 0.7); backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%); z-index: 16; }
.phind-composer {
  display: flex; align-items: flex-end; gap: 12px; padding: 8px 8px 8px 22px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.13); background: rgba(255,255,255,0.075);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 18px 42px rgba(0,0,0,0.18);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.phind-composer:focus-within { border-color: rgba(192,132,252,0.52); background: rgba(255,255,255,0.09); box-shadow: 0 0 0 4px rgba(192,132,252,0.09), 0 18px 42px rgba(0,0,0,0.2); }
.phind-ai-container .phind-input {
  flex: 1 1 auto; width: 100%; min-height: 48px; max-height: 150px; padding: 13px 0; margin: 0;
  border: 0; outline: 0; resize: none; background: transparent; color: var(--phind-text); box-shadow: none;
  font-size: 15px; line-height: 1.45; font-family: inherit;
}
.phind-input::placeholder { color: rgba(226,232,240,0.52); }
.phind-input:disabled { opacity: .72; cursor: wait; }
.phind-composer-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.phind-char-count { color: rgba(226,232,240,0.46); font-size: 11px; font-weight: 700; white-space: nowrap; }
.phind-char-count.is-warning { color: #fb7185; }
.phind-send-btn {
  width: 50px; height: 50px; flex: 0 0 50px; border-radius: 999px; cursor: pointer; color: #fff;
  border: 1px solid rgba(255,255,255,0.18); display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--phind-primary), var(--phind-secondary));
  box-shadow: 0 10px 30px rgba(79,70,229,0.28), 0 0 24px rgba(192,132,252,0.22);
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.phind-send-btn svg { width: 20px; height: 20px; }
.phind-send-btn:hover:not(:disabled) { transform: translateY(-2px) scale(1.03); box-shadow: 0 16px 42px rgba(79,70,229,0.32), 0 0 34px rgba(192,132,252,0.34); }
.phind-send-btn:disabled { opacity: .55; cursor: not-allowed; }

@media (max-width: 640px) {
  .phind-header { padding: 14px 16px; min-height: 76px; }
  .phind-siri-mark { width: 48px; height: 48px; flex-basis: 48px; }
  .phind-logo-text { font-size: 20px; }
  .phind-messages { padding: 18px 14px; }
  .phind-message-content { max-width: 88%; }
  .phind-input-dock { padding: 12px 14px; }
  .phind-composer { padding-left: 16px; }
}
