* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #60a5fa;
  --secondary-color: #3b82f6;
  --accent-color: #ef4444;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --bg-color: #0f172a;
  --bg-secondary: #1e293b;
  --card-bg: #1e293b;
  --card-hover: #334155;
  --text-color: #e2e8f0;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5),
    0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* #region Header */
header {
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border-color);
  color: var(--text-color);
  padding: 2rem 0;
  box-shadow: var(--shadow);
  margin-bottom: 0;
}

header h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.last-updated {
  background: var(--bg-color);
  border: 2px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  width: fit-content;
  display: flex;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* #endregion */

/* #region Timeline - Traditional Changelog Style */
/* Layout /////////////////////////////////////////////////////////////////*/
main {
  display: flex;
  flex-direction: column; /* Stack vertically on mobile */
  width: 100%;
  justify-content: flex-start;
}
.timeline {
  display: flex;
  flex-direction: column;
  padding: 0;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

/* PD Codes Infobox - Default (mobile/small screens) */
.pd-codes-infobox {
  display: flex;
  flex-direction: column;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  width: 100%;
  order: 2; /* Ensure it appears after timeline on mobile */
}

.pd-codes-infobox > h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.pd-codes-infobox > p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
  padding-bottom: 1rem;
}

.pd-activity-divider {
  border: none;
  border-top: 3px solid var(--primary-color);
  margin: 1rem 0;
}

article > .activity-list {
  gap: 1rem;
  flex: auto;
}

/* Desktop/larger screens - side panel */
@media (min-width: 762px) {
  main {
    flex-direction: row; /* Side-by-side on desktop */
  }
  
  .timeline {
    order: 1;
  }
  
  .pd-codes-infobox {
    max-width: 350px;
    min-width: 300px;
    margin-bottom: 0;
    margin-left: 1.5rem;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    order: 2;
  }
}/*
article > .activity-item::before {
    color: green;
}
*/

article > .activity-item::after {
  padding: 0.5rem 0.75rem;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  display: flex;
  gap: 0.1rem;
  align-items: flex-start;
  cursor: default;
  position: relative;
}

article .activity-item.uncommon {
  border-left: 3px solid #18cb36;
}

/* Remove hover effects for activity items in pd-codes-infobox */
.pd-codes-infobox .activity-item {
  cursor: default;
  border-left: 3px solid #12d318;
}

.pd-codes-infobox .activity-item::after,
.pd-codes-infobox .activity-item::before {
  /* removes hover tooltip for pd codes box*/
  display: none;
}

.pd-codes-infobox > .hour-time {
  color: var(--primary-color);
}

ul > p > em {
  /* Info text at the bottom of the codes box */
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
  padding-bottom: 1rem;
}

.pd-codes-infobox .activity-item.uncommon:hover {
  /* Hover color for pd codes box*/
  border-color: #12d318;
}

/* Hour Block - Traditional Card Style */
.hour-block {
  margin-bottom: 0;
  border-bottom: 1px solid var(--border-color);
  animation: fadeIn 0.3s ease-in;
}

.hour-block:last-child {
  border-bottom: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hour-marker {
  background: var(--bg-secondary);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hour-time {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  font-family: "Courier New", monospace;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.hour-time-label {
  font-size: 1.5rem;
  line-height: 1;
}

.hour-time-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.05em;
}

.hour-date {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.hour-content {
  background: var(--card-bg);
  padding: 1.5rem;
  transition: background 0.2s ease;
}

.hour-content:hover {
  background: var(--card-hover);
}

.hour-content.no-activity {
  opacity: 0.5;
}

.hour-content.high-activity .hour-marker {
  border-left: 4px solid var(--accent-color);
}

.activity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.activity-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.activity-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-color);
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.625rem;
  border-radius: 0.25rem;
}

.activity-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.activity-item {
  padding: 0.875rem;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  cursor: help;
  position: relative;
}

.activity-item:hover,
.activity-item:active {
  border-color: var(--primary-color);
  background: var(--bg-secondary);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}
/* #endregion */

/* #region Custom Tooltip */
.activity-item::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(0, 0, 0, 0.95);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-wrap;
  max-width: 500px;
  min-width: 300px;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.activity-item:hover::after,
.activity-item:active::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-4px);
}

/* Tooltip Arrow */
.activity-item::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  border: 6px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.95);
  z-index: 1001;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.activity-item:hover::before,
.activity-item:active::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-2px);
}

