/* ================================================================
   AI Career Agent – Widget Styles
   Compatible with Superio theme (no !important abuse needed)
   ================================================================ */

:root {
  --aca-primary:       #1a56db;
  --aca-primary-dark:  #1044b0;
  --aca-bg:            #ffffff;
  --aca-bg-bot:        #f1f5f9;
  --aca-bg-user:       var(--aca-primary);
  --aca-text:          #1e293b;
  --aca-text-muted:    #64748b;
  --aca-border:        #e2e8f0;
  --aca-shadow:        0 20px 60px rgba(0,0,0,.18);
  --aca-radius:        18px;
  --aca-font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --aca-z:             99999;
  --aca-w:             380px;
  --aca-h:             580px;
}

/* ── Launcher ─────────────────────────────────────────────────── */
.aca-widget {
  position: fixed;
  z-index: var(--aca-z);
  font-family: var(--aca-font);
}
.aca-widget.aca-bottom-right { right: 24px; bottom: 24px; }
.aca-widget.aca-bottom-left  { left:  24px; bottom: 24px; }

.aca-launcher {
  width:  60px;
  height: 60px;
  border-radius: 50%;
  background: var(--aca-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 6px 24px rgba(26,86,219,.45);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), background .2s;
  position: relative;
  z-index: 1;
}
.aca-launcher:hover  { background: var(--aca-primary-dark); transform: scale(1.1); }
.aca-launcher:active { transform: scale(.95); }

.aca-launcher-icon { display: flex; line-height:0; }

.aca-badge-dot {
  position: absolute;
  top:    0;
  right:  0;
  width:  20px;
  height: 20px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  z-index: 2;
}

/* ── Panel ────────────────────────────────────────────────────── */
.aca-panel {
  position: absolute;
  bottom: 76px;
  width:  var(--aca-w);
  max-height: var(--aca-h);
  background: var(--aca-bg);
  border-radius: var(--aca-radius);
  box-shadow: var(--aca-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  transition: opacity .25s, transform .25s cubic-bezier(.34,1.56,.64,1);
  border: 1px solid var(--aca-border);
}
.aca-widget.aca-bottom-right .aca-panel { right: 0; }
.aca-widget.aca-bottom-left  .aca-panel { left:  0; }

.aca-panel.aca-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ── Header ───────────────────────────────────────────────────── */
.aca-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--aca-primary);
  color: #fff;
  flex-shrink: 0;
}
.aca-header-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.aca-header-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.aca-header-info strong { font-size: 15px; font-weight: 600; }
.aca-status {
  font-size: 12px;
  opacity: .85;
  display: flex;
  align-items: center;
  gap: 4px;
}
.aca-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}
.aca-header-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.8);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: background .15s, color .15s;
}
.aca-header-close:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ── Quick chips ──────────────────────────────────────────────── */
.aca-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 14px 8px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--aca-border);
}
.aca-chip {
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 20px;
  border: 1.5px solid var(--aca-border);
  background: #fff;
  color: var(--aca-text);
  cursor: pointer;
  font-family: var(--aca-font);
  transition: all .15s;
  white-space: nowrap;
}
.aca-chip:hover {
  border-color: var(--aca-primary);
  color: var(--aca-primary);
  background: #eff6ff;
}
.aca-chip-highlight {
  border-color: var(--aca-primary);
  background: #eff6ff;
  color: var(--aca-primary);
  font-weight: 600;
}

/* ── Messages ─────────────────────────────────────────────────── */
.aca-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.aca-messages::-webkit-scrollbar { width: 4px; }
.aca-messages::-webkit-scrollbar-track { background: transparent; }
.aca-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.aca-message {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.aca-message-user {
  flex-direction: row-reverse;
}

.aca-message-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--aca-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: .5px;
}
.aca-message-user .aca-message-avatar {
  background: #e2e8f0;
  color: var(--aca-text-muted);
}

.aca-message-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--aca-text);
  background: var(--aca-bg-bot);
  border-bottom-left-radius: 4px;
  word-break: break-word;
}
.aca-message-user .aca-message-bubble {
  background: var(--aca-bg-user);
  color: #fff;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 4px;
}

