/* SmartPin Stagger: component styles layered on top of Tailwind utilities. */

[hidden] { display: none !important; }

:root {
  --accent: #e11d48;
  --accent-hover: #be123c;
  --accent-soft: #fff1f2;
  --line: #e2e8f0;
  --muted: #64748b;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.card-title {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .75rem;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid transparent; border-radius: 9px;
  padding: .5rem .85rem;
  font-size: .875rem; font-weight: 500; line-height: 1.2;
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid #fda4af; outline-offset: 2px; }
.btn-sm { padding: .32rem .65rem; font-size: .8rem; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: #fff; border-color: #cbd5e1; color: #334155; }
.btn-secondary:hover:not(:disabled) { background: #f8fafc; border-color: #94a3b8; }
.btn-ghost { background: transparent; color: #475569; }
.btn-ghost:hover:not(:disabled) { background: #f1f5f9; }
.btn-danger { background: #fff; border-color: #fecdd3; color: #be123c; }
.btn-danger:hover:not(:disabled) { background: var(--accent-soft); }

/* Form controls */
.input {
  width: 100%;
  border: 1px solid #cbd5e1; border-radius: 8px;
  padding: .45rem .6rem;
  font-size: .875rem; color: #0f172a; background: #fff;
}
.input:focus { outline: 2px solid #fecdd3; outline-offset: 0; border-color: var(--accent); }
.input:disabled { background: #f8fafc; color: #64748b; }
.input-sm { padding: .3rem .5rem; font-size: .8rem; }
.checkbox { accent-color: var(--accent); width: 1rem; height: 1rem; }
.label { display: block; font-size: .78rem; font-weight: 500; color: #475569; margin-bottom: .25rem; }
.hint { font-size: .75rem; color: var(--muted); margin-top: .3rem; }
.hint code, .conn-box code { background: #f1f5f9; padding: 0 .25rem; border-radius: 4px; }
.counter { float: right; font-weight: 400; color: #94a3b8; }
.counter.is-over { color: #be123c; font-weight: 600; }

/* Today card */
.progress { height: 8px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }
.stat { background: #f8fafc; border-radius: 10px; padding: .5rem .65rem; }
.stat dt { font-size: .72rem; color: var(--muted); }
.stat dd { font-size: 1.15rem; font-weight: 600; color: #0f172a; font-variant-numeric: tabular-nums; }
.pulse-dot { width: .55rem; height: .55rem; border-radius: 999px; background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.75); } }

/* Connection pill */
.conn-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  border-radius: 999px; padding: .28rem .7rem;
  font-size: .78rem; font-weight: 500; border: 1px solid var(--line);
  background: #f8fafc; color: #475569; cursor: pointer; max-width: 55vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conn-pill::before { content: ""; width: .5rem; height: .5rem; border-radius: 999px; background: #94a3b8; flex-shrink: 0; }
.conn-pill[data-state="ok"] { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.conn-pill[data-state="ok"]::before { background: #22c55e; }
.conn-pill[data-state="disconnected"], .conn-pill[data-state="nokey"] { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.conn-pill[data-state="disconnected"]::before, .conn-pill[data-state="nokey"]::before { background: #f59e0b; }
.conn-pill[data-state="error"] { background: var(--accent-soft); border-color: #fecdd3; color: #9f1239; }
.conn-pill[data-state="error"]::before { background: var(--accent); }
.conn-box { font-size: .8rem; border-radius: 10px; background: #f8fafc; border: 1px solid var(--line); padding: .6rem .75rem; color: #334155; }

/* Dropzone */
.dropzone {
  display: block; text-align: center; cursor: pointer;
  border: 2px dashed #cbd5e1; border-radius: 12px; background: #f8fafc;
  padding: 1.4rem 1rem; transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }

/* Tabs */
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; }
.tab { padding: .35rem .7rem; border-radius: 8px; font-size: .85rem; font-weight: 500; color: #475569; }
.tab:hover { background: #f1f5f9; }
.tab.is-active { background: #0f172a; color: #fff; }
.tab-count { font-size: .72rem; opacity: .7; margin-left: .15rem; font-variant-numeric: tabular-nums; }

/* Pin list */
.pin-list { margin-top: .25rem; }
.pin-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .55rem .5rem; border-radius: 10px; border-bottom: 1px solid #f1f5f9;
}
.pin-row:hover { background: #f8fafc; }
.pin-row.is-conflict { background: #fffbeb; }
.pin-row.is-selected { background: var(--accent-soft); }
.pin-pos { width: 2.6rem; text-align: right; font-size: .75rem; color: #94a3b8; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; background: #e2e8f0; flex-shrink: 0; }
.pin-main { min-width: 0; flex: 1; }
.pin-title { font-size: .875rem; font-weight: 500; color: #0f172a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-sub { font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-badges { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .2rem; }
.pin-eta { font-size: .75rem; color: #475569; text-align: right; width: 5.5rem; flex-shrink: 0; }
.pin-actions { display: flex; gap: .1rem; flex-shrink: 0; }
@media (max-width: 640px) {
  .pin-eta, .pin-pos { display: none; }
  .pin-row { gap: .5rem; }
}

.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: .02rem .45rem; font-size: .68rem; font-weight: 500; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-err { background: #ffe4e6; color: #9f1239; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-muted { background: #f1f5f9; color: #475569; }

.bulk-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  margin-top: .75rem; padding: .5rem .65rem;
  border: 1px solid #fecdd3; border-radius: 10px; background: var(--accent-soft);
}

/* Activity log */
.log-list { max-height: 260px; overflow-y: auto; font-size: .78rem; }
.log-list li { display: flex; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid #f1f5f9; }
.log-list time { color: #94a3b8; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.log-list .log-ok { color: #166534; }
.log-list .log-warn { color: #92400e; }
.log-list .log-error { color: #9f1239; }
.log-list .log-empty { color: #94a3b8; border: 0; }

/* Dialogs */
dialog {
  border: 0; border-radius: 16px; padding: 0;
  width: min(580px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem);
  box-shadow: 0 24px 60px rgba(15, 23, 42, .25);
}
dialog::backdrop { background: rgba(15, 23, 42, .45); }
.dialog-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; }
.dialog-foot { display: flex; justify-content: flex-end; gap: .5rem; padding-top: .5rem; border-top: 1px solid #f1f5f9; }
.section-label { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; }
.edit-preview { width: 120px; height: 160px; object-fit: cover; border-radius: 10px; background: #e2e8f0; flex-shrink: 0; }

/* Toasts */
#toasts {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
  display: flex; flex-direction: column; gap: .5rem;
  width: min(400px, calc(100vw - 2rem));
}
.toast {
  display: flex; align-items: flex-start; gap: .75rem;
  background: #0f172a; color: #fff; border-radius: 10px;
  padding: .7rem .9rem; font-size: .85rem; line-height: 1.4;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .3);
  animation: toast-in .2s ease-out;
}
.toast.is-error { background: #881337; }
.toast span { flex: 1; }
.toast button { color: #fda4af; font-weight: 600; flex-shrink: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
