/* ── AI Floating Action Button ─────────────────────────── */
.ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 190;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 20px rgba(99, 102, 241, .4);
  transition: transform .2s, box-shadow .2s;
}
.ai-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(99, 102, 241, .55);
}
.ai-fab:active { transform: scale(.95); }
.ai-fab.hidden { display: none; }
.ai-fab svg { width: 24px; height: 24px; }

/* Pulse animation on first appearance */
.ai-fab.pulse {
  animation: aiFabPulse 2s ease-in-out 3;
}
@keyframes aiFabPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(99, 102, 241, .4); }
  50% { box-shadow: 0 4px 30px rgba(99, 102, 241, .7); }
}

/* ── Shared AI Styles ────────────────────────────────── */
.ai-badge-gemini {
  font-size: .65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: #fff;
  letter-spacing: .3px;
}

.ai-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: .82rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-sidebar);
  color: var(--text);
  cursor: pointer;
  transition: all .2s;
}
.ai-action-btn:hover {
  border-color: #6366F1;
  background: rgba(99, 102, 241, .08);
  color: #6366F1;
}
.ai-action-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.ai-action-btn svg { width: 15px; height: 15px; }

.ai-action-primary {
  flex: 1;
  justify-content: center;
  background: linear-gradient(135deg, #6366F1, #8B5CF6) !important;
  color: #fff !important;
  border-color: transparent !important;
  font-weight: 600;
  font-size: .85rem;
  padding: 10px 14px;
  border-radius: 10px;
}
.ai-action-primary:hover {
  background: linear-gradient(135deg, #5558E6, #7C4FE0) !important;
  color: #fff !important;
  border-color: transparent !important;
}
.ai-action-primary:disabled { opacity: .4; }

/* Empty state */
.ai-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text2);
  text-align: center;
  padding: 40px 20px;
}
.ai-empty svg { width: 48px; height: 48px; opacity: .3; }
.ai-empty p { font-size: .88rem; line-height: 1.5; }

/* Loading */
.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 30px 16px;
  color: var(--text2);
}
.ai-loading-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: #8B5CF6;
  border-radius: 50%;
  animation: aiSpin 1s linear infinite;
}
@keyframes aiSpin {
  to { transform: rotate(360deg); }
}
.ai-loading p {
  font-size: .82rem;
}

/* Error state */
.ai-error {
  padding: 14px 16px;
  border-radius: 10px;
  background: #FEF2F2;
  color: #B91C1C;
  font-size: .84rem;
  line-height: 1.4;
  border: 1px solid #FECACA;
}
[data-theme="dark"] .ai-error {
  background: rgba(239, 68, 68, .1);
  border-color: rgba(239, 68, 68, .2);
  color: #FCA5A5;
}

/* Response content (event insights) */
.ai-response {
  font-size: .88rem;
  line-height: 1.75;
  color: var(--text);
}
.ai-response-label {
  font-size: .72rem;
  font-weight: 600;
  color: #8B5CF6;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-response-label svg { width: 14px; height: 14px; }
.ai-response p { margin-bottom: 10px; }
.ai-response strong { font-weight: 600; color: var(--text); }
.ai-response ul, .ai-response ol {
  padding-left: 18px;
  margin-bottom: 10px;
}
.ai-response li {
  margin-bottom: 4px;
  line-height: 1.6;
}

/* Detail panel AI button */
.detail-ai-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  border: 2px solid #8B5CF6;
  color: #8B5CF6;
  background: transparent;
  cursor: pointer;
  transition: all .2s;
}
.detail-ai-btn:hover {
  background: rgba(139, 92, 246, .08);
}
.detail-ai-btn svg { width: 16px; height: 16px; }

