/* css/inbox.css — AI Inbox page. Layered on shared.css + account.css.
   This page is a triage worklist, not a settings list, so it earns its
   own layout: a sticky filter bar, status-coded cards, and one clear
   primary action (Send) per card. */

/* ── Page intro — one line of orientation under the title ── */
.inbox-intro {
  font-size: var(--text-sm);
  color: var(--text-3);
  margin: 0 0 var(--space-5);
  max-width: 46ch;
}

/* ── Inline notice bar (subscribe prompt) — a strip, not a nested
     card-in-a-card ── */
.inbox-notice {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-5);
  border-radius: var(--radius-md);
  background: var(--accent-subtle);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.inbox-notice i {
  flex-shrink: 0;
  font-size: 1.1rem;
  color: var(--accent);
}
.inbox-notice-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.inbox-notice-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-1);
}
.inbox-notice-desc {
  font-size: var(--text-xs);
  color: var(--text-3);
}

/* ── Filter bar — sticks under the topbar while the list scrolls ── */
.inbox-tabs {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
  padding: var(--space-2) 0 var(--space-4);
  margin-bottom: var(--space-1);
  position: sticky;
  top: 0;
  background: var(--bg-base);
  z-index: 2;
}
.inbox-tabs::-webkit-scrollbar { display: none; }

.inbox-tab {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-2);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease);
}
.inbox-tab:hover { border-color: var(--border-strong); }
.inbox-tab--active {
  background: var(--text-1);
  border-color: var(--text-1);
  color: var(--bg-elevated);
  font-weight: 600;
}

/* ── List ── */
#inboxSkeleton {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

#inboxList {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ── Card ──
   A slim left rail communicates category at a glance so the badge
   doesn't have to carry that job alone; the badge stays for the
   precise label. Unresolved items look "live", resolved ones recede. */
.inbox-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-4) calc(var(--space-4) + 3px);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}
.inbox-card[data-category="lead"]      { border-left-color: var(--success); }
.inbox-card[data-category="complaint"] { border-left-color: var(--danger); }
.inbox-card[data-category="question"]  { border-left-color: var(--accent); }
.inbox-card[data-resolved="true"] {
  border-left-color: var(--border);
  opacity: 0.72;
}

.inbox-card-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-3);
}

.inbox-card-author {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-1);
}

.inbox-card-meta { color: var(--text-3); }

.inbox-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: capitalize;
  line-height: 1.6;
}

.inbox-badge--question   { background: var(--accent-subtle); color: var(--accent); }
.inbox-badge--lead       { background: color-mix(in srgb, var(--success) 16%, var(--bg-elevated)); color: var(--success); }
.inbox-badge--complaint  { background: var(--danger-subtle); color: var(--danger); }
.inbox-badge--spam       { background: var(--bg-subtle); color: var(--text-3); }
.inbox-badge--positive   { background: color-mix(in srgb, var(--success) 16%, var(--bg-elevated)); color: var(--success); }
.inbox-badge--other      { background: var(--bg-subtle); color: var(--text-3); }

.inbox-card-text {
  font-size: var(--text-md, var(--text-base));
  line-height: var(--leading-body);
  color: var(--text-1);
  white-space: pre-wrap;
}

/* ── Reply composer — labeled so it reads as an editable AI draft,
     not an unexplained text box ── */
.inbox-reply {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: var(--space-1);
  border-top: 1px solid var(--border);
}
.inbox-reply-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
}
.inbox-reply-label i { font-size: 0.95em; color: var(--accent); }

.inbox-card-draft {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-1);
  font-family: inherit;
  font-size: var(--text-sm);
  line-height: var(--leading-body);
  resize: vertical;
  transition: border-color var(--duration-fast) var(--ease);
}
.inbox-card-draft:focus {
  outline: none;
  border-color: var(--accent);
}
.inbox-card-draft::placeholder { color: var(--text-4); }

/* ── Actions — one clear primary, ghost secondaries, danger set apart ── */
.inbox-card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.inbox-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  min-height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease);
}
.inbox-btn:hover { background: var(--bg-subtle); color: var(--text-1); }
.inbox-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.inbox-btn--primary {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.inbox-btn--primary:hover { background: var(--accent-hover); color: #fff; }

.inbox-btn--danger { color: var(--danger); margin-left: auto; }
.inbox-btn--danger:hover { background: var(--danger-subtle); color: var(--danger); }

.inbox-btn:disabled,
.inbox-btn.is-loading {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

/* ── States: skeleton, blocked, empty ── */
/* ── Skeleton — mirrors the actual filter bar and card anatomy below,
     rather than standing in generic gray blocks, so nothing shifts
     position once real content arrives. ── */
.inbox-tabs-skeleton {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) 0 var(--space-4);
  margin-bottom: var(--space-1);
}

.sk {
  display: inline-block;
  background:
    linear-gradient(90deg, transparent, color-mix(in srgb, var(--text-1) 6%, transparent), transparent),
    var(--bg-subtle);
  background-size: 200% 100%;
  animation: inbox-shimmer 1.5s ease-in-out infinite;
}
.sk-pill { height: 30px; border-radius: var(--radius-full); }
.sk-text { border-radius: 4px; }
.sk-rect { width: 100%; border-radius: var(--radius-sm); }

@keyframes inbox-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sk { animation: none; }
}

.inbox-card--skeleton .inbox-card-head { align-items: center; }
.inbox-card--skeleton .inbox-reply { border-top: none; padding-top: 0; }

.inbox-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  padding: var(--space-7) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}
.inbox-state i {
  font-size: 1.75rem;
  color: var(--text-4);
  margin-bottom: var(--space-1);
}
.inbox-state-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-1);
}
.inbox-state-desc {
  font-size: var(--text-sm);
  color: var(--text-3);
  max-width: 40ch;
}
.inbox-state .inbox-btn { margin-top: var(--space-2); }

.inbox-empty { padding: var(--space-7) var(--space-4); }

@media (max-width: 480px) {
  .inbox-btn--danger { margin-left: 0; }
  .inbox-card-actions { gap: var(--space-1) var(--space-2); }
}
