:root {
  --gradient-start: #1a1a2e;
  --gradient-end: #16213e;
  --accent: #e94560;
  --accent-light: #ff6b6b;
  --text-muted: #a0a0a0;
}

body {
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
  min-height: 100vh;
  color: #f0f0f0;
  font-family: "Segoe UI", system-ui, sans-serif;
}

.hero {
  background: linear-gradient(135deg, rgba(233, 69, 96, 0.15) 0%, rgba(22, 33, 62, 0.8) 100%);
  border-bottom: 1px solid rgba(233, 69, 96, 0.3);
  padding: 2rem 0;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(90deg, #fff 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.stats-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  transition:
    transform 0.3s,
    box-shadow 0.3s;
}

.stats-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(233, 69, 96, 0.2);
}

.stats-card .number {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}

.stats-card .label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.form-control,
.form-select {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
}

.form-control:focus,
.form-select:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 0.25rem rgba(233, 69, 96, 0.25);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-select option {
  background: var(--gradient-start);
  color: #fff;
}

/* Custom Multi-select Dropdown */
.custom-dropdown {
  position: relative;
  width: 100%;
}

.dropdown-trigger {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 0.375rem 0.75rem;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition:
    border-color 0.15s ease-in-out,
    box-shadow 0.15s ease-in-out;
}

.dropdown-trigger:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.custom-dropdown.open .dropdown-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.25rem rgba(233, 69, 96, 0.25);
}

.dropdown-menu-custom {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1050;
  background: var(--gradient-start);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  margin-top: 5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  max-height: 300px;
  overflow-y: auto;
}

.dropdown-item-custom {
  padding: 0.5rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.2s;
  font-size: 0.9rem;
}

.dropdown-item-custom:hover {
  background: rgba(255, 255, 255, 0.05);
}

.dropdown-item-custom.active {
  color: var(--accent-light);
  background: rgba(233, 69, 96, 0.1);
}

.dropdown-item-custom .bi {
  font-size: 1.1rem;
}

.dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0.5rem 0;
}

.dropdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1040;
}

/* Search input group fix */
.input-group .input-group-text {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-right: none;
  color: var(--text-muted);
}

.input-group .form-control {
  border-left: none;
}

.input-group:focus-within .input-group-text {
  border-color: var(--accent);
}

.table-container {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  /* overflow: hidden; Removed to allow tooltips */
}

.table {
  margin-bottom: 0;
  color: #f0f0f0;
  --bs-table-bg: transparent;
  --bs-table-color: #f0f0f0;
  --bs-table-border-color: rgba(255, 255, 255, 0.1);
  --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
  --bs-table-hover-bg: rgba(233, 69, 96, 0.15);
}

.table thead {
  background: rgba(233, 69, 96, 0.3);
}

.table thead th {
  border-bottom: 2px solid var(--accent);
  background: rgba(233, 69, 96, 0.3) !important;
  color: #fff !important;
  font-weight: 600;
  padding: 0.7rem 1rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.table thead th:hover {
  background: rgba(233, 69, 96, 0.5) !important;
}

.table thead th .bi {
  display: inline-block;
  margin-left: 0.5rem;
  opacity: 0.6;
  font-size: 0.8rem;
}

.table thead th.active .bi {
  opacity: 1;
  color: #fff;
}

.table tbody tr {
  transition: background 0.2s;
}

.table tbody tr:hover td {
  background: rgba(233, 69, 96, 0.1) !important;
  color: #f0f0f0 !important;
}

.table td {
  padding: 0.5rem 1rem;
  border-color: rgba(255, 255, 255, 0.08);
  vertical-align: middle;
}

.year-cell {
  white-space: nowrap;
}

.table td:not(.deaths-cell) {
  background: transparent !important;
}

.badge-type {
  font-size: 0.75rem;
  font-weight: 400;
  padding: 0.4em 0.8em;
  border-radius: 6px;
}

.badge-war {
  background: #3498db;
}
.badge-genocide {
  background: #e74c3c;
}
.badge-conquest {
  background: #9b59b6;
}
.badge-repression {
  background: #e67e22;
}
.badge-famine {
  background: #f39c12;
}
.badge-cataclysm {
  background: #1abc9c;
}
.badge-epidemic {
  background: #8e44ad;
}
.badge-other {
  background: #95a5a6;
}

.deaths-cell {
  font-size: 0.85rem;
  color: var(--accent-light);
  white-space: nowrap;
}

.deaths-icon {
  margin-right: 6px;
  font-size: 0.7rem;
}

.deaths-value {
  display: inline-block;
  padding: 0.3em 0.6em;
  border-radius: 6px;
}

.source-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.75rem;
  margin-right: 0.5rem;
}

.source-link:hover {
  color: var(--accent);
}

.notes-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 2rem;
  margin-top: 2rem;
}

.notes-section h3 {
  color: var(--accent-light);
  margin-bottom: 1.5rem;
}

.notes-section h5 {
  color: #fff;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

.note-item {
  margin-bottom: 0.5rem;
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
}

.note-item strong {
  color: #fff;
}

.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 3rem;
}

.loading {
  text-align: center;
  padding: 3rem;
}

.loading .spinner-border {
  width: 3rem;
  height: 3rem;
  color: var(--accent);
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.8rem;
  }

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

  .table {
    min-width: 800px;
  }
}

/* Custom Tooltips */
.name-text.with-tooltip {
  cursor: help;
  /* text-decoration: underline dotted rgba(233, 69, 96, 0.5); */
  text-underline-offset: 4px;
}