/* Shared action buttons (used in cards + suggestions) */
.ai-rec-actions {
  display: flex; gap: 6px;
  margin-top: 8px;
}
.ai-rec-btn {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: .72rem; font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  transition: all .15s;
}
.ai-rec-btn.ai-rec-detail:hover {
  background: rgba(99, 102, 241, .1);
  border-color: #6366F1; color: #6366F1;
}
.ai-rec-btn.ai-rec-fav:hover {
  background: rgba(245, 158, 11, .1);
  border-color: #F59E0B; color: #D97706;
}
.ai-rec-btn.ai-rec-fav.on {
  background: rgba(245, 158, 11, .12);
  border-color: #F59E0B; color: #D97706;
}

/* ── IA Full Page View ──────────────────────────────── */
.ia-wrap {
  flex: 1;
  display: none;
  overflow: hidden;
}
.ia-wrap.active { display: flex; }
.ia-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ia-page-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ia-page-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.ia-page-header h2 svg { color: #8B5CF6; }
.ia-page-content {
  flex: 1;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* ── Global Action (Curate All Days) ─────────────────── */
.kb-global-action {
  padding: 12px 20px 0;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}
.kb-analyze-all-btn {
  max-width: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .88rem;
  padding: 12px 24px;
  gap: 8px;
}
.kb-analyze-all-btn svg { width: 18px; height: 18px; }

/* ── Kanban Board ────────────────────────────────────── */
.kb-board {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  min-height: 0;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.kb-board::-webkit-scrollbar {
  height: 6px;
}
.kb-board::-webkit-scrollbar-track {
  background: transparent;
}
.kb-board::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.kb-board::-webkit-scrollbar-thumb:hover {
  background: #8B5CF6;
}

/* Column */
.kb-column {
  min-width: 280px;
  max-width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-sidebar);
  scroll-snap-align: start;
  overflow: hidden;
}
.kb-column.kb-current {
  border-color: rgba(99, 102, 241, .35);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, .15);
}

/* Column header */
.kb-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.kb-day-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.kb-day-label {
  font-weight: 700;
  font-size: .88rem;
  color: var(--text);
}
.kb-current .kb-day-label {
  color: #6366F1;
}
.kb-day-count {
  font-size: .7rem;
  font-weight: 500;
  color: var(--text2);
  background: var(--border);
  padding: 2px 8px;
  border-radius: 10px;
}
.kb-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  transition: all .15s;
}
.kb-refresh:hover {
  border-color: #6366F1;
  color: #6366F1;
  background: rgba(99, 102, 241, .06);
}