.activity-time {
  font-weight: 600;
  color: var(--primary-color);
  font-family: "Courier New", monospace;
  font-size: 0.875rem;
  min-width: 70px;
  flex-shrink: 0;
}

.activity-description {
  color: var(--text-color);
  flex: 1;
}

.activity-type {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-weight: 600;
  margin-right: 0.5rem;
}

.activity-type.traffic {
  background: var(--secondary-color);
  color: white;
}

.activity-type.medical {
  background: var(--accent-color);
  color: white;
}

.activity-type.alarm {
  background: var(--warning-color);
  color: white;
}

.activity-type.disturbance {
  background: #8b5cf6;
  color: white;
}

.activity-type.suspicious {
  background: #f97316;
  color: white;
}

.activity-type.general {
  background: var(--border-color);
  color: var(--text-color);
}
/* #endregion */

/* Generic fallback for unrecognized activity types */
.activity-type:not(.traffic):not(.medical):not(.alarm):not(.disturbance):not(
    .suspicious
  ):not(.general) {
  background: #4b5563;
  color: #d1d5db;
  border: 1px dashed #9ca3af;
}

/* #region Rarity Levels */
.activity-item.common {
  border-left: 3px solid #64748b;
}

.activity-item.uncommon {
  border-left: 3px solid #3b82f6;
}

.activity-item.uncommon:hover,
.activity-item.uncommon:active {
  border-color: #3b82f6;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.activity-item.rare {
  border-left: 3px solid #a855f7;
}

.activity-item.rare:hover,
.activity-item.rare:active {
  border-color: #a855f7;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

.activity-item.very-rare {
  border-left: 3px solid #f59e0b;
  animation: pulseGlow 2s ease-in-out infinite;
}

.activity-item.very-rare:hover,
.activity-item.very-rare:active {
  border-color: #f59e0b;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.activity-item.extreme-rare {
  border-left: 3px solid #ef4444;
  background: linear-gradient(
    90deg,
    rgba(239, 68, 68, 0.1) 0%,
    var(--bg-color) 100%
  );
  animation: pulseGlow 1.5s ease-in-out infinite;
}

.activity-item.extreme-rare:hover,
.activity-item.extreme-rare:active {
  border-color: #ef4444;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

@keyframes pulseGlow {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.85;
  }
}
/* #endregion */

/* #region Rarity Badge */
.rarity-badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.125rem 0.4rem;
  border-radius: 0.25rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.rarity-badge.common {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border: 1px solid #64748b;
}

.rarity-badge.uncommon {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid #3b82f6;
}

.rarity-badge.rare {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid #a855f7;
}

.rarity-badge.very-rare {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid #f59e0b;
}

.rarity-badge.extreme-rare {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid #ef4444;
  animation: textPulse 1.5s ease-in-out infinite;
}
/* #endregion */

@keyframes textPulse {
  0%,
  100% {
    text-shadow: 0 0 5px rgba(239, 68, 68, 0.5);
  }
  50% {
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
  }
}

.no-activity-message {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 2rem;
  opacity: 0.7;
}

/* #region Footer */
footer {
  background: var(--bg-secondary);
  border-top: 2px solid var(--border-color);
  padding: 2rem 0;
  margin-top: 2rem;
  text-align: center;
  color: var(--text-muted);
}

footer a {
  color: var(--primary-color);
  text-decoration: underline;
}
/* #endregion */

/* Responsive */
@media (max-width: 768px) {
  header h1 {
    font-size: 1.5rem;
  }

  .hour-marker {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .activity-item {
    flex-direction: column;
    gap: 0.5rem;
  }

  .activity-time {
    min-width: auto;
  }
}

/* #region Loading State */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.loading::after {
  content: "...";
  animation: dots 1.5s steps(4, end) infinite;
}
/* #endregion */

@keyframes dots {
  0%,
  20% {
    content: ".";
  }
  40% {
    content: "..";
  }
  60%,
  100% {
    content: "...";
  }
}

/* #region Rarity Filters */
.rarity-filters {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin: 2rem 0;
  box-shadow: var(--shadow);
}

.rarity-filters h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.filter-checkbox:hover {
  background: var(--card-hover);
  border-color: var(--primary-color);
}

.filter-checkbox input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.filter-checkbox .rarity-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  margin: 0;
}

/* Responsive filters */
@media (max-width: 768px) {
  .filter-options {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-checkbox {
    justify-content: flex-start;
  }
}

/* #endregion */
