/*Calling googl font*/
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap");

/*defining css global variables*/
:root {
  --header-height: 3.5rem;
  /*color (hue, saturation, lightness)*/
  --first-color: hsl(220, 68%, 54%);
  --first-color-lighten: hsl(220, 68%, 97%);
  --title-color: hsl(220, 48%, 28%);
  --text-color: hsl(220, 12%, 45%);
  --body-color: hsl(220, 100%, 99%);

  /*fonts*/
  --body-font: "Poppins", sans-serif;
  --normal-font-size: .938rem;
  --small-font-size: .813rem;
  --smaller-font-size: .75rem;
  --font-medium: 500;
  --font-semi-bold: 600;

  --z-tooltip: 10;
  --z-fixed: 100;
}
@media screen and (min-width: 1024px) {
  :root {
    --normal-font-size: 1rem;
    --small-font-size: .875rem;
    --smaller-font-size: .813rem;
  }
}

/*base global styling*/
* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

body {
  font-family: var(--body-font);
  font-size: var(--normal-font-size);
  background-color: var(--body-color);
  color: var(--text-color);
}

ul {
  list-style: none;
}

a {
  text-decoration: none;
}

/*reusable classes for same style*/
.container {
  max-width: 1120px;
  margin-inline: 1.5rem;
}

/* making map not show above the header */
.leaflet-container {
  z-index: 1 !important;
}

/* Make nav + dropdown always above */
.header,
.dash-nav_menu,
.drop-down_container {
  z-index: 1000;
}


/*styling the header section*/
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  box-shadow: 0 2px 8px hsla(220, 68%, 12%, 0.1);
  background-color: var(--body-color);
  z-index: var(--z-fixed);
}

/*styling the nav section*/
.nav {
  height: var(--header-height);
}
.dash-nav_data {
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dash-nav_logo {
  display: inline-flex;
  align-items: center;
  column-gap: 0.25rem;
  color: var(--title-color);
  font-weight: var(--font-semi-bold);
  transition: color 0.3s;
}
.dash-nav_logo i {
  font-size: 1.25rem;
}
.dash-nav_logo:hover {
  color: var(--first-color);
}
.dash-nav_toggle {
  position: relative;
  width: 32px;
  height: 32px;
}
.dash-nav_toggle-menu, .dash-nav_toggle-close {
  font-size: 1.25rem;
  color: var(--title-color);
  position: absolute;
  display: grid;
  place-items: center;
  inset: 0;
  cursor: pointer;
  transition: opacity 0.1s, transform 0.4s;
}
.dash-nav_toggle-close {
  opacity: 0;
}
@media screen and (max-width: 1118px) {
  .dash-nav_menu {
    background-color: var(--body-color);
    position: absolute;
    left: 0;
    top: 2.5rem;
    width: 100%;
    height: calc(100vh - 3.5rem);
    overflow: auto;
    padding-block: 1.5rem 4rem;
    pointer-events: none;
    opacity: 0;
    transition: top 0.4s, opacity 0.3s;
  }
  .dash-nav_menu::-webkit-scrollbar {
    width: 0.5rem;
  }
  .dash-nav_menu::-webkit-scrollbar-thumb {
    background-color: hsl(220, 12%, 70%);
  }
}
.dash-nav_link {
  color: var(--title-color);
  font-weight: var(--font-semi-bold);
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.3s;
}
.dash-nav_link:hover {
  background-color: var(--first-color-lighten);
}

/* Show menu */
.show-menu {
  opacity: 1;
  top: 3.5rem;
  pointer-events: initial;
}

/* Show icon */
.show-icon .dash-nav_toggle-menu {
  opacity: 0;
  transform: rotate(90deg);
}

.show-icon .dash-nav_toggle-close {
  opacity: 1;
  transform: rotate(90deg);
}



/* Rotate dropdown icon */
.show-dropdown .drop-down_arrow {
  transform: rotate(180deg);
}


/* For large devices */
@media screen and (min-width: 1118px) {
  /* Nav */
  .nav {
    height: calc(var(--header-height) + 2rem);
    display: flex;
    justify-content: space-between;
  }
  .dash-nav_toggle {
    display: none;
  }
  .dash-nav_list {
    display: flex;
    column-gap: 3rem;
    height: 100%;
  }
  .nav li {
    display: flex;
  }
  .dash-nav_link {
    padding: 0;
  }
  .dash-nav_link:hover {
    background-color: initial;
  }
}
@media screen and (min-width: 1152px) {
  .container {
    margin-inline: auto;
  }
}

main {
  padding-top: calc(var(--header-height) + 1.5rem); 
  min-height: 100vh;
}

@media (min-width: 1024px) {
  main {
    padding-top: calc(var(--header-height) + 2.5rem);
  }
}

.dashboard {
  /* Mobile-first showing vertcally */
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.card-content {
  padding: 24px;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #1a1a1a;
}

.card-value, .stat-card-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--first-color); 
  margin: 12px 0 4px;
  letter-spacing: -1px;
  line-height: 1;
}

