/* Purpose: Defines the shared presentation rules for the public F1 site. */
/*----General----*/

@font-face {
  src: url(../fonts/Jost-Bold.ttf);
  font-family: Jost-Bold;
}
@font-face {
  src: url(../fonts/Jost-Regular.ttf);
  font-family: Jost;
}

html,
body {
  max-width: 100%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  background-color: #1d2226;
  color: white;
  font-family: Jost, sans-serif;
  margin: 0;

  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  background-color: #1d2226;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 3px solid black;
  width: 100%;
  padding-bottom: 7px;
  box-sizing: border-box;
}

footer {
  background-color: #788999;
  padding: 3px 20px;
  border-top: 1px solid black;
}

main {
  padding: 20px;
  flex: 1;
  overflow-x: auto;
}

h1 {
  color: #e0041e;
  font-size: 2.5em;
  font-family: Jost-Bold;
  margin-bottom: 10px;
  padding-left: 20px;
}

section {
  scroll-margin: 30vh;
}

p {
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
}

pre {
  font-family: Jost;
  white-space: pre-wrap;
  max-width: 100%;
  overflow-wrap: anywhere;
}

nav {
  border-radius: 5px;
}

a {
  color: #add8e6;
  font-size: large;
  text-decoration: none;
}

a:hover {
  color: red;
}

.site-header__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
  margin: 10px 0;
}

.site-nav__link {
  color: white;
  font-family: Jost-Bold;
  background-color: #788999;
  border-radius: 5px;
  padding: 5px 20px;
  white-space: nowrap;
}

.site-nav--secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 13px 10px;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
  margin-top: 15px;
}

.session-banner {
  width: min(960px, calc(100% - 40px));
  margin: 10px auto 0;
  padding: 10px 14px;
  border: 1px solid #ffffff33;
  border-radius: 10px;
  background-color: rgba(255, 255, 255, 0.05);
  text-align: center;
}

.content-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-direction: column;
}

.race-feed {
  display: grid;
  gap: 14px;
}

.race-feed__card {
  border: 1px solid #ffffff33;
  border-radius: 12px;
  padding: 14px 16px;
  background-color: rgba(255, 255, 255, 0.04);
}

.race-feed__card h3 {
  margin: 0 0 6px;
}

.race-feed__meta {
  margin: 0 0 10px;
  color: #d7dce2;
}

.race-feed__results {
  margin: 0;
  padding-left: 18px;
}

.admin-edit-table {
  width: 100%;
  max-width: 100%;
  margin: 10px 0;
}

#Formula1 {
  height: 60px;
  width: auto;
}

#about {
  font-size: 1em;
}

@media (min-width: 700px) {
  .site-nav {
    width: 60%;
  }

  .content-row {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
  }
}
/*--Driver tile--*/
.driver-tile {
  background-color: rgba(255, 255, 255, 0.5);
  border: 2px solid Black;
  border-radius: 5px;
  width: min(82vw, 360px);
  height: clamp(160px, 42vw, 240px);
  display: flex;
  justify-content: center;
}

.driver-card {
  width: 100%;
  min-width: 0;
}

.favorite-team-highlight {
  border: 2px solid #ffd700 !important;
  box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.18);
}

.driver-card > a {
  display: block;
  width: 100%;
}

.driver-card__row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.team-profile-page {
  display: grid;
  gap: 20px;
}

.team-section {
  display: grid;
  gap: 14px;
}

.team-section h3 {
  margin: 0;
}

.team-detail-list {
  margin: 0;
  padding-left: 18px;
}

.team-detail-list li + li {
  margin-top: 6px;
}

.team-driver-list,
.team-car-list {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-direction: column;
}

.driver-meta {
  width: 100%;
  max-width: 520px;
  border: 1px solid #ffffff33;
  border-radius: 10px;
  padding: 10px 12px;
  background-color: rgba(255, 255, 255, 0.05);
}

.driver-tile img {
  max-width: 100%;
  max-height: 100%;
  opacity: 1;
}

@media (min-width: 700px) {
  .driver-tile {
    width: 15vw;
    height: 15vh;
  }

  .driver-card {
    width: 46%;
  }

  .driver-card__row {
    flex-direction: row;
    align-items: stretch;
  }

  .team-driver-list,
  .team-car-list {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
}

/*---Home Page---*/

.leaderboard-table {
  margin: 10px auto;
  border-collapse: collapse;
  width: 80%;
  max-width: 80vw;
  background-color: #2d2d2d;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0);
}
.leaderboard-table tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.244);
}

.leaderboard-table certain {
  background-color: #444;
  color: #00ffcc;
  text-align: left;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 15px 20px;
  border-bottom: 1px solid #242424;
}

.leaderboard-table tbody tr:hover {
  background-color: #383838;
}

.leaderboard-table tbody tr.favorite-team-highlight {
  background-color: rgba(255, 215, 0, 0.18);
}

.rank {
  font-weight: bold;
  width: 50px;
}

.points {
  text-align: right;
  color: #ffd900c6;
  font-weight: bold;
}

