/* Scout CSS — shares most patterns with ranger.css */

/* ── Base ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 19.5px; scroll-padding-top: 4rem; }
body {
  font-family: 'Figtree', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

#app { display: none; }
#app.ready { display: block; }

.app-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; height: 3.7rem; padding: 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.header-brand {
  font-size: 1.35rem; font-weight: 700; color: var(--accent); letter-spacing: -0.5px;
  width: 10rem; flex-shrink: 0; white-space: nowrap;
  display: flex; align-items: center; align-self: stretch;
  border-bottom: 2px solid transparent; transition: border-color 0.2s;
}
.header-brand.welcome-active { border-color: var(--accent); }
.header-tabs {
  flex: 1; display: flex; justify-content: center;
  overflow-x: auto; overflow-y: hidden; align-self: stretch; scrollbar-width: none;
}
.header-tabs::-webkit-scrollbar { display: none; }
.header-tabs .tb-bar { height: 100%; }
.header-actions {
  display: flex; gap: 6px; align-items: center; flex-shrink: 0; width: 9rem; justify-content: flex-end;
}
.header-actions button {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  padding: 4px; display: flex; align-items: center; justify-content: center; transition: color 0.2s;
}
.header-actions button:hover { color: var(--accent); }

.app-main {
  padding: 12px 20px 20px;
  padding-top: calc(3.7rem + 12px);
}

/* ── Stream Sections ── */
.stream-section { max-width: 42rem; margin: 0 auto; padding-bottom: 3rem; }

/* ── Section Dividers ── */
.section-divider {
  display: flex; align-items: center; justify-content: center;
  height: 6rem; opacity: 0.1;
}
.section-divider img { width: 64px; height: 64px; filter: grayscale(1); }
.stream-section:has(+ .section-divider) { padding-bottom: 0; }

/* ── Cards ── */
.g-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 24px; margin-bottom: 16px; position: relative;
}
.g-card.accent-card { border-left: 3px solid var(--accent); }
.g-card h2 {
  font-size: 1.15rem; font-weight: 600; margin-bottom: 4px; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.g-card h2::before {
  content: ''; width: 10px; height: 10px; background: var(--accent); flex-shrink: 0;
}
.g-card .card-desc { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 18px; line-height: 1.5; }
.g-card .card-desc:last-child { margin-bottom: 0; }

/* ── Section header cards ── */
.section-card h2 { font-size: 2.25rem; gap: 14px; }
.section-card h2::before { display: none; }
.section-card .card-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; background: var(--accent); border-radius: 6px; flex-shrink: 0;
}
.section-card .card-icon img { width: 30px; height: 30px; filter: brightness(0) invert(1); }
.section-card .card-desc { margin-top: 4px; margin-bottom: 0; }

/* ── Card Chat ── */
.card-actions {
  position: absolute; top: -10px; right: 8px;
  display: flex; gap: 4px; z-index: 5; opacity: 0; transition: opacity 0.2s;
}
.g-card:hover .card-actions { opacity: 1; }
.card-action-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--panel); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background 0.2s;
}
.card-action-btn:hover { background: var(--accent); }
.card-action-btn .ca-icon {
  width: 15px; height: 15px; background: var(--text-dim);
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.card-action-btn:hover .ca-icon { background: #fff; }

/* ── AI Cards ── */
.ai-card {
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 16px 20px; margin-bottom: 16px;
  font-size: 0.88rem; line-height: 1.6; position: relative;
}
.ai-card-dismiss {
  position: absolute; top: 8px; right: 10px; background: none; border: none;
  color: var(--text-dim); cursor: pointer; font-size: 1rem; line-height: 1; padding: 2px 4px;
}
.ai-card-dismiss:hover { color: var(--text); }
.ai-card-question {
  display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border); font-size: 0.85rem; color: var(--text);
}
.ai-card-user-icon {
  width: 18px; height: 18px; flex-shrink: 0; background: var(--text-dim);
  -webkit-mask-image: url(/assets/profile.svg); mask-image: url(/assets/profile.svg);
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; margin-top: 1px;
}
.ai-card-body p { margin: 0 0 8px; }
.ai-card-body p:last-child { margin-bottom: 0; }
.ai-card-body ul, .ai-card-body ol { margin: 0 0 8px; padding-left: 1.5em; }
.ai-card-body li { margin-bottom: 4px; }
.ai-card-body code { background: rgba(128,128,128,0.15); padding: 1px 5px; border-radius: 3px; font-size: 0.85em; }
.ai-card-body pre { background: var(--bg); padding: 10px 12px; border-radius: 6px; overflow-x: auto; margin: 8px 0; }
.ai-card-body pre code { background: none; padding: 0; }
.collapsed-chats { position: absolute; bottom: -14px; right: 12px; display: flex; gap: 6px; z-index: 3; }
.collapsed-chat-btn {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--accent);
  background: var(--panel); cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.collapsed-chat-btn:hover { background: var(--accent); }
.collapsed-chat-btn .ca-icon { width: 14px; height: 14px; background: var(--accent); }
.collapsed-chat-btn:hover .ca-icon { background: #fff; }
.ai-thinking { color: var(--text-dim); font-size: 0.85rem; animation: aiPulse 1.5s ease-in-out infinite; }

/* ── Card input bar ── */
#card-input-bar {
  display: flex; gap: 8px; align-items: center; padding: 10px 16px;
  margin-bottom: 16px; background: var(--accent); border: none; border-radius: 10px;
}
#card-input-bar textarea {
  flex: 1; padding: 8px 12px; border: none; border-radius: 8px;
  background: var(--panel); color: var(--text); font-family: inherit; font-size: 0.9rem;
  resize: none; outline: none; max-height: 80px;
}
#card-input-bar textarea::placeholder { color: var(--text-dim); }
#card-input-bar textarea:focus { background: var(--panel); }
#card-input-bar button {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: #fff; color: var(--accent); font-size: 1.1rem; font-weight: 700;
  cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