.card-subtitle {
  color: #666;
  font-size: 0.95rem;
}


/* tablet screens styling*/
@media (min-width: 640px) {
  .dashboard {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .card {
    flex: 1 1 45%; /*  2 per row */
  }
}

/* Desktop screens styling */
@media (min-width: 1024px) {
  .dashboard {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 5 equal columns */
    gap: 24px;
  }
  .trip-search {
    width: 80%;
  }
  .card {
    flex: unset; /* resetting the flex from previous media query */
  }

  .card.featured {
    grid-column: span 2;
  }
}

/* Very large screens styling */
@media (min-width: 1600px) {
  .dashboard {
    max-width: 1600px;
  }
}

@media (max-width: 500px) {
  .card-value, .stat-card-value {
    font-size: 1rem;
  }
}

/* analytics section styling */
.analytics-section {
  max-width: 1400px;
  margin: 28px auto 0;
  padding: 0 0 48px;
}

.analytics-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

/* graph base style */
.analytics-graphs {
  display: grid;
  grid-template-columns: 1fr; /* stacked on mobile */
  gap: 20px;
}

/* two small stats cards beside the graph */
.analytics-stats {
  display: grid;
  grid-template-columns: 1fr 1fr; /* side by side on mobile */
  gap: 20px;
}

/* Graph box */
.graph-box {
  background: white;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.07);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.graph-box:hover { 
  transform: translateY(-3px); 
  box-shadow: 0 12px 28px rgba(0,0,0,0.1); 
}

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

.graph-box-title { 
  font-size: 1rem; 
  font-weight: 600; 
  color: #1a1a1a; 
}

.graph-box-badge {
  font-size: 0.72rem; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  background: var(--first-color-lighten); 
  color: var(--first-color);
}

.graph-box-body { 
  padding: 16px 24px 24px; 
}


/* Stats mini cards on the right */
.stat-card {
  background: white;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.07);
  padding: 22px 20px;
  display: flex; 
  flex-direction: column; gap: 10px;
  transition: transform 0.2s ease, 
  box-shadow 0.2s ease;
}

.stat-card:hover { 
  transform: translateY(-3px); 
  box-shadow: 0 12px 24px rgba(0,0,0,0.1); 
}

.stat-card-icon-row { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
}

.stat-card-icon {
  width: 40px; 
  height: 40px; 
  border-radius: 10px;
  background: var(--first-color-lighten);
  display: grid; 
  place-items: center; 
  flex-shrink: 0;
}

.stat-card-icon i { 
  font-size: 1.2rem; 
  color: var(--first-color); 
}

.stat-card-title { 
  font-size: 0.85rem; 
  font-weight: 600; 
  color: #1a1a1a; 
}


.stat-card-sub { 
  font-size: 0.78rem; 
  color: var(--text-color); 
  line-height: 1.4; 
}

/* Mini bars for peak hours */
.stat-card-spark { 
  display: flex; 
  align-items: flex-end; 
  gap: 3px; 
  height: 28px; 
  margin-top: 4px; 
}

.spark-bar { 
  flex: 1; 
  border-radius: 2px 2px 0 0; 
  background: var(--first-color); 
  opacity: 0.18; 
}

.spark-bar.active { 
  opacity: 0.75; 
}


/* desktop screen for analtics section */
@media (min-width: 1024px) {
  .analytics-layout {
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
  }

  .analytics-graphs { 
    display:flex; 
    flex-direction: column; 
    gap: 20px; 
  }

  /* display the stat cards vertically in the right column */
  .analytics-stats { 
    grid-template-columns: 1fr; 
    gap: 20px; 
  }
}

