/* Ensure body/html allow footer to reach bottom */
html {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* Make navbar full width and teal */
.navbar {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  position: fixed !important;
  top: 0 !important;
  z-index: 1000 !important;
  background-color: #00796b !important;
  border-color: #00796b !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.navbar-default {
  margin-bottom: 0 !important;
  background-color: #00796b !important;
  border-color: #00796b !important;
}

/* Align navbar content with main content */
.navbar .container {
  width: 90% !important;
  max-width: 90% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 15px !important;
  padding-right: 15px !important;
}

/* Remove default Bootstrap navbar header padding */
.navbar-header {
  margin-left: 15px !important;
  margin-right: 15px !important;
}

/* Site header (Data Dribble) - larger and bold */
.navbar-default .navbar-brand {
  color: #ffffff !important;
  font-size: 22px !important;
  font-weight: bold !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
}

/* Nav items container */
.navbar-nav {
  margin-left: 0 !important;
}

.navbar-default .navbar-brand:hover {
  color: #e0f2f1 !important;
}

/* Other navbar items - smaller and not bold */
.navbar-default .navbar-nav > li > a {
  color: #ffffff !important;
  font-size: 16px !important;
  font-weight: normal !important;
}

.navbar-default .navbar-nav > li > a:hover {
  color: #e0f2f1 !important;
}

.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
  background-color: #00796b !important;
  color: #ffffff !important;
}

/* Search bar in navbar */
.navbar-search-form {
  position: relative;
  margin: 8px 15px;
  float: right;
}

.navbar-search-input {
  width: 250px;
  padding: 8px 35px 8px 12px;
  border: 1px solid #ffffff;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 14px;
  transition: all 0.3s ease;
}

.navbar-search-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.navbar-search-input:focus {
  outline: none;
  background-color: rgba(255, 255, 255, 0.3);
  width: 300px;
}

.navbar-search-button {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 5px 8px;
  font-size: 16px;
}

.navbar-search-button:hover {
  color: #e0f2f1;
}

/* Search suggestions dropdown */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: #ffffff;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: none;
  z-index: 1001;
}

.search-suggestions.active {
  display: block;
}

.search-suggestion-item {
  padding: 10px 12px;
  cursor: pointer;
  color: #333;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s;
}

.search-suggestion-item:hover,
.search-suggestion-item.active {
  background-color: #e0f2f1;
}

.search-suggestion-item:last-child {
  border-bottom: none;
}

.search-suggestion-type {
  font-size: 11px;
  color: #00796b;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 8px;
}

.search-no-results {
  padding: 10px 12px;
  color: #999;
  font-style: italic;
}

/* Style the YAML title section */
#header {
  width: 100vw;
  background-color: #004d40;
  color: #ffffff;
  padding: 15px 0;
  margin-top:-35px; /* Space for fixed navbar */
  margin-bottom: 20px;
  margin-left: 0;
  margin-right: 0;
  text-align: center;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  border-bottom: 3px solid #00796b;
}

#header h1.title {
  margin: 0;
  padding: 0;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #ffffff;
}

#header h4.author,
#header h4.date {
  display: none; /* Hide author and date */
}

/* If you have a subtitle in YAML */
#header .subtitle {
  margin-top: 5px;
  font-size: 14px;
  color: #e0f2f1;
  font-weight: normal;
}

/* Main container */
.main-container {
  flex: 1 0 auto;
  max-width: 90% !important;
  width: 90% !important;
  margin: 0 auto !important;
  padding: 20px;
  padding-top: 20px !important;
}

/* Layout containers */
.row-container {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  align-items: stretch;
  width: 100%;
}

.row-container-small {
  display: flex;
  gap: 20px;
  margin-bottom: 60px;
  margin-top: 0px;
  align-items: stretch;
  width: 100%;
  max-height: 150px;
}

.row-container-small-team {
  display: flex;
  gap: 20px;
  margin-bottom: 60px;
  margin-top: 0px;
  align-items: stretch;
  width: 100%;
  max-height: 100px;
}

.plot-container {
  flex: 1;
  min-width: 0;
}

.title-container {
  flex: 3;
}

.epi-container {
  flex: 1;
}

.table-container {
  width: 100%;
  margin-bottom: 30px;
}

.subtitle-container {
  width: 100%;
  margin-bottom: 0px;
}

.trajectory-container {
  width: 100%;
  margin-bottom: 30px;
  display: flex;
  justify-content: center;
}

.side-by-side {
  flex: 1;
  min-width: 0;
}