#card-input-bar button:hover { opacity: 0.85; }
.g-card.card-focused {
  box-shadow: 0 0 0 2px var(--accent), 0 0 16px rgba(var(--accent-rgb, 232,145,58), 0.2);
  transition: box-shadow 0.25s;
}

/* ── Buttons ── */
.g-btn {
  padding: 7px 16px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-family: inherit; font-size: 0.85rem;
  font-weight: 500; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px;
}
.g-btn:hover { border-color: var(--accent); color: var(--accent); }
.g-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.g-btn.primary:hover { opacity: 0.85; }
.g-btn.small { padding: 5px 12px; font-size: 0.8rem; }
.g-btn.danger { color: var(--red, #e55); border-color: var(--red, #e55); }
.g-btn.danger:hover { background: var(--red, #e55); color: #fff; }

/* ── Forms ── */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.field-row:last-child { margin-bottom: 0; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label { font-size: 0.8rem; font-weight: 500; color: var(--text-dim); letter-spacing: 0.02em; }
.field input, .field textarea, .field select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--bg); color: var(--text); font-family: inherit; font-size: 0.9rem;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(80, 200, 120, 0.12);
}
.field textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.required { color: var(--red, #e55); font-weight: 400; margin-right: auto; }

/* ── Scout entity cards ── */
.scout-entity-card {
  background: var(--panel); border: 1px solid var(--border); border-left: 6px solid var(--accent);
  border-radius: 10px; padding: 16px 20px; margin-bottom: 10px; cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.15s;
}
.scout-entity-card:hover { border-color: var(--accent); box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.scout-entity-card.expanded { border-color: var(--accent); }
.scout-entity-header { display: flex; align-items: center; gap: 12px; }
.scout-entity-name { font-size: 0.9rem; font-weight: 600; color: var(--text); flex: 1; }
.scout-entity-meta { font-size: 0.8rem; color: var(--text-dim); margin-top: 2px; }
.scout-entity-detail {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(128,128,128,0.1);
  animation: panelIn 0.2s ease both;
}
.scout-entity-card .g-btn { padding: 6px 12px; font-size: 0.8rem; }

/* ── Pipeline cards ── */
.pipeline-card {
  background: var(--panel); border: 1px solid var(--border); border-left: 6px solid var(--accent);
  border-radius: 10px; padding: 16px 20px; margin-bottom: 10px;
}
.pipeline-header { display: flex; align-items: center; gap: 12px; }
.pipeline-info { flex: 1; min-width: 0; }
.pipeline-name { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.pipeline-opening { font-size: 0.8rem; color: var(--text-dim); margin-top: 2px; }
.pipeline-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }

/* ── Stage badges ── */
.stage-badge {
  padding: 4px 12px; border-radius: 12px; font-size: 0.75rem; font-weight: 600;
  text-transform: capitalize; flex-shrink: 0; white-space: nowrap;
}
.stage-badge.matched     { background: rgba(128,128,128,0.15); color: var(--text-dim); }
.stage-badge.contacted   { background: rgba(59,130,246,0.15); color: #3b82f6; }
.stage-badge.interviewing { background: rgba(202,138,4,0.15); color: var(--yellow, #ca8a04); }
.stage-badge.offered     { background: rgba(80,200,120,0.15); color: var(--accent); }
.stage-badge.hired       { background: rgba(22,163,74,0.15); color: var(--green, #16a34a); }
.stage-badge.rejected    { background: rgba(238,85,85,0.15); color: var(--red, #e55); }

/* ── Animations ── */
@keyframes aiPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes advPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes flashIn { 0% { opacity: 0; } 15% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }

/* ── Save flash ── */
.save-flash {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 0.7rem; color: var(--green, #16a34a); opacity: 0; animation: flashIn 1.5s ease; pointer-events: none;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 3000;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 1.2rem 1.5rem; min-width: 340px; max-width: 480px; width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5); color: var(--text); font-size: 0.85rem; line-height: 1.5;
}
.modal-box p { margin: 0 0 1rem; }
.modal-box input[type="text"] {
  width: 100%; box-sizing: border-box; padding: 6px 8px; margin-bottom: 1rem;
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 4px; font-size: 0.85rem;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-actions button {
  padding: 6px 16px; border-radius: 4px; font-size: 0.8rem; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
}
.modal-actions button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.modal-actions button:hover { filter: brightness(1.15); }

/* ── Theme overrides ── */
[data-theme="artistry"] .g-card, [data-theme="industry"] .g-card { border-radius: 0; }
[data-theme="artistry"] .field input, [data-theme="artistry"] .field textarea, [data-theme="artistry"] .field select,
[data-theme="industry"] .field input, [data-theme="industry"] .field textarea, [data-theme="industry"] .field select { border-radius: 0; }
[data-theme="artistry"] .g-btn, [data-theme="industry"] .g-btn { border-radius: 0; }
[data-theme="artistry"] .scout-entity-card, [data-theme="industry"] .scout-entity-card { border-radius: 0; }
[data-theme="artistry"] .pipeline-card, [data-theme="industry"] .pipeline-card { border-radius: 0; }
[data-theme="artistry"] .stage-badge, [data-theme="industry"] .stage-badge { border-radius: 0; }

/* ── Account dropdown ── */
.account-menu-wrap { position: relative; }
.account-menu {
  display: none; position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.45); min-width: 200px; z-index: 2500; padding: 6px 0; font-size: 0.8rem;
}
.account-menu.open { display: block; }
.account-menu-info { padding: 8px 14px; color: var(--text-dim); font-size: 0.75rem; border-bottom: 1px solid var(--border); }
.account-menu-info div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-item {
  display: block; width: 100%; box-sizing: border-box; padding: 8px 14px;
  background: none; border: none; color: var(--text); font-size: 0.8rem; text-align: left; cursor: pointer;
}
.account-menu-item:hover { background: var(--accent); color: #fff; }
.account-menu-item.danger { color: var(--red); }
.account-menu-item.danger:hover { background: var(--red); color: #fff; }

/* ── Responsive ── */
@media (max-width: 600px) {
  html, body { font-size: 16px; overflow-x: hidden; overscroll-behavior-x: none; width: 100%; }
  #app { overflow-x: hidden; width: 100%; }
  .app-topbar { flex-wrap: wrap; height: auto; padding: 4px 8px 0; width: 100%; box-sizing: border-box; }
  .header-brand { font-size: 1rem; width: auto; flex: 1; min-width: 0; }
  .header-actions { width: auto; flex-shrink: 1; gap: 4px; }
  .header-tabs { order: 3; flex: 0 0 100%; overflow-x: auto; }
  .tb-btn { padding: 8px 10px 10px !important; font-size: 0 !important; }
  .tb-btn .tb-icon { width: 1.3rem; height: 1.3rem; }
  .field-row { grid-template-columns: 1fr; }
  .app-main { padding: 0; }
  .g-card { padding: 12px; border-radius: 0; margin-bottom: 6px; }
  .stream-section { padding: 4px 0; }
  .modal-box { min-width: auto; max-width: 95vw; }
}
