body {
  height: 100vh;
  overflow-x: hidden;
}

.sidebar {
  position: fixed;
  top: 100px;
  bottom: 0px;
  left: 0px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  width: 16%;
  padding-right: 10px;
}
.content {
  margin-left: 20%;
  padding: 10px;
}
@media (max-width: 1080px) {
  .content {
    padding: 5px;
  }
}
@media (max-width: 768px) {
  .sidebar {
      display: none;
  }
  .content {
      margin-left: 0;
  }
}

/* optional */
.vh-100 {
   min-height: 100vh;
}

.title {
  text-align: center;
}
.bk-root {
  height: auto !important;
  flex-wrap: wrap !important;
  -webkit-flex-wrap: wrap !important;
  max-width: 100% !important;
  height: auto !important;
  margin-bottom: 30px !important;
}
.bk-layout-scale_width {
  height: auto !important;
  flex-wrap: wrap !important;
  -webkit-flex-wrap: wrap !important;
}
.bk-layout-scale_height {
  width: auto !important;
  flex-wrap: wrap !important;
  -webkit-flex-wrap: wrap !important;
}
.bokeh_chart {
  margin-left: 10px;
  margin-right: 10px;
  margin-top: 10px;
  margin-bottom: 70px;
}
table {
  margin-bottom: 30px !important;
  background-color: var(--ir-bg-header);
  color: var(--ir-text-chart);
}
table td {
  color: var(--ir-text-chart);
  border-bottom: 1px solid var(--ir-border-slate);
  background-color: inherit;
}
table tbody tr:nth-child(odd) td {
  background-color: var(--ir-bg-header);
}
table tbody tr:nth-child(even) td {
  background-color: var(--ir-bg-deep);
}
table tbody tr:hover td {
  background-color: var(--ir-bg-surface);
}
table.primary {
  background-color: var(--ir-bg-header);
}
thead th {
  background-color: var(--ir-bg-deep);
  color: var(--ir-text-primary) !important;
  font-size: 1.5rem;
  font-weight: 600;
  border-bottom: 2px solid var(--ir-accent-teal);
}

table.weeknum th:first-child {
  text-align: center;
  width: 5%;
  font-size: larger;
}
table.weeknum td:first-child {
  text-align: center;
  width: 5%;
}
table.weeknum th:nth-child(2) {
  text-align: left !important;
  font-size: larger;
}

table.noindex th:first-child {
  text-align: left;
  margin-left: 10px;
  font-size: larger;
}
table.noindex td:first-child {
  text-align: left;
  margin-left: 10px;
}

table.hide_team_id th:nth-child(2) {
  display: none;
}
table.hide_team_id td:nth-child(2) {
  display: none;
}

table.one_display_name th:nth-child(3) {
  text-align: left;
  padding-left: 5px;
  width: 40%;
  font-size: larger;
}
table.one_display_name td:nth-child(3) {
  text-align: left;
  padding-left: 5px;
  width: 40%;
}

table.team_drivers th:nth-child(3) {
  text-align: left;
  padding-left: 5px;
  width: 33%;
  font-size: larger;
}
table.team_drivers td:nth-child(3) {
  text-align: left;
  padding-left: 5px;
  width: 33%;
}
table.team_drivers th:nth-child(4) {
  text-align: left;
  padding-left: 5px;
  padding-left: 5px;
  width: 40%;
  font-size: larger;
}
table.team_drivers td:nth-child(4) {
  text-align: left;
  padding-left: 5px;
  width: 40%;
  font-size: 14px;
}

table.one_data_col th:nth-last-child(1) {
  text-align: center;
  width: 20%;
  font-size: larger;
}
table.one_data_col td:nth-last-child(1) {
  text-align: center;
  width: 20%;
}

table.two_data_col th:nth-last-child(-n+2) {
  text-align: center;
  width: 20%;
  font-size: larger;
}
table.two_data_col td:nth-last-child(-n+2) {
  text-align: center;
  width: 20%;
}

table.three_data_col th:nth-last-child(-n+3) {
  text-align: center;
  width: 15%;
  font-size: larger;
}
table.three_data_col td:nth-last-child(-n+3) {
  text-align: center;
  width: 15%;
}

table.four_data_col th:nth-last-child(-n+4) {
  text-align: center;
  width: 15%;
  font-size: larger;
}
table.four_data_col td:nth-last-child(-n+4) {
  text-align: center;
  width: 15%;
}

h5 {
  margin-top: 10px !important;
  margin-left: 10px;
}