/* Headings */
h2 {
  color: #009688;
  font-weight: bold;
  margin-top: 30px;
  margin-bottom: 15px;
}

/* Footer styles */
.footer {
  width: 100vw;
  background-color: #00796b;
  color: #ffffff;
  padding: 20px 0;
  margin-top: 40px;
  margin-bottom: -70px;
  text-align: left;
  border-top: 3px solid #004d40;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.footer-column {
  min-width: 150px;
  margin-bottom: 20px;
}

.footer-column p {
  margin: 5px 0;
  font-size: 14px;
}

.footer-column p:first-child {
  font-weight: bold;
  margin-bottom: 10px;
}

.footer a {
  color: #e0f2f1;
  text-decoration: none;
  transition: color 0.2s;
}

.footer a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.footer-follow {
  display: flex;
  align-items: center;
  gap: 15px;
}

.footer-follow p {
  margin: 0;
  font-weight: bold;
  font-size: 14px;
}

.footer-follow img {
  vertical-align: middle;
  display: block;
}

/* Season Selector */
.season-selector {
  margin: -10px 0 25px 0;
}

.season-selector label {
  font-weight: 600;
  font-size: 16px;
  margin-right: 10px;
  color: #000000;
  font-family: 'Roboto', sans-serif;
}

.season-selector select {
  padding: 8px 12px;
  font-size: 16px;
  font-family: 'Roboto', sans-serif;
  border: 1px solid #00796b;
  border-radius: 4px;
  background-color: white;
  color: #000000;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.season-selector select:hover {
  border-color: #00695c;
}

.season-selector select:focus {
  outline: none;
  border-color: #00796b;
  box-shadow: 0 0 0 2px rgba(0, 121, 107, 0.1);
}

/* Player search on dashboard */
.player-search-container {
  margin: 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-search-container label {
  font-weight: 600;
  color: #00796b;
}

.player-search-input {
  padding: 8px 40px 8px 12px;
  border: 2px solid #00796b;
  border-radius: 4px;
  font-size: 14px;
  width: 400px;
  background-color: white;
}

.player-search-input:focus {
  outline: none;
  border-color: #00695c;
  box-shadow: 0 0 0 3px rgba(0, 121, 107, 0.1);
}

.player-search-button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #00796b;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.player-search-suggestions {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 2px solid #00796b;
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.player-search-suggestions.active {
  display: block;
}

.player-suggestion-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #e0f2f1;
  transition: background-color 0.2s;
}

.player-suggestion-item:hover,
.player-suggestion-item.active {
  background-color: #e0f2f1;
}

.player-suggestion-item:last-child {
  border-bottom: none;
}

.player-no-results {
  padding: 10px 12px;
  color: #666;
  font-style: italic;
}

.player-search-wrapper {
  position: relative;
  display: inline-block;
}

.desktop-only { display: block !important; }
.mobile-only { display: none !important; }

/* ===================================
   MOBILE RESPONSIVE STYLES
   =================================== */

/* Base responsive settings */
img {
  max-width: 100%;
  height: auto;
}

table {
  max-width: 100%;
}

