/* Dashboard-specific styles
 * Owns: all /app route UI — nav, stats bar, ref cards, alerts, modal, forms.
 * Does NOT own: landing page, theme variables (those live in theme.css).
 */

/* ── Nav ─────────────────────────────────────────────── */
.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 64px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(12,11,9,0.96);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.nav-brand { display: flex; align-items: center; }

.brand-link {
  display: flex;
  align-items: baseline;
  gap: 12px;
  text-decoration: none;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--fg);
  font-weight: 400;
}

.brand-sub {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Live status indicator */
.nav-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(74,222,128,0.4);
  animation: pulse-ring 2.5s ease-out infinite;
}

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(74,222,128,0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(74,222,128,0); }
  100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}

.status-text {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-actions { display: flex; gap: 12px; }

/* ── Stats bar ───────────────────────────────────────── */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 64px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.stat-item {
  display: flex;
  flex-direction: column;
  padding: 16px 32px 16px 0;
  gap: 2px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 300;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
  margin: 0 32px 0 0;
}

.stats-bar-right {
  margin-left: auto;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn-accent {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 10px 22px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-accent:hover { opacity: 0.85; }
.btn-accent:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  flex-shrink: 0;
}

.ref-card:hover .btn-delete { opacity: 1; }
.btn-delete:hover { color: #f87171; }

.btn-scan {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid rgba(201,169,110,0.35);
  color: var(--accent);
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-scan:hover {
  background: rgba(201,169,110,0.08);
  border-color: var(--accent);
}

.btn-scan:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Main layout ─────────────────────────────────────── */
.app-wrapper { min-height: 100vh; }
.app-main { padding: 48px 64px 120px; max-width: 1280px; }

.section-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 24px;
}

.section-title-sm {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  color: var(--fg);
}

.section-hint {
  font-size: 12px;
  color: var(--muted);
}

/* ── Empty State ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 40px;
  border: 1px dashed var(--border);
  background: linear-gradient(180deg, var(--surface) 0%, transparent 100%);
}

.empty-watch-icon {
  color: var(--fg);
  margin-bottom: 24px;
  display: inline-block;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 300;
  color: var(--fg);
  margin-bottom: 10px;
}

.empty-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 32px;
  line-height: 1.7;
}

/* ── Reference Cards ─────────────────────────────────── */
.refs-section { margin-bottom: 64px; }

.refs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.ref-card {
  background: var(--surface);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, opacity 0.2s;
}

.ref-card:hover { border-color: rgba(201,169,110,0.4); }

.ref-card-inner {
  padding: 24px 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ref-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.ref-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  color: var(--fg);
  line-height: 1.3;
  flex: 1;
}

.ref-notes {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  font-style: italic;
}

.ref-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 4px;
}

.ref-price-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ref-price-label {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.ref-target {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 300;
  color: var(--accent);
  line-height: 1;
}

.ref-tags {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.ref-condition-tag {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 3px 8px;
}

.ref-date-tag {
  font-size: 11px;
  color: var(--muted);
}

/* Animated monitoring bar at card bottom */
.ref-monitoring-bar {
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(201,169,110,0.5) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: monitor-sweep 3s linear infinite;
}

@keyframes monitor-sweep {
  0%   { background-position: -100% 0; }
  100% { background-position: 200% 0; }
}

/* ── Alerts ──────────────────────────────────────────── */
.alerts-section { margin-top: 48px; }

.alerts-list { display: flex; flex-direction: column; gap: 2px; }

.alert-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  transition: border-color 0.2s;
}

.alert-row:last-child { border-bottom: 1px solid var(--border); }
.alert-row:hover { border-color: rgba(201,169,110,0.25); }

.alert-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.alert-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.7;
}

.alert-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 400;
  color: var(--fg);
  margin-bottom: 4px;
}

.alert-detail {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.alert-sep { opacity: 0.4; }

.alert-right { flex-shrink: 0; }

.savings-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.savings-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.savings-amount {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 300;
  color: var(--accent);
  line-height: 1;
}

/* ── Modal ───────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8,7,5,0.85);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  background: var(--surface);
  border: 1px solid rgba(201,169,110,0.2);
  padding: 40px;
  width: 520px;
  max-width: calc(100vw - 48px);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  color: var(--fg);
  margin-bottom: 4px;
}

.modal-sub {
  font-size: 13px;
  color: var(--muted);
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  margin-top: 2px;
  transition: color 0.2s;
}

.modal-close:hover { color: var(--fg); }

/* ── Form ────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 300;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: rgba(201,169,110,0.6);
}

.form-hint {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}

.optional {
  font-size: 10px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* Spin animation for scan button */
.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-nav { padding: 16px 24px; }
  .stats-bar { padding: 0 24px; gap: 0; overflow-x: auto; }
  .stat-item { padding: 12px 20px 12px 0; }
  .stat-divider { margin: 0 20px 0 0; }
  .app-main { padding: 24px 24px 80px; }
  .refs-grid { grid-template-columns: 1fr; }
  .ref-card-inner { padding: 20px; }
  .form-row { grid-template-columns: 1fr; }
  .nav-status { display: none; }
}
