/* Dashboard layout — extends theme.css design tokens */

/* ===== LAYOUT ===== */
.dashboard-body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg-elevated);
  border-right: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  padding: 28px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 28px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.brand-icon {
  font-size: 1.2rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--fg);
}

.nav-item.active {
  background: rgba(240,160,48,0.1);
  color: var(--accent);
}

.nav-icon { font-size: 1rem; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #000;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
}

.sidebar-stats {
  display: flex;
  justify-content: space-around;
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.stat-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-mini-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg);
}

.stat-mini-label {
  font-size: 0.68rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-back {
  padding: 16px 24px 0;
  font-size: 0.8rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.sidebar-back:hover { color: var(--accent); }

/* ===== MAIN AREA ===== */
.dash-main {
  flex: 1;
  padding: 32px 40px;
  max-width: 900px;
  overflow-y: auto;
}

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

.dash-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.8rem;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.dash-subtitle {
  color: var(--fg-muted);
  font-size: 0.85rem;
  font-weight: 300;
}

/* ===== STATS BAR ===== */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: -0.03em;
  color: var(--fg);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.text-accent { color: var(--accent) !important; }
.text-muted { color: var(--fg-muted) !important; }
.text-hot { color: var(--accent-hot) !important; }

/* ===== FILTER TABS ===== */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 4px;
  width: fit-content;
}

.filter-tab {
  padding: 8px 18px;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: all 0.15s;
}

.filter-tab:hover {
  color: var(--fg);
  background: rgba(255,255,255,0.04);
}

.filter-tab.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* ===== MESSAGE CARDS ===== */
.message-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 14px;
  padding: 20px 24px;
  transition: border-color 0.2s, transform 0.15s;
  cursor: default;
}

.message-card:hover {
  border-color: rgba(240,160,48,0.15);
}

.message-card[data-category="vip"] {
  border-left: 3px solid var(--accent);
}

.message-card[data-category="spam"] {
  opacity: 0.6;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.fan-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  color: #000;
  flex-shrink: 0;
}

.fan-avatar-lg {
  width: 52px;
  height: 52px;
  font-size: 1.3rem;
}

.fan-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.fan-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--fg);
}

.message-time {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.message-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.category-vip { background: rgba(240,160,48,0.15); color: var(--accent); }
.category-general { background: rgba(255,255,255,0.06); color: var(--fg); }
.category-spam { background: rgba(255,107,43,0.12); color: var(--accent-hot); }
.category-uncategorized { background: rgba(255,255,255,0.05); color: var(--fg-muted); }

.score-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
}
.score-high { background: rgba(240,160,48,0.12); color: var(--accent); }
.score-mid { background: rgba(255,255,255,0.06); color: var(--fg-muted); }
.score-low { background: rgba(255,255,255,0.03); color: var(--fg-muted); }

.status-badge {
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
}
.status-badge.sent { background: rgba(52,211,153,0.12); color: #34d399; }
.status-badge.draft { background: rgba(129,140,248,0.12); color: #818cf8; }

.message-preview {
  color: var(--fg-muted);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 14px;
  font-weight: 300;
}

.draft-preview {
  background: rgba(129,140,248,0.06);
  border: 1px solid rgba(129,140,248,0.15);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 0.82rem;
  line-height: 1.5;
}

.draft-label {
  font-weight: 600;
  color: #818cf8;
  margin-right: 6px;
}

.draft-text {
  color: var(--fg-muted);
}

.message-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--gradient-warm);
  color: #000;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-full { width: 100%; }

.btn-secondary {
  background: rgba(240,160,48,0.1);
  color: var(--accent);
  border: 1px solid rgba(240,160,48,0.25);
  padding: 8px 16px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: rgba(240,160,48,0.18); }

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 8px 16px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.84rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover { color: var(--fg); border-color: rgba(255,255,255,0.15); }

.btn-action {
  background: var(--bg-elevated);
  color: var(--fg-muted);
  border: 1px solid rgba(255,255,255,0.07);
  padding: 6px 14px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-action:hover { color: var(--fg); border-color: rgba(255,255,255,0.15); }

.btn-categorize:hover { color: var(--accent); border-color: rgba(240,160,48,0.3); }
.btn-draft:hover { color: #818cf8; border-color: rgba(129,140,248,0.3); }

/* ===== FORM ===== */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color 0.15s;
  outline: none;
}
.form-input:focus { border-color: rgba(240,160,48,0.4); }
.form-textarea { resize: vertical; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--fg); }

.modal-body { padding: 20px 28px 28px; }

/* ===== MESSAGE DETAIL ===== */
.message-detail-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px;
  padding: 36px;
  max-width: 720px;
}

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

.detail-fan-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-time {
  font-size: 0.78rem;
  color: var(--fg-muted);
}

.detail-message-box {
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--fg);
}

.detail-reply-section {
  margin-top: 24px;
}

.detail-reply-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.detail-reply-header h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.reply-textarea {
  min-height: 120px;
  margin-bottom: 12px;
}

.detail-reply-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.reply-sent-notice {
  background: rgba(52,211,153,0.08);
  border: 1px solid rgba(52,211,153,0.2);
  color: #34d399;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--fg-muted);
}

.empty-icon {
  display: block;
  font-size: 3rem;
  margin-bottom: 16px;
}

/* ===== LOADING ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,12,0.85);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.loading-spinner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(240,160,48,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .dashboard-body { flex-direction: column; }
  .sidebar {
    width: 100%;
    min-width: unset;
    height: auto;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 12px;
    gap: 8px;
  }
  .sidebar-brand { padding: 0 8px 0 0; border: none; }
  .sidebar-nav { flex-direction: row; padding: 0; flex: none; }
  .sidebar-stats { display: none; }
  .sidebar-back { padding: 0; }
  .dash-main { padding: 20px 16px; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
}