/* Mobile styles - tablets and phones */
@media screen and (max-width: 768px) {
  
  /* ===== 1. SCALE DOWN TEXT AND OBJECTS ===== */
  body {
    font-size: 14px !important;
    padding: 0 !important;
  }
  
  .main-container {
    padding: 10px !important;
    padding-top: 80px !important; /* Account for fixed navbar */
    max-width: 100% !important;
    width: 100% !important;
  }
  
  h1 {
    font-size: 1.5em !important;
  }
  
  h2 {
    font-size: 1.8em !important;
    margin-top: 15px !important;
    margin-bottom: 8px !important;
  }
  
  h3 {
    font-size: 1.1em !important;
  }
  
  /* Header title */
  #header {
    margin-top: -10px !important; /* Space for fixed navbar on mobile */
    padding: 20px 10px !important;
    margin-bottom: 10px !important;
  }

  #header h1.title {
    font-size: 14px !important;
    padding: 0 !important;
    line-height: 1.3;
  }
  
  /* ===== 2. STACK ALL ROWS VERTICALLY ===== */
  
  /* Side-by-side containers become full width */
  .side-by-side {
    width: 100% !important;
    flex: none !important;
    margin-bottom: 0px;
  }
  
  /* Row containers stack items */
  .row-container {
    flex-direction: column !important;
    gap: 10px !important;
    margin-bottom: 5px !important;
  }
  
  /* Row container small - keep horizontal on mobile */
  .row-container-small {
    flex-direction: row !important; /* Keep horizontal on mobile */
    gap: 5px !important;
    max-height: none !important;
    margin-bottom: 0px !important;
  }
  
  .row-container-small .plot-container {
    flex: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
  
  .row-container-small .title-container {
    flex: 2 !important;
  }
  
  .row-container-small .epi-container {
    flex: 1 !important;
  }
  
  .row-container-small img,
  .row-container-small svg {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
  }
  
  /* Row container small team - keep horizontal on mobile */
  .row-container-small-team {
    flex-direction: row !important; /* Keep horizontal on mobile */
    gap: 5px !important;
    max-height: none !important;
    margin-bottom: 0px !important;
  }
  
  .row-container-small-team .plot-container {
    flex: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
  
  .row-container-small-team .title-container {
    flex: 2 !important;
  }
  
  .row-container-small-team .epi-container {
    flex: 1 !important;
  }
  
  .row-container-small-team img,
  .row-container-small-team svg {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
  }
  
  /* All plot containers full width */
  .plot-container {
    width: 100% !important;
    flex: none !important;
    margin: 0px 0 !important;
  }
  
  .title-container {
    width: 100% !important;
    flex: none !important;
    margin-left: 0 !important;
  }
  
  .epi-container {
    width: 100% !important;
    flex: none !important;
    margin-top: 0 !important;
  }
  
  /* Table containers */
  .table-container {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 5px !important;
    margin-top: 0px !important;
  }
  
  /* H2 headers inside table containers - more specific rule */
  .table-container h2 {
    font-size: 1.8em !important;
    margin-top: 0px !important;
    margin-bottom: 8px !important;
    padding-top: 0px !important;
  }
  
  /* Remove margin from any paragraph before h2 */
  .table-container p + h2,
  .table-container > h2:first-child {
    margin-top: 0px !important;
    padding-top: 0px !important;
  }
  
  /* Remove default paragraph spacing in table containers */
  .table-container > p {
    margin-top: 0px !important;
    margin-bottom: 0px !important;
  }
  
  /* Target R Markdown section divs (standalone headers outside containers) */
  .section.level2 {
    margin-top: 0px !important;
    margin-bottom: 5px !important;
    padding-top: 0px !important;
  }
  
  .section.level2 h2 {
    font-size: 1.8em !important;
    margin-top: 0px !important;
    margin-bottom: 8px !important;
    padding-top: 0px !important;
  }
  
  /* Remove spacing between sections */
  .section.level2 + .row-container,
  .section.level2 + .table-container {
    margin-top: 0px !important;
  }
  
  /* H2 headers OUTSIDE containers (standalone section headers) */
  .main-container > h2 {
    font-size: 1.8em !important;
    margin-top: 0px !important;
    margin-bottom: 8px !important;
    padding-top: 0px !important;
  }
  
  /* Remove margin from paragraphs before standalone h2 */
  .main-container > p + h2 {
    margin-top: 0px !important;
    padding-top: 0px !important;
  }
  
  /* Remove default paragraph spacing in main container */
  .main-container > p:empty {
    margin: 0px !important;
    padding: 0px !important;
    display: none !important;
  }
  
  /* Reduce margins on row containers that come after h2 */
  h2 + .row-container {
    margin-top: 5px !important;
  }
  
  /* Trajectory container */
  .trajectory-container {
    width: 100% !important;
    overflow-x: auto !important;
    margin-bottom: 0px;
  }
  
  /* ===== TABLES AND REACTABLE ===== */
  
  /* Regular HTML tables */
  table {
    font-size: 0.75em !important;
    min-width: 100%;
  }
  
  /* Reactable - comprehensive targeting */
  .reactable {
    font-size: 12px !important;
  }
  
  .reactable table {
    font-size: 12px !important;
  }
  
  .reactable * {
    font-size: 12px !important;
  }
  
  /* Reactable header cells */
  .reactable .rt-thead .rt-th,
  .reactable .rt-thead .rt-th-inner,
  .reactable .rt-th-group,
  .reactable .rt-th-group-inner {
    font-size: 12px !important;
    padding: 4px 3px !important;
  }
  
  /* Reactable body cells */
  .reactable .rt-tbody .rt-td,
  .reactable .rt-tbody .rt-td-inner,
  .reactable .rt-tr .rt-td {
    font-size: 12px !important;
    padding: 4px 3px !important;
  }
  
  /* Reactable row groups and other elements */
  .reactable .rt-tr-group,
  .reactable .rt-td-inner div,
  .reactable .rt-th-inner div {
    font-size: 12px !important;
  }
  
  .desktop-only { display: none !important; }
  .mobile-only { display: block !important; }
  
  /* ===== NAVBAR ADJUSTMENTS ===== */
  .navbar {
    position: fixed !important;
    overflow: visible !important; /* Allow dropdowns to spill out */
  }
  
  .navbar-collapse {
    overflow: visible !important; /* Allow dropdowns to spill out */
  }
  
  .navbar .container {
    width: 100% !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
  
  .navbar-default .navbar-brand {
    font-size: 23px !important;
  }
  
  .navbar-default .navbar-nav > li > a {
    font-size: 15px !important;
  }
  
  /* All navbar links including dropdowns */
  .navbar-default .navbar-nav > li > a,
  .navbar-default .navbar-nav .dropdown-menu > li > a {
    font-size: 15px !important;
  }
  
  /* Navbar search form */
  .navbar-search-form {
    margin: 8px 10px !important;
    width: calc(100% - 20px) !important;
    float: none !important;
    overflow: visible !important;
    position: relative !important;
  }
  
  .navbar-search-input {
    width: 100% !important;
    font-size: 16px !important;
  }
  
  .navbar-search-input:focus {
    width: 100% !important;
  }
  
  /* Position search suggestions below navbar */
  .search-suggestions {
  position: absolute !important;
  top: 100% !important; /* Position directly below the search input */
  left: 0 !important;
  right: 0 !important;
  z-index: 10000 !important;
  max-height: 300px !important;
  overflow-y: auto !important;
}
  
  /* ===== PLAYER SEARCH ===== */
  .player-search-container {
    flex-direction: column !important;
    align-items: flex-start !important;
    width: 100% !important;
    gap: 5px !important;
  }
  
  .player-search-wrapper {
    width: 100% !important;
  }
  
  .player-search-input {
    width: 100% !important;
    font-size: 16px !important; /* Prevents iOS zoom */
    padding: 10px 40px 10px 12px !important;
  }
  
  /* ===== SEASON SELECTOR ===== */
  .season-selector {
    width: 100% !important;
    margin: 5px 0 5px 0 !important;
  }
  
  .season-selector select {
    font-size: 16px !important; /* Prevents iOS zoom */
    padding: 10px !important;
    width: 100% !important;
    max-width: 200px;
  }
  
  /* ===== FOOTER ===== */
  .footer {
    padding: 15px 10px !important;
    margin-bottom: 0 !important;
  }
  
  .footer-column {
    min-width: 100% !important;
    margin-bottom: 15px;
  }
  
  .footer-column p {
    font-size: 13px !important;
  }
  
  .footer-follow {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }
  
  /* ===== GLOSSARY PAGES ===== */
  .glossary-section {
    padding: 10px 0 !important;
  }
  
  .glossary-section h2 {
    font-size: 1.4em !important;
  }
  
  .glossary-section h3 {
    font-size: 1.1em !important;
  }
  
  .glossary-item {
    margin-bottom: 12px;
    font-size: 0.95em;
    line-height: 1.5;
  }
  
  .intro-text {
    padding: 15px !important;
    margin: 10px 0 20px 0 !important;
    font-size: 0.95em;
  }
  
  /* ===== CHARTS AND SVG ===== */
  svg {
    max-width: 100% !important;
    height: auto !important;
  }
  
  /* Ensure ggplot/plotly charts are responsive */
  .trajectory-container svg,
  .trajectory-container img,
  .plot-container svg,
  .plot-container img {
    width: 100% !important;
    height: auto !important;
  }
}

/* ===== EXTRA SMALL PHONES ===== */
@media screen and (max-width: 480px) {
  body {
    font-size: 13px !important;
  }
  
  .main-container {
    padding: 5px !important;
    padding-top: 70px !important;
  }
  
  h1 {
    font-size: 1.3em !important;
  }
  
  h2 {
    font-size: 1.5em !important;
  }
  
  /* Regular tables */
  table {
    font-size: 0.65em !important;
  }
  
  /* Reactable tables even smaller on small phones */
  .reactable,
  .reactable *,
  .reactable table {
    font-size: 10px !important;
  }
  
  .navbar-default .navbar-brand {
    font-size: 20px !important;
  }
  
  .glossary-section h2 {
    font-size: 1.2em !important;
  }
  
  .intro-text {
    padding: 10px !important;
    font-size: 0.9em;
  }
  
  .season-selector select {
    font-size: 14px !important;
    padding: 8px !important;
  }
}

/* ===== DESKTOP - NO CHANGES ===== */
@media screen and (min-width: 769px) {
  /* Desktop keeps all original styles */
  /* This ensures computer experience doesn't change */
}