@media (min-width: 1600px) { 
  .analytics-section { 
    max-width: 1600px; 
  } 
}


/* tables showing top locations and borroughs styling */
.tables-heading {
  max-width: 1400px;
  margin: 40px auto 16px;
  padding: 0 4px;
}

.tables-heading__title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.tables-heading__sub {
  font-size: 0.85rem;
  color: var(--text-color);
}

/* 3 grid span for the tables */
.tables-grid {
  max-width: 1400px;
  margin: 0 auto 48px;
  display: grid;
  grid-template-columns: 1fr; 
  gap: 20px;
}

/* 2 grid span on tablet */
@media (min-width: 700px) {
  .tables-grid {
    grid-template-columns: 1fr 1fr;
  }
  .tables-grid .loc-table-card:nth-child(3) {
    grid-column: 1 / -1;
  }
}

/* 3 grid span side by side on desktop*/
@media (min-width: 1100px) {
  .tables-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .tables-grid .loc-table-card:nth-child(3) {
    grid-column: unset;
  }
}

@media (min-width: 1600px) {
  .tables-grid { max-width: 1600px; }
  .tables-heading { max-width: 1600px; }
}

/* card for each table */
.loc-table-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.07);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}
.loc-table-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.10);
}

/* card header showing title of table */
.loc-table-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid hsl(220, 30%, 94%);
}
.loc-table-card__icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--first-color-lighten);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.loc-table-card__icon i{ font-size: 1.3rem; 
  color: var(--first-color); 
}
.loc-table-card__icon--drop{ 
  background: hsl(160, 60%, 95%); 
}
.loc-table-card__icon--drop i{ 
  color: hsl(160, 55%, 38%); 
}
.loc-table-card__icon--route{ 
  background: hsl(35, 100%, 95%); 
}
.loc-table-card__icon--route i   { 
  color: hsl(35, 90%, 45%); 
}

.loc-table-card__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.2;
}
.loc-table-card__badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--first-color-lighten);
  color: var(--first-color);
}
.loc-table-card__badge--drop  { 
  background: hsl(160,60%,95%); 
  color: hsl(160,55%,35%); 
}
.loc-table-card__badge--route { 
  background: hsl(35,100%,95%); 
  color: hsl(35,90%,42%); 
}

/* making the table body to scroll */
.loc-table-card__body {
  overflow-x: auto;
  flex: 1;
}
.loc-table-card__body::-webkit-scrollbar { height: 4px; }
.loc-table-card__body::-webkit-scrollbar-thumb {
  background: hsl(220,12%,80%);
  border-radius: 4px;
}

/* styling each table */
.loc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.loc-table thead th {
  position: sticky;
  top: 0;
  background: hsl(220, 30%, 97%);
  color: var(--title-color);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 14px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.loc-table thead th:hover { 
  color: var(--first-color); 
}

.loc-table tbody tr {
  border-bottom: 1px solid hsl(220, 20%, 95%);
  transition: background-color 0.15s ease;
}
.loc-table tbody tr:last-child { 
  border-bottom: none; 
}
.loc-table tbody tr:hover { 
  background-color: hsl(220, 68%, 98%); 
}

.loc-table tbody td {
  padding: 9px 14px;
  color: #444;
  white-space: nowrap;
}

/* dropdown styles */
.drop-down_item {
  list-style: none;
}
.drop-down_content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px;
}


.drop-down_button {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* styling the dropdown container */

.drop-down_container {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;

  background: var(--body-color);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);

  max-height: 0;
  overflow: hidden;
  opacity: 0;

  transition: max-height 0.4s ease, opacity 0.25s ease;

  z-index: 1000;
}


/* show dropdown when the button is clicked/active */
.show-dropdown .drop-down_container {
  max-height: 800px; 
  opacity: 1;
}

/* dropdown content style */

.drop-down_content {
  padding: 20px;
}

