/* ─── TerraVigil Dashboard Styles ─── */
/* Extends the landing page design tokens */

:root {
  --forest: #0A2F1F;
  --forest-light: #0F3D2A;
  --emerald: #10B981;
  --emerald-dim: #059669;
  --cream: #FAFAF5;
  --slate: #475569;
  --slate-light: #94A3B8;
  --charcoal: #1E293B;
  --red: #EF4444;
  --orange: #F59E0B;
  --yellow: #EAB308;
}

/* ── Layout ── */
.dashboard-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 6rem 2rem 3rem;
}

.dashboard-header {
  margin-bottom: 2rem;
}

.dashboard-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--forest);
  margin-bottom: 0.25rem;
}

.dashboard-header p {
  color: var(--slate);
  font-size: 0.95rem;
}

.dashboard-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* ── Buttons ── */
.btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-primary {
  background: var(--emerald);
  color: white;
}

.btn-primary:hover {
  background: var(--emerald-dim);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: white;
  color: var(--forest);
  border: 1px solid rgba(10, 47, 31, 0.12);
}

.btn-secondary:hover {
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.04);
}

.btn-sm {
  font-size: 0.75rem;
  padding: 0.4rem 0.8rem;
}

/* ── Stats Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border: 1px solid rgba(10, 47, 31, 0.06);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  transition: all 0.2s ease;
}

.stat-card:hover {
  border-color: rgba(16, 185, 129, 0.15);
  box-shadow: 0 4px 20px rgba(10, 47, 31, 0.05);
}

.stat-card .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-light);
  margin-bottom: 0.5rem;
}

.stat-card .value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--forest);
}

.stat-card .sub {
  font-size: 0.8rem;
  color: var(--slate);
  margin-top: 0.25rem;
}

.stat-card.critical .value { color: var(--red); }
.stat-card.high .value { color: var(--orange); }

/* ── Impact Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.badge-critical {
  background: rgba(239, 68, 68, 0.1);
  color: #DC2626;
}

.badge-high {
  background: rgba(245, 158, 11, 0.1);
  color: #D97706;
}

.badge-medium {
  background: rgba(234, 179, 8, 0.1);
  color: #A16207;
}

.badge-low {
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald-dim);
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(10, 47, 31, 0.08);
  margin-bottom: 1.5rem;
}

.tab {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--slate-light);
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover {
  color: var(--forest);
}

.tab.active {
  color: var(--emerald-dim);
  border-bottom-color: var(--emerald);
}

/* ── Filters ── */
.filters-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-select {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(10, 47, 31, 0.12);
  border-radius: 6px;
  background: white;
  color: var(--charcoal);
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--emerald);
}

.search-input {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(10, 47, 31, 0.12);
  border-radius: 6px;
  background: white;
  color: var(--charcoal);
  width: 250px;
}

.search-input:focus {
  outline: none;
  border-color: var(--emerald);
}

/* ── Regulations Table ── */
.regs-table {
  width: 100%;
  background: white;
  border: 1px solid rgba(10, 47, 31, 0.06);
  border-radius: 12px;
  overflow: hidden;
}

.regs-table table {
  width: 100%;
  border-collapse: collapse;
}

.regs-table th {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-light);
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(10, 47, 31, 0.06);
  background: rgba(250, 250, 245, 0.5);
}

.regs-table td {
  font-size: 0.85rem;
  color: var(--charcoal);
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(10, 47, 31, 0.04);
  vertical-align: top;
}

.regs-table tr:last-child td {
  border-bottom: none;
}

.regs-table tr:hover td {
  background: rgba(16, 185, 129, 0.02);
}

.reg-title {
  font-weight: 500;
  color: var(--forest);
  max-width: 400px;
  line-height: 1.4;
}

.reg-title a {
  color: inherit;
  text-decoration: none;
}

.reg-title a:hover {
  color: var(--emerald-dim);
}

.reg-statute {
  font-size: 0.75rem;
  color: var(--slate);
}

.reg-date {
  font-size: 0.8rem;
  color: var(--slate);
  white-space: nowrap;
}

.reg-type {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--slate);
}

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  font-size: 0.85rem;
  color: var(--slate);
}

.pagination-info {
  color: var(--slate-light);
  font-size: 0.8rem;
}

.pagination-btns {
  display: flex;
  gap: 0.5rem;
}

/* ── Digest View ── */
.digest-card {
  background: white;
  border: 1px solid rgba(10, 47, 31, 0.06);
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 1rem;
  transition: all 0.2s;
}

.digest-card:hover {
  border-color: rgba(16, 185, 129, 0.15);
  box-shadow: 0 4px 20px rgba(10, 47, 31, 0.05);
}