/* Markdown-like rendering inside bot bubbles */
.aca-message-bubble p  { margin: 0 0 8px; }
.aca-message-bubble p:last-child { margin-bottom: 0; }
.aca-message-bubble strong { font-weight: 600; }
.aca-message-bubble ul, .aca-message-bubble ol { margin: 6px 0; padding-left: 18px; }
.aca-message-bubble li { margin-bottom: 3px; }
.aca-message-bubble h1,.aca-message-bubble h2,.aca-message-bubble h3 {
  font-size: 14px; font-weight: 700; margin: 10px 0 4px;
}
.aca-message-bubble code {
  background: rgba(0,0,0,.06); border-radius: 4px;
  padding: 1px 5px; font-size: 12px;
}
.aca-message-bubble pre {
  background: #1e293b; color: #e2e8f0;
  border-radius: 8px; padding: 12px;
  overflow-x: auto; font-size: 12px; margin: 8px 0;
}

/* Copy-CV button */
.aca-copy-btn {
  margin-top: 8px;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,.4);
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-family: var(--aca-font);
  transition: background .15s;
}
.aca-copy-btn:hover { background: rgba(255,255,255,.15); }
.aca-message-bot .aca-copy-btn {
  border-color: var(--aca-primary);
  color: var(--aca-primary);
}
.aca-message-bot .aca-copy-btn:hover { background: #eff6ff; }

/* ── Typing indicator ─────────────────────────────────────────── */
.aca-typing {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 14px 8px;
  flex-shrink: 0;
}
.aca-typing-bubbles {
  display: flex; gap: 4px; align-items: center;
  background: var(--aca-bg-bot);
  padding: 10px 14px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}
.aca-typing-bubbles span {
  width: 7px; height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  animation: aca-bounce 1.3s infinite;
}
.aca-typing-bubbles span:nth-child(2) { animation-delay: .18s; }
.aca-typing-bubbles span:nth-child(3) { animation-delay: .36s; }
@keyframes aca-bounce {
  0%,60%,100% { transform: translateY(0); }
  30%         { transform: translateY(-6px); }
}

/* ── Job Results Panel ────────────────────────────────────────── */
.aca-job-results {
  border-top: 1px solid var(--aca-border);
  background: #f8fafc;
  max-height: 220px;
  overflow-y: auto;
  flex-shrink: 0;
}
.aca-job-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--aca-text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--aca-border);
}
.aca-job-results-header button {
  background: none; border: none; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--aca-text-muted);
}
.aca-job-card {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--aca-border);
  transition: background .15s;
}
.aca-job-card:hover { background: #eff6ff; }
.aca-job-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--aca-primary);
  display: block;
  margin-bottom: 2px;
}
.aca-job-card-meta {
  font-size: 11px;
  color: var(--aca-text-muted);
}

/* ── Input area ───────────────────────────────────────────────── */
.aca-input-area {
  border-top: 1px solid var(--aca-border);
  padding: 10px 12px 8px;
  flex-shrink: 0;
  background: #fff;
}
.aca-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.aca-input {
  flex: 1;
  border: 1.5px solid var(--aca-border);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: var(--aca-font);
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 100px;
  overflow-y: auto;
  transition: border-color .15s;
  color: var(--aca-text);
  background: #f8fafc;
}
.aca-input:focus { border-color: var(--aca-primary); background: #fff; }
.aca-input::placeholder { color: #94a3b8; }

.aca-send-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--aca-primary);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
}
.aca-send-btn:hover  { background: var(--aca-primary-dark); }
.aca-send-btn:active { transform: scale(.93); }
.aca-send-btn:disabled { opacity: .4; cursor: not-allowed; }

.aca-footer-note {
  font-size: 10px;
  color: #94a3b8;
  text-align: center;
  margin: 6px 0 0;
}
.aca-footer-note a { color: #94a3b8; }

/* ── Superio theme compatibility ─────────────────────────────── */
/* Ensure widget sits above Superio's sticky header (z-index 1000) */
#aca-widget { z-index: 99999; }

/* Avoid Superio's global box-sizing override affecting widget */
.aca-widget *,
.aca-widget *::before,
.aca-widget *::after { box-sizing: border-box; }

/* Superio uses .job-listing, .job-box — keep widget isolated */
.aca-widget .job-listing,
.aca-widget .job-box { all: unset; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  :root {
    --aca-w: calc(100vw - 24px);
    --aca-h: 500px;
  }
  .aca-widget.aca-bottom-right,
  .aca-widget.aca-bottom-left {
    right: 12px; left: 12px; bottom: 12px;
  }
  .aca-panel { right: 0; left: 0; bottom: 72px; width: 100%; }
}

/* ── Animations ───────────────────────────────────────────────── */
@keyframes aca-slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}
.aca-message { animation: aca-slide-in .22s ease-out; }