tr:nth-child(1) .rank {
  color: #ffd700;
}
tr:nth-child(2) .rank {
  color: #c0c0c0;
}
tr:nth-child(3) .rank {
  color: #cd7f32;
}

/*----Drivers page----*/

.drivers-bio {
  font-size: 0.78rem;
  color: white;
  overflow-wrap: anywhere;
  width: 100%;
  max-width: 100%;
  margin: 0;
}

.former-teams-title {
  margin: 10px 0 6px;
  font-size: 0.95rem;
}

.former-teams-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.former-teams-list .team-item {
  border: 1px solid #ffffff55;
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 0.8rem;
  background-color: #788999;
  cursor: help;
}

.former-teams-list .team-item:hover {
  border-color: #e0041e;
  color: #ffffff;
}

#driversList {
  align-items: center;
}

#driversList .driver-card {
  width: min(95vw, 680px);
}

@media (min-width: 700px) {
  .drivers-bio {
    font-size: 0.6em;
  }

  #driversList .driver-card {
    width: 46%;
  }
}
/*----Statistic page----*/

.stats__controls {
  font-family: Jost-Bold;
}

.stats__select {
  background-color: #1d2226;
  color: white;
  border-radius: 2px;
}

.stats-car--tile {
  width: min(90vw, 430px);
  height: clamp(130px, 30vw, 220px);
  display: flex;
  justify-content: center;
}

.stats-car--tile img {
  object-fit: contain;
  max-width: 100%;
  max-height: 100%;
}

.stats__drivers {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.stats-team-link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 1px solid #ffffff66;
  border-radius: 8px;
  padding: 12px 14px;
  background-color: #788999;
  max-width: 220px;
}

.stats-team-link img {
  width: 84px;
  height: auto;
}

.stats-races {
  width: 100%;
  overflow-x: auto;
  white-space: nowrap;
}

.stats-races--table {
  border: 1px solid white;
  width: 100%;
  border-collapse: collapse;
}

.stats-races--table th,
.stats-races--table td {
  border: 1px solid white;
  padding: 8px;
}

#carType {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

#TeamsShortcut {
  text-align: center;
}

@media (min-width: 700px) {
  .stats-car--tile {
    width: 40vw;
    height: 25vh;
  }

  #Cars,
  #Drivers {
    flex: none;
    width: auto;
  }
}
/*----Cars page----*/

.cars-table--container {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.cars-table {
  border-collapse: collapse;
  white-space: nowrap;
  min-width: 100%;
  border: #e0041e 3px solid;
}

.cars-table tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.5);
}

.cars-table img {
  width: 30vw;
  height: auto;
  object-fit: contain;
}

@media (min-width: 700px) {
  .cars-table {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    font-size: 0.8rem;
  }

  .cars-table td,
  .cars-table th {
    padding: 4px;
    white-space: nowrap;
  }
}

/*----Team Members Page----*/

.player-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  justify-items: center;
}

.player-photo {
  width: clamp(150px, 45vw, 320px);
  min-width: 150px;
  max-width: 320px;
  height: auto;
  display: block;
  margin: 8px auto;
}

.student-tile img {
  width: clamp(150px, 45vw, 320px);
  min-width: 150px;
  max-width: 320px;
  height: auto;
  display: block;
  margin: 8px auto;
}

.team-item {
  cursor: help;
}

.team-tooltip {
  position: absolute;
  max-width: 280px;
  background-color: #02101d;
  color: white;
  border: 1px solid #ffffff66;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.85rem;
  white-space: pre-line;
  pointer-events: none;
  display: none;
  z-index: 2000;
}

.team-tooltip--visible {
  display: block;
}

@media (min-width: 700px) {
  .player-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}
/*---Admin Dashboard---*/

.admin-panel {
  border: 1px solid #ffffff33;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  background-color: rgba(255, 255, 255, 0.04);
}

.admin-toolbar,
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}

.admin-feedback {
  min-height: 1.5em;
}

.admin-feedback--error {
  color: #ff8c8c;
}

.admin-note {
  margin: 0 0 12px;
  color: #d7dce2;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.admin-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-input,
.admin-form input,
.admin-form select,
.admin-toolbar select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #ffffff33;
  background-color: #10161b;
  color: white;
  font-family: Jost, sans-serif;
}

.admin-table-wrap {
  overflow-x: auto;
}

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

.admin-table th,
.admin-table td {
  padding: 10px;
  border-bottom: 1px solid #ffffff22;
  text-align: left;
  vertical-align: top;
}

.admin-table tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.03);
}

.admin-table button,
.admin-actions button,
.login-container button,
#logOutBox button {
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background-color: #e0041e;
  color: white;
  font-family: Jost-Bold, sans-serif;
  cursor: pointer;
}

.admin-table button:hover,
.admin-actions button:hover,
.login-container button:hover,
#logOutBox button:hover {
  opacity: 0.9;
}

.admin-table button:disabled,
.admin-actions button:disabled,
.login-container button:disabled,
#logOutBox button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 699px) {
  .admin-table th,
  .admin-table td {
    min-width: 120px;
  }
}