.arrow {
  border: solid var(--ir-text-secondary);
  border-width: 0 2px 2px 0;
  display: inline-block;
  padding: 2px;
  margin-left: 10px;
  margin-right: 5px;
}

.right {
  transform: rotate(-45deg);
  -webkit-transform: rotate(-45deg);
}

.left {
  transform: rotate(135deg);
  -webkit-transform: rotate(135deg);
}

.up {
  transform: rotate(-135deg);
  -webkit-transform: rotate(-135deg);
}

.down {
  transform: rotate(45deg);
  -webkit-transform: rotate(45deg);
}

/* Podium Styles */

.podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  margin-bottom: 30px;
  height: 300px; /* Increased height */
}

.podium-position {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 15px; /* Increased margin */
  transition: transform 0.3s ease;
}

.podium-position:hover {
  transform: translateY(-7px); /* Slightly larger hover effect */
}

.first-place {
  z-index: 3;
  margin-top: -50px; /* Increased top margin */
}

.second-place {
  z-index: 2;
}

.third-place {
  z-index: 1;
}

.driver-avatar {
  width: 100px; /* Increased size */
  height: 100px; /* Increased size */
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 15px; /* Increased margin */
  border: 4px solid #fff; /* Thicker border */
  box-shadow: 0 3px 12px rgba(0,0,0,0.25); /* Enhanced shadow */
}