.digest-card h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  color: var(--forest);
  margin-bottom: 0.5rem;
}

.digest-meta {
  display: flex;
  gap: 1.25rem;
  font-size: 0.8rem;
  color: var(--slate-light);
  margin-bottom: 0.75rem;
}

.digest-summary {
  font-size: 0.9rem;
  color: var(--slate);
  line-height: 1.5;
}

.digest-content {
  background: white;
  border: 1px solid rgba(10, 47, 31, 0.06);
  border-radius: 12px;
  padding: 2rem;
  line-height: 1.7;
  font-size: 0.9rem;
  color: var(--charcoal);
}

.digest-content h1 { font-size: 1.5rem; color: var(--forest); margin: 1.5rem 0 0.75rem; }
.digest-content h2 { font-size: 1.2rem; color: var(--forest); margin: 1.5rem 0 0.5rem; border-bottom: 1px solid rgba(10,47,31,0.06); padding-bottom: 0.5rem; }
.digest-content h3 { font-size: 1rem; color: var(--forest); margin: 1rem 0 0.4rem; }
.digest-content table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; }
.digest-content th, .digest-content td { padding: 0.4rem 0.75rem; border: 1px solid rgba(10,47,31,0.08); font-size: 0.85rem; text-align: left; }
.digest-content th { background: rgba(250,250,245,0.5); font-weight: 600; }
.digest-content blockquote { border-left: 3px solid var(--emerald); padding: 0.5rem 1rem; margin: 0.75rem 0; background: rgba(16,185,129,0.04); color: var(--slate); border-radius: 0 6px 6px 0; }
.digest-content ul { margin: 0.5rem 0 0.5rem 1.5rem; }
.digest-content hr { border: none; border-top: 1px solid rgba(10,47,31,0.06); margin: 1rem 0; }
.digest-content a { color: var(--emerald-dim); }

/* ── Subscribe Section ── */
.subscribe-section {
  background: var(--forest);
  border-radius: 12px;
  padding: 2.5rem;
  margin-top: 2rem;
  text-align: center;
}

.subscribe-section h3 {
  font-family: 'Space Grotesk', sans-serif;
  color: white;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.subscribe-section p {
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.subscribe-form {
  display: flex;
  gap: 0.5rem;
  max-width: 500px;
  margin: 0 auto;
}

.subscribe-form input {
  flex: 1;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: white;
}

.subscribe-form input::placeholder { color: rgba(255,255,255,0.35); }
.subscribe-form input:focus { outline: none; border-color: var(--emerald); }

.subscribe-msg {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--emerald);
}

/* ── Regulation Detail Modal ── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 47, 31, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal {
  background: var(--cream);
  border-radius: 16px;
  max-width: 700px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(10, 47, 31, 0.2);
}

.modal-close {
  float: right;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--slate);
  padding: 0;
  line-height: 1;
}

.modal h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  color: var(--forest);
  margin-bottom: 1rem;
  padding-right: 2rem;
}

.modal .detail-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
}

.modal .detail-label {
  font-weight: 600;
  color: var(--slate);
  min-width: 120px;
}

.modal .detail-value {
  color: var(--charcoal);
}

.modal .abstract {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--slate);
  border: 1px solid rgba(10,47,31,0.06);
}

.modal .actions-list {
  background: rgba(16, 185, 129, 0.04);
  border: 1px solid rgba(16, 185, 129, 0.12);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
}

.modal .actions-list h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  color: var(--emerald-dim);
  margin-bottom: 0.5rem;
}

.modal .actions-list li {
  font-size: 0.85rem;
  color: var(--charcoal);
  margin-bottom: 0.35rem;
}

/* ── Loading State ── */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--slate-light);
  font-size: 0.9rem;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(16, 185, 129, 0.2);
  border-top-color: var(--emerald);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 0.75rem;
}

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

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--slate-light);
}

.empty-state h3 {
  font-family: 'Space Grotesk', sans-serif;
  color: var(--slate);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

/* ── Toast Notification ── */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--forest);
  color: white;
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  z-index: 300;
  box-shadow: 0 8px 30px rgba(10, 47, 31, 0.2);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(1rem); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-container {
    padding: 5rem 1.25rem 2rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input {
    width: 100%;
  }

  .regs-table {
    overflow-x: auto;
  }

  .regs-table table {
    min-width: 700px;
  }

  .subscribe-form {
    flex-direction: column;
  }

  .dashboard-actions {
    flex-wrap: wrap;
  }

  .modal {
    margin: 1rem;
    max-height: 90vh;
  }
}