/* Column body — scrollable */
.kb-column-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kb-column-body::-webkit-scrollbar {
  width: 4px;
}
.kb-column-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Column footer (analyze button) */
.kb-column-footer {
  padding: 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.kb-column-footer .ai-action-primary {
  width: 100%;
  font-size: .8rem;
  padding: 9px 12px;
}

/* ── AI Overview (inside column) ─────────────────────── */
.kb-overview {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(139, 92, 246, .06);
  border: 1px solid rgba(139, 92, 246, .15);
  font-size: .78rem;
  line-height: 1.5;
  color: var(--text);
}

.kb-empty-day {
  text-align: center;
  padding: 18px 12px;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.6;
}

/* ── Favorite Event Cards ────────────────────────────── */
.kb-card {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: all .15s;
}
.kb-card:hover {
  border-color: #6366F1;
  box-shadow: 0 2px 8px rgba(99, 102, 241, .1);
}
.kb-card-time {
  font-size: .72rem;
  font-weight: 700;
  color: #8B5CF6;
  margin-bottom: 4px;
  letter-spacing: .3px;
}
.kb-card-name {
  font-weight: 600;
  font-size: .82rem;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
}
.kb-card-venue {
  font-size: .72rem;
  color: var(--text2);
}
.kb-card-theme {
  font-size: .68rem;
  color: #8B5CF6;
  margin-top: 3px;
  font-weight: 500;
}
.kb-card-insight {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  font-size: .75rem;
  color: var(--text2);
  font-style: italic;
  line-height: 1.4;
}

/* ── Plan B/C Alternatives ───────────────────────────── */
.kb-alts {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kb-alt {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(99, 102, 241, .04);
  border: 1px solid rgba(99, 102, 241, .1);
  cursor: pointer;
  transition: background .15s;
}
.kb-alt:hover {
  background: rgba(99, 102, 241, .08);
}
.kb-alt-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.kb-alt-label {
  font-size: .6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: .4px;
  background: rgba(99, 102, 241, .12);
  color: #6366F1;
  flex-shrink: 0;
}
.kb-alt-time {
  font-size: .65rem;
  color: var(--text2);
  flex-shrink: 0;
}
.kb-alt-name {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
}
.kb-alt-venue {
  font-size: .7rem;
  color: var(--text2);
}
.kb-alt-walking {
  font-size: .68rem;
  color: var(--text2);
  opacity: .8;
}
.kb-alt-reason {
  font-size: .72rem;
  color: var(--text2);
  font-style: italic;
  line-height: 1.3;
  margin-bottom: 4px;
}

/* ── Suggestions Divider ─────────────────────────────── */
.kb-suggestions-divider {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
  font-weight: 700;
  color: #8B5CF6;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 8px 4px 4px;
}
.kb-suggestions-divider svg { width: 13px; height: 13px; }

/* ── Suggestion Cards ────────────────────────────────── */
.kb-suggestion {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: all .15s;
}
.kb-suggestion:hover {
  border-color: #6366F1;
  border-style: solid;
  box-shadow: 0 2px 8px rgba(99, 102, 241, .1);
}
.kb-sug-badge {
  display: inline-block;
  font-size: .62rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  margin-bottom: 4px;
}
.kb-sug-badge.ai-rec-match {
  background: rgba(34, 197, 94, .12); color: #16A34A;
}
.kb-sug-badge.ai-rec-complement {
  background: rgba(59, 130, 246, .12); color: #2563EB;
}
.kb-sug-badge.ai-rec-discovery {
  background: rgba(245, 158, 11, .12); color: #D97706;
}
.kb-sug-name {
  font-weight: 600;
  font-size: .8rem;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 3px;
}
.kb-sug-meta {
  display: flex;
  gap: 8px;
  font-size: .7rem;
  color: var(--text2);
  margin-bottom: 4px;
}
.kb-sug-reason {
  font-size: .72rem;
  color: var(--text2);
  font-style: italic;
  line-height: 1.3;
}

/* ── Tips (inside column) ────────────────────────────── */
.kb-tips {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(245, 158, 11, .06);
  border: 1px solid rgba(245, 158, 11, .15);
  font-size: .75rem;
  line-height: 1.4;
  color: var(--text);
}
.kb-tips-title {
  font-weight: 700;
  font-size: .7rem;
  color: #D97706;
  margin-bottom: 4px;
}
.kb-tips ul {
  padding-left: 14px;
  margin: 0;
}
.kb-tips li { margin-bottom: 3px; }

/* ── Walking Tip (between events) ────────────────────── */
.kb-walking-tip {
  font-size: .68rem;
  color: var(--text2);
  padding: 2px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: .7;
}

/* ── SXSW Schedule Link ─────────────────────────────── */
.ai-rec-btn.ai-rec-sxsw {
  text-decoration: none;
  font-size: .68rem;
  color: var(--text2);
}
.ai-rec-btn.ai-rec-sxsw:hover {
  background: rgba(99, 102, 241, .08);
  border-color: #6366F1;
  color: #6366F1;
}

/* ── Anchor Card (confirmed favorite) ────────────────── */
.kb-anchor {
  border-left: 3px solid #EAB308;
}
.kb-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.kb-card-header .kb-card-time {
  margin-bottom: 0;
}
.kb-type-badge {
  font-size: .6rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
}
.kb-type-anchor {
  background: rgba(234, 179, 8, .12);
  color: #D97706;
}

/* ── Suggested Card (AI curated) ─────────────────────── */
.kb-suggested {
  border: 1px dashed var(--border);
  border-left: 3px dashed #8B5CF6;
}
.kb-suggested:hover {
  border-style: solid;
  border-left-style: solid;
}

/* ── Break Card ──────────────────────────────────────── */
.kb-break {
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(245, 158, 11, .05);
  border: 1px solid rgba(245, 158, 11, .12);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.kb-break-time {
  font-size: .7rem;
  font-weight: 700;
  color: #D97706;
}
.kb-break-label {
  font-size: .78rem;
  font-weight: 500;
  color: var(--text);
}
.kb-break-tip {
  width: 100%;
  font-size: .72rem;
  color: var(--text2);
  font-style: italic;
  line-height: 1.3;
}

/* ── Header Actions (Copy + WhatsApp) ────────────────── */
.kb-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.kb-share-copy,
.kb-share-wa {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: all .15s;
}
.kb-share-copy {
  color: var(--text2);
}
.kb-share-copy:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, .08);
  color: var(--accent);
}
.kb-share-wa {
  color: #25D366;
}
.kb-share-wa:hover {
  border-color: #25D366;
  background: rgba(37, 211, 102, .08);
}

/* ── Profile Form (inline onboarding) ────────────────── */
.kb-profile-form {
  max-width: 520px;
  margin: 32px auto;
  padding: 24px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.kb-profile-header {
  text-align: center;
  margin-bottom: 16px;
}
.kb-profile-header svg {
  width: 28px; height: 28px;
  color: #8B5CF6;
  margin-bottom: 8px;
}
.kb-profile-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
}
.kb-profile-header p {
  font-size: .82rem;
  color: var(--text2);
  margin: 0;
}
.kb-profile-textarea {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-sidebar);
  color: var(--text);
  font-size: .85rem;
  line-height: 1.5;
  resize: vertical;
  font-family: inherit;
  transition: border-color .15s;
}
.kb-profile-textarea:focus {
  outline: none;
  border-color: #8B5CF6;
}
.kb-profile-textarea.shake {
  animation: shake .3s ease-in-out;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.kb-profile-charcount {
  text-align: right;
  font-size: .7rem;
  color: var(--text2);
  margin: 4px 0 12px;
}
.kb-profile-speakers {
  margin-bottom: 16px;
}
.kb-profile-speakers label {
  display: block;
  font-weight: 600;
  font-size: .82rem;
  color: var(--text);
  margin-bottom: 6px;
}
.kb-profile-speaker-wrap {
  position: relative;
}
.kb-profile-speaker-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-sidebar);
  color: var(--text);
  font-size: .82rem;
  font-family: inherit;
}
.kb-profile-speaker-input:focus {
  outline: none;
  border-color: #8B5CF6;
}
.kb-profile-speaker-dropdown {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  z-index: 10;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 2px;
  max-height: 150px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.kb-profile-speaker-dropdown.hidden { display: none; }
.kb-profile-speaker-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: .82rem;
  cursor: pointer;
}
.kb-profile-speaker-dropdown button:hover {
  background: rgba(139, 92, 246, .08);
}
.kb-profile-speaker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.kb-profile-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}
.kb-profile-skip {
  font-size: .78rem !important;
  color: var(--text2) !important;
}
.kb-profile-save {
  font-size: .82rem !important;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 600px) {
  .ai-fab { bottom: 16px; right: 16px; width: 46px; height: 46px; }
  .ia-page-content { padding: 0; }
  .ia-page-header { padding: 12px 16px; }
  .kb-board {
    padding: 12px;
    gap: 10px;
  }
  .kb-column {
    min-width: 260px;
    max-width: 290px;
  }
}

/* Hide agenda-only elements when IA view is active */
body.ia-active .sidebar-toggle,
body.ia-active .search-box,
body.ia-active #dayBar,
body.ia-active #conflictBanner {
  display: none !important;
}