.first-place .driver-avatar {
  width: 125px; /* Increased size */
  height: 125px; /* Increased size */
  background: linear-gradient(135deg, #ffdf00, #daa520);
}

.second-place .driver-avatar {
  background: linear-gradient(135deg, #c0c0c0, #e0e0e0);
}

.third-place .driver-avatar {
  background: linear-gradient(135deg, #cd7f32, #b87333);
}

.position-number {
  font-size: 30px; /* Increased from 24px */
  font-weight: bold;
  color: #fff;
  text-shadow: 2px 2px 3px rgba(0,0,0,0.8); /* Enhanced shadow */
}

.first-place .position-number {
  font-size: 40px; /* Increased from 32px */
}

.driver-info {
  text-align: center;
  background: var(--ir-bg-deep);
  color: var(--ir-text-primary);
  padding: 14px; /* Increased padding */
  border-radius: 10px; /* Increased radius */
  border: 1px solid var(--ir-border-slate);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5); /* Enhanced shadow */
  min-width: 180px; /* Increased width */
}

.driver-name {
  font-weight: bold;
  font-size: 20px; /* Increased from 16px */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.first-place .driver-name {
  font-size: 22px; /* Increased from 18px */
}

.points {
  font-weight: bold;
  color: var(--ir-accent-teal);
  font-size: 20px; /* Increased from 16px */
}

.first-place .points {
  color: #daa520;
  font-size: 22px; /* Increased from 18px */
}

.second-place .points {
  color: #a0a0a0;
}

.third-place .points {
  color: #cd7f32;
}

/* Small Podium Styles - Updated to use full width */
.small-podium .driver-avatar {
  width: 60px; /* Increased size */
  height: 60px; /* Increased size */
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 5px; /* Increased margin */
  border: 2px solid #fff; /* Thicker border */
  box-shadow: 0 3px 12px rgba(0,0,0,0.25); /* Enhanced shadow */
}

.small-podium  .first-place .driver-avatar {
  width: 80px; /* Increased size */
  height: 80px; /* Increased size */
  background: linear-gradient(135deg, #ffdf00, #daa520);
}

.podium.small-podium {
  display: flex;
  justify-content: space-between; /* Changed from center to space-between */
  margin-bottom: 0px;
  margin-top: 0px;
  margin-left: 0px;
  margin-right: 0px;
  height: 180px;
  max-height: 180px;
  width: 100%; /* Added to ensure full width is used */
  padding: 0 10px; /* Add some padding on the sides */
}

.small-podium .podium-position {
  margin: 0; /* Removed side margins */
  text-align: center;
  color: var(--ir-text-primary);
  font-family: 'Roboto', sans-serif;
  position: relative;
  flex: 1; /* Added flex grow to distribute space evenly */
  max-width: 32%; /* Limit maximum width to prevent excessive stretching */
}

.small-podium .first-place {
  order: 2;
  margin-bottom: 0;
  z-index: 3;
  width: 130px;
  margin-top: -20px; /* Increased top margin */
}

.small-podium .second-place {
  order: 1;
  margin-top: 15px;
  z-index: 2;
  width: 120px;
}

.small-podium .third-place {
  order: 3;
  margin-top: 30px;
  z-index: 1;
  width: 120px;
}

.small-podium .driver-info {
  padding: 5px;
  border-radius: 5px;
  border: 1px solid var(--ir-border-slate);
  box-shadow: 0 3px 8px rgba(0,0,0,0.4);
  width: 100%; /* Use full width available */
  max-width: 100%; /* Ensure content doesn't overflow */
}

.small-podium .driver-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%; /* Ensure the text doesn't overflow */
}

.small-podium .first-place .driver-name {
  font-size: 18px; /* Increased from 18px */
}

.small-podium .points {
  font-weight: bold;
  color: var(--ir-accent-teal);
  font-size: 14px; /* Increased from 16px */
}

.small-podium .first-place .points {
  color: #daa520;
  font-size: 16px; /* Increased from 18px */
}

/* Make podium responsive for medium screens */
@media (max-width: 991px) {
  .podium {
    height: 250px;
  }
  
  .driver-avatar {
    width: 80px;
    height: 80px;
  }
  
  .first-place .driver-avatar {
    width: 100px;
    height: 100px;
  }
  
  .driver-info {
    padding: 10px;
    min-width: 150px;
  }
  
  .driver-name {
    font-size: 18px;
  }
  
  .first-place .driver-name {
    font-size: 20px;
  }
}

/* Further adjust for small screens */
@media (max-width: 768px) {
  .podium {
    flex-direction: column;
    height: auto;
    align-items: center;
  }
  
  .podium-position {
    margin: 15px 0;
    width: 90%;
    max-width: 320px;
  }
  
  .first-place {
    order: 1;
    margin-top: 0;
  }
  
  .second-place {
    order: 2;
    margin-top: 0;
  }
  
  .third-place {
    order: 3;
    margin-top: 0;
  }
  
  .driver-avatar {
    width: 70px;
    height: 70px;
    margin-bottom: 10px;
  }
  
  .first-place .driver-avatar {
    width: 90px;
    height: 90px;
  }
  
  .driver-info {
    width: 100%;
  }
  
  /* Also adjust small podium for mobile */
  .podium.small-podium {
    flex-direction: column;
    height: auto;
    max-height: none;
    align-items: center;
  }
  
  .small-podium .podium-position {
    margin: 10px 0;
    width: 90%;
    max-width: 100%;
  }
  
  .small-podium .first-place,
  .small-podium .second-place,
  .small-podium .third-place {
    order: initial;
    margin-top: 0;
    width: 100%;
  }
  
  .small-podium .first-place {
    order: 1;
  }
  
  .small-podium .second-place {
    order: 2;
  }
  
  .small-podium .third-place {
    order: 3;
  }
}

/* Ensure very small screens still display properly */
@media (max-width: 480px) {
  .driver-name {
    font-size: 16px;
    max-width: 100%;
  }
  
  .first-place .driver-name {
    font-size: 18px;
  }
  
  .points {
    font-size: 16px;
  }
  
  .first-place .points {
    font-size: 18px;
  }
  
  .driver-info {
    min-width: 0;
    width: 100%;
  }
}

/* Car logo styling */
table td img[src^="/static/images/car_logos/"] {
  max-height: 30px;
  max-width: 60px;
  object-fit: contain;
  vertical-align: middle;
}

/* Center car logos in the table cell */
table.two_data_col td:nth-child(4),
table.three_data_col td:nth-child(5) {
  text-align: center;
}

/* Make car logo cells a reasonable width */
table.two_data_col th:nth-child(4),
table.three_data_col th:nth-child(5) {
  width: 60px;
}

/* Make tables responsive for mobile devices */
@media (max-width: 768px) {
  /* Make tables extend full width */
  .container-fluid {
    padding-right: 2px !important;
    padding-left: 2px !important;
  }

  .col-md-9.px-5 {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .table-container {
    overflow-x: auto;
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  .table {
    width: 100%;
    min-width: 100%;
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  .row {
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  /* Ensure series logos scale properly on mobile */
  img[src*="images-static.iracing.com/img/logos/series/"] {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Hide license, iRating badges and country flags on mobile to save space */
  table td span.driver-license,
  table td span.driver-irating,
  table td img.driver-flag {
    display: none !important;
  }

  /* Make driver ratings badges smaller on very small screens */
  table td span.driver-ratings-text {
    font-size: 0.75rem;
    padding: 1px 3px;
  }

  /* Give more space to driver names when badges are hidden */
  table td span.align-middle {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
  }

  /* Optimize column widths for 3-column mobile layout */
  table th:first-child,
  table td:first-child {
    width: 50px !important;
  }

  /* Constrain data columns to only what they need */
  table.one_data_col th:nth-last-child(1),
  table.one_data_col td:nth-last-child(1),
  table.two_data_col th:nth-last-child(1),
  table.two_data_col td:nth-last-child(1),
  table.three_data_col th:nth-last-child(1),
  table.three_data_col td:nth-last-child(1),
  table.four_data_col th:nth-last-child(1),
  table.four_data_col td:nth-last-child(1) {
    width: 60px !important;
  }

  /* Let driver name column take remaining space */
  table.one_display_name th:nth-child(3),
  table.one_display_name td:nth-child(3),
  table.team_drivers th:nth-child(3),
  table.team_drivers td:nth-child(3),
  table.team_drivers th:nth-child(4),
  table.team_drivers td:nth-child(4) {
    width: auto !important;
    max-width: none !important;
  }

  /* Hide intermediate data columns on mobile - keep only rightmost */
  /* For two_data_col tables: hide the second-to-last column */
  table.two_data_col th:nth-last-child(2),
  table.two_data_col td:nth-last-child(2) {
    display: none;
  }

  /* For three_data_col tables: hide the 2nd and 3rd from last columns */
  table.three_data_col th:nth-last-child(2),
  table.three_data_col td:nth-last-child(2),
  table.three_data_col th:nth-last-child(3),
  table.three_data_col td:nth-last-child(3) {
    display: none;
  }

  /* For four_data_col tables: hide the 2nd, 3rd, and 4th from last columns */
  table.four_data_col th:nth-last-child(2),
  table.four_data_col td:nth-last-child(2),
  table.four_data_col th:nth-last-child(3),
  table.four_data_col td:nth-last-child(3),
  table.four_data_col th:nth-last-child(4),
  table.four_data_col td:nth-last-child(4) {
    display: none;
  }

  /* Reduce padding for more compact tables */
  table.table-sm td {
    padding: 4px 2px;
  }

  /* Ensure text doesn't wrap unnecessarily */
  table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 480px) {
  /* Further reduce padding for very small screens */
  table.table-sm td {
    padding: 4px 2px;
  }
  
  .driver-ratings-text {
    display: none !important;
  }

  .col-md-9.px-5 {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }  

  .row {
    margin-right: 0 !important;
    margin-left: 0 !important;  
  }
}

/* Add styles for the driver license badges in tables */
.rounded-md {
  border-radius: 0.375rem;
}

.border {
  border-width: 1px;
}

.text-center {
  text-align: center;
}

.font-roboto {
  font-family: 'Roboto', sans-serif;
}

.bg-white {
  background-color: white;
  color: black;
}

.text-4xl {
  font-size: 2.25rem;
  line-height: 2.5rem;
}

.align-middle {
  vertical-align: middle;
}

.overflow-hidden {
  overflow: hidden;
}

/* Make table cells with driver info taller to accommodate badges */
table.one_display_name td:nth-child(3),
table.team_drivers td:nth-child(3) {
  min-height: 40px;
  padding-top: 5px;
  padding-bottom: 5px;
}

/* Adjust spacing for SR and iRating badges when side by side */
table td span.rounded-md {
  display: inline-block;
  margin-right: 5px;
}

/* Ensure driver name is properly aligned with badges */
table td span.align-middle {
  display: inline-block;
  margin-left: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 100px); /* Reserve space for badges */
}

/* Make sure table rows with badges have enough height */
table.table-sm tr {
  min-height: 40px;
}

/* Styling for driver ratings text badges */
.driver-ratings-text, .driver-irating, .driver-license {
  font-size: 14px;
  font-family: 'Roboto', sans-serif;
  border-radius: 6px;
  border: 1px solid #334155;
  padding-left: 4px;
  padding-right: 4px;
  padding-top: 2px;
  padding-bottom: 2px;
  display: inline-block;
  text-align: center;
  min-width: auto;
  margin-right: 2px;
  font-weight: 400;
  line-height: 1.2;
}

.irating-bubble {
  background-color: white;
  color: black;
  border: 1px solid #334155;
  font-weight: 400;
  min-width: 4.2em;
  text-align: right;
}

/* Import Roboto font if not already included */
@font-face {
  font-family: 'Roboto';
  src: url('../fonts/roboto-v27-latin-regular.woff2') format('woff2'),
       url('../fonts/roboto-v27-latin-regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
