/* TK Estate — Shared components.
   Cards, badges, buttons, forms, modals, toasts, dropdowns.
   Depends on: tokens.css, base.css */

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px;
}
.card h2 {
  font-size: 14px;
  font-weight: 500;
  color: var(--gold);
  margin-bottom: 16px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ── Status rows (label + value layout inside a card) ── */
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.status-row:last-child { border-bottom: none; }
.status-row .label { color: var(--text-dim); }
.status-row .value { font-weight: 500; text-align: right; }

/* ── Badges / pills ── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green { background: rgba(76,175,80,0.15); color: var(--green); }
.badge-red { background: rgba(224,80,80,0.15); color: var(--red); }
.badge-orange { background: rgba(212,168,67,0.15); color: var(--orange); }
.badge-blue { background: rgba(80,144,192,0.15); color: var(--blue); }
.badge-gold { background: rgba(201,168,76,0.15); color: var(--gold); }

/* ── Stat numbers ── */
.stat-number { font-size: 28px; font-weight: 600; color: var(--gold); }
.stat-label { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.mini-stat { padding: 12px 0; }
.mini-stat .number { font-size: 24px; font-weight: 600; }
.mini-stat.hot .number { color: var(--red); }
.mini-stat.warm .number { color: var(--orange); }
.mini-stat.cold .number { color: var(--blue); }
.mini-stat.total .number { color: var(--gold); }

.loading { text-align: center; color: var(--text-dim); padding: 40px; }
.refresh-info {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 16px;
}

/* ── Buttons ── */
.btn {
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  transition: opacity 0.2s;
  font-family: inherit;
}
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-gold { background: var(--gold); color: #000; font-weight: 600; }
.btn-dim { background: var(--surface2); color: var(--text-dim); border: 1px solid var(--border); }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-danger { background: rgba(224,80,80,0.15); color: var(--red); border: 1px solid rgba(224,80,80,0.3); }
.btn-add {
  padding: 6px 14px;
  background: rgba(201,168,76,0.08);
  border: 1px dashed var(--gold-dim);
  color: var(--gold-dim);
  font-size: 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-add:hover { background: rgba(201,168,76,0.14); color: var(--gold); border-color: var(--gold); }
.btn-save { padding: 12px 48px; font-size: 15px; border-radius: var(--radius-lg); }
.btn-action {
  padding: 6px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-action:hover { border-color: var(--gold-dim); color: var(--text); }
.btn-action.paused { border-color: var(--orange); color: var(--orange); }

.save-row { text-align: center; padding: 24px 0 8px; }

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--gold-dim); }
.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237a7060' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.form-group textarea { min-height: 80px; font-family: var(--font-mono); resize: vertical; }

.char-count { font-size: 11px; color: var(--text-dim); text-align: right; margin-top: 4px; }

.warning-banner {
  background: rgba(212,168,67,0.1);
  border: 1px solid var(--orange);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--orange);
  margin-bottom: 12px;
}

/* ── Collapsible section card ── */
.config-section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  margin-bottom: 16px;
  overflow: hidden;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.section-header:hover { background: var(--surface2); }
.section-header h3 {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--gold);
  letter-spacing: 0.5px;
  font-weight: 500;
}
.section-toggle { color: var(--text-dim); font-size: 12px; transition: transform 0.2s; }
.section-toggle.collapsed { transform: rotate(-90deg); }
.section-body { padding: 20px; }
.section-body.collapsed { display: none; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: 24px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal h3 { color: var(--gold); margin-bottom: 16px; font-size: 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--green);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  z-index: 1001;
  animation: toastFadeInOut 3s forwards;
}
.toast.error { background: var(--red); }
@keyframes toastFadeInOut {
  0%   { opacity: 0; transform: translateY(8px); }
  10%  { opacity: 1; transform: translateY(0); }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Dropdown menu ── */
.dropdown-wrap { position: relative; }
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-width: 260px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  overflow: hidden;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--surface2); color: var(--text); }
.dropdown-empty { padding: 12px 16px; font-size: 12px; color: var(--text-dim); text-align: center; }