/*  container for trip search */
.trip-search {
  background: #ffffff;
  padding: 20px;
  border-radius: 10px;
  margin: 20px 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

@media (max-width: 1117px) {

  .drop-down_container {
    position: static;
    width: 100%;
    box-shadow: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .show-dropdown .drop-down_container {
    max-height: 1000px;
  }

}

/* heading style */
.trip-search h3 {
  margin-bottom: 15px;
}

/* each search input group */
.search-group {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
}
.search-group label {
  font-size: 14px;
  margin-bottom: 5px;
}
.search-group input, .search-group select {
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #ddd;
  font-size: 14px;
}

/* layout container */
.search-layout {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

.search-left {
  width: 40%;
}

.search-right {
  width: 60%;
}

.search-right .search-group {
  display: flex;
  flex-direction: column;
}

/* search button style */
#searchBtn {
  padding: 10px;
  background: #2b6cb0;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

#searchBtn:hover {
  background: #1e4f8a;
}

/* hide sections until selected */
.hidden {
  display: none !important;
}
.search-right:empty {
  display: none !important;
}

@media (max-width: 768px) {
  .search-layout {
    flex-direction: column;
  }

  .search-left,
  .search-right {
    width: 100%;
  }
}

/* styling the trip over time chart date time picker */
.chart-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.chart-controls label {
  font-size: 14px;
  font-weight: 500;
  color: #444;
}

/* select styling */
#chartDatePicker {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #ddd;
  font-size: 14px;
  background: #fff;
  cursor: pointer;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

#chartDatePicker:focus {
  outline: none;
  border: 1px solid #2b6cb0;
  box-shadow: 0 0 0 2px rgba(43, 108, 176, 0.15);
}

.graph-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

/* style for the metrics drop down */
#metricSelector {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: white;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s ease;
}

#metricSelector:hover {
  border-color: hsl(220,68%,54%);
}

#metricSelector:focus {
  outline: none;
  border-color: hsl(220,68%,54%);
  box-shadow: 0 0 0 2px hsla(220,68%,54%,0.2);
}

/* modal for search result display logic */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.hidden {
  display: none;
}

.modal-content {
  background: white;
  width: 80%;
  max-height: 80%;
  overflow-y: auto;
  border-radius: 8px;
  padding: 20px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-btn {
  font-size: 22px;
  cursor: pointer;
}

#resultsTable {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

#resultsTable th,
#resultsTable td {
  padding: 8px;
  border-bottom: 1px solid #ddd;
  text-align: left;
}

/* styling the intro section for welcome */
.intro-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  z-index: 9999;
  transition: opacity 1s ease;
}

.intro-content {
  max-width: 700px;
}

.intro-main {
  font-size: 2rem;
  margin-bottom: 10px;
  opacity: 0;
  animation: fadeIn 1.2s ease forwards;
}

.intro-sub {
  font-size: 1.2rem;
  margin-bottom: 40px;
  opacity: 0;
  animation: fadeIn 1.2s ease forwards;
  animation-delay: 1s;
}

.intro-names {
  position: relative;
  height: 40px;
}

.name {
  position: absolute;
  width: 100%;
  opacity: 0;
  font-size: 1.4rem;
  font-weight: 500;
  transform: scale(0.7);
}

/* Each name animation timing */

.name:nth-child(1) {
  animation: zoomCycle 3s ease forwards;
  animation-delay: 2s;
}

.name:nth-child(2) {
  animation: zoomCycle 3s ease forwards;
  animation-delay: 4.5s;
}

.name:nth-child(3) {
  animation: zoomCycle 3s ease forwards;
  animation-delay: 7s;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

@keyframes zoomCycle {
  0% {
    opacity: 0;
    transform: scale(0.7);
  }
  20% {
    opacity: 1;
    transform: scale(1.1);
  }
  50% {
    transform: scale(1);
  }
  80% {
    opacity: 1;
    transform: scale(1.05);
  }
  100% {
    opacity: 0;
    transform: scale(0.8);
  }
}

/* styling the map section */

.map-section {
  padding: 3rem 2rem;
  background: #f7f9fc;
  min-height: 100vh;
  display: none;
}

.map-container {
  max-width: 1200px;
  margin: 0 auto;
  background: #ffffff;
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

/* Header styling */
.map-header {
  margin-bottom: 1.5rem;
}

.map-title {
  font-size: 1.6rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.4rem;
}

.map-subtitle {
  font-size: 0.95rem;
  color: #6b7280;
}

/* Map box styling */
#map {
  width: 100%;
  height: 480px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

/* adding some animation to make the map better */
.map-container {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.map-container:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}
