/* Google Fonts - Poppins */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

body {
   display: flex;
  flex-direction: column;
  margin: 0;
  background: #ffffff;
  color: #333;
  min-height: 100vh;
}

/* Header */
nav {
  position: fixed;
  top: 0;
  left: 0;
  height: 70px;
  width: 100%;
  display: flex;
  align-items: center;
  background: #ffffff;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12); /* More pronounced shadow */
  z-index: 100;
}

nav .logo {
  display: flex;
  align-items: center;
  margin: 0 24px;
}

.logo .menu-icon {
  color: #333;
  font-size: 24px;
  margin-right: 14px;
  cursor: pointer;
}

.logo .logo-name {
  color: #333;
  font-size: 22px;
  font-weight: 600;
}

/* Sidebar */
nav .sidebar {
  position: fixed;
  top: 0;
  left: -100%;
  height: 100%;
  width: 260px;
  padding: 20px 0;
  background-color: #f0f5ff; /* Slight blue tint */
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
  transition: all 0.4s ease;
  z-index: 99;
}

nav.open .sidebar {
  left: 0;
}

.sidebar .sidebar-content {
  display: flex;
  height: 100%;
  flex-direction: column;
  justify-content: space-between;
  padding: 30px 16px;
}

.sidebar-content .list {
  list-style: none;
}

.list .nav-link {
  display: flex;
  align-items: center;
  margin: 8px 0;
  padding: 14px 12px;
  text-decoration: none;
  transition: background 0.3s;
}

.lists .nav-link:hover {
  background-color: #4070f4;
}

.nav-link .icon {
  margin-right: 14px;
  font-size: 20px;
  color: #707070;
}

.nav-link .link {
  font-size: 16px;
  color: #707070;
  font-weight: 400;
}

.lists .nav-link:hover .icon,
.lists .nav-link:hover .link {
  color: #fff;
}

.bottom-content .nav-link {
  color: #555;
}

/* Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: -100%;
  height: 1000vh;
  width: 200%;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s ease;
  background: rgba(0, 0, 0, 0.3);
}
nav.open ~ .overlay {
  opacity: 1;
  left: 260px;
  pointer-events: auto;
}

/* Make main content take all remaining space */
main.content {
  flex: 1; /* expands to fill space above footer */
  padding: 100px 40px;
  width: 95%;
  margin: auto;
}

.content h1 {
  font-size: 32px;
  margin-bottom: 10px;
}

.content p {
  color: #555;
  margin-bottom: 40px;
}

/* Active navigation link */
.nav-link.active {
  background-color: #4070f4;
}

.nav-link.active .icon,
.nav-link.active .link {
  color: #fff;
}

/* === Year Selector (Floating Material Style) === */
.year-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 25px 0 35px 0;
}

/* Floating circular buttons */
.year-btn {
  background: #ffffff;
  color: #1a73e8; /* Google blue tone */
  border: none;
  width: 50px;
  height: 50px;
  font-size: 1.6rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
}

.year-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
  background: #f8f9fa;
}

.year-btn:active {
  transform: scale(0.95);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Year dropdown matches the clean look */
.year-dropdown {
  appearance: none;
  background: #ffffff;
  color: #1a73e8;
  border: 2px solid #1a73e8;
  padding: 10px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  outline: none;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.year-dropdown:hover,
.year-dropdown:focus {
  background: #f0f6ff;
  box-shadow: 0 6px 12px rgba(26, 115, 232, 0.3);
}

/* Responsive */
@media (max-width: 600px) {
  .year-selector {
    flex-direction: column;
    gap: 12px;
  }

  .year-btn {
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
  }

  .year-dropdown {
    width: 100%;
    max-width: 220px;
  }
}

/* Table wrapper for scroll if needed */
.table-wrapper {
  overflow-x: auto;
  margin-top: 20px;
}

/* Points Table */
.points-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Arial', sans-serif;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.points-table thead {
  background: #696969;
  color: #fff;
  text-align: center;
}

.points-table-head th {
  background-size:  60% auto;     /* ensures full flag is visible */
  background-repeat: no-repeat; /* prevents tiling */
  background-position: center;  /* centers the flag inside the cell */
}

.points-table th,
.points-table td {
  padding: 10px 12px;
  text-align: center;
  font-size: 14px;
  border-bottom: 1px solid #ddd;
}

.points-table tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

/* Highlights */
.first-place {
  background-color: #FFFFBF; /* Gold */
  font-weight: bold;
}
.second-place {
  background-color: #DFDFDF; /* Silver */
  font-weight: bold;
}
.third-place {
  background-color: #FFDF9F; /* Bronze */
  font-weight: bold;
}
.points-finisher {
  background-color: #DFFFDF; /* Light green for points */
}
.no-classification {
  background-color: #EFCFFF; /* Light red for DNF/DNS */
}
.no-points {
  background-color: #f0f0f033; /* Grey for zero points */
}

/* Responsive for smaller screens */
@media screen and (max-width: 900px) {
  .points-table th,
  .points-table td {
    padding: 8px 6px;
    font-size: 12px;
  }
}

@media screen and (max-width: 600px) {
  .points-table {
    font-size: 11px;
  }
  .points-table thead {
    display: none;
  }
  .points-table tbody td {
    display: block;
    text-align: right;
    padding-left: 50%;
    position: relative;
  }
  .points-table tbody td::before {
    content: attr(data-label);
    position: absolute;
    left: 15px;
    width: 45%;
    text-align: left;
    font-weight: bold;
  }
}

/* Scrollbar styling (optional) */
.table-wrapper::-webkit-scrollbar {
  height: 8px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: #ccc;
}

/* Footer Styling */
footer {
  background-color: #333;
  color: #fff;
  padding: 20px;
  text-align: center;
  position: relative;
  width: 100%;
  margin-top: auto; /* This ensures footer sticks to the bottom */
}

/* Subheader styling */
.subheader {
  position: sticky;       /* stays below nav when scrolling */
  top: 70px;              /* same as nav height */
  display: flex;
  justify-content: flex-start; /* align left */
  align-items: center;
  gap: 32px;
  padding: 12px 20px;
  background-color: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  z-index: 99;
}

/* Each item in subheader */
.subheader-item {
  flex-direction: row;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

/* Labels */
.subheader-item label {
  font-weight: 500;
  color: #333;
  font-size: 14px;
  white-space: nowrap; /* prevent label from wrapping */
}

/* White dropdowns with black text */
.subheader-item select {
  appearance: none;
  background: #ffffff;    /* white background */
  color: #333;         /* black text */
  border: 2px solid #333; /* subtle dark border */
  padding: 6px 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease-in-out;
}

.subheader-item select:hover,
.subheader-item select:focus {
  background: #f0f0f0;    /* light gray on hover/focus */
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.year-dropdown-grid-wrapper {
  position: relative;
  display: inline-block;
}

.year-dropdown-btn {
  background: white;
  color: #333;
  border: 2px solid #333;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
  min-width: 100px;
}

.year-grid {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid #333;
  display: grid;
  grid-template-columns: repeat(6, 1fr); /* number of columns */
  gap: 4px;
  overflow-y: auto;
  margin-top: 4px;
  z-index: 100;
}

.year-grid > button {
  border: none !important;
  box-shadow: none !important;
}

.year-grid button {
  background: white;
  border: none;       /* remove any border */
  border-radius: 0;   /* optional: remove any rounding if you want */
  padding: 6px 4px;   /* keep or adjust padding */
  cursor: pointer;
  font-weight: 500;
}

.year-grid button:hover {
  background: #1a73e8;
  color: white;
}

.hidden {
  display: none;
}

/* Responsive */
@media (max-width: 600px) {
  .subheader {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }
  
  .subheader-item select {
    width: 140px;
  }
}

/* Dark Mode Toggle Button in Subheader */
.subheader-item .dark-toggle {
  background: white;            /* same as dropdown */
  color: black;                 /* same text color */
  border: 2px solid #1a73e8;   /* same accent border */
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease-in-out;
  min-width: 50px;
}

/* Hover and focus effect */
.subheader-item .dark-toggle:hover,
.subheader-item .dark-toggle:focus {
  background: #f0f6ff; /* light hover effect same as other buttons */
  box-shadow: 0 4px 10px rgba(26, 115, 232, 0.3);
}

/* Icon inside toggle button */
.subheader-item .dark-toggle i {
  font-size: 1.2rem; /* slightly smaller to fit neatly */
}

/* === Dark Mode === */
body.dark-mode {
  background-color: #000000; /* page background black */
  color: #ffffff;           /* default text white */
}

body.dark-mode nav {
  background-color: #111;   /* darker nav */
  box-shadow: 0 6px 15px rgba(255, 165, 0, 0.2); /* subtle orange shadow */
}

body.dark-mode nav .logo .logo-name,
body.dark-mode nav .menu-icon {
  color: #FFA500; /* orange accent */
}

body.dark-mode .sidebar {
  background-color: #111; /* dark sidebar */
  box-shadow: 2px 0 8px rgba(255, 165, 0, 0.3);
}

body.dark-mode .sidebar .nav-link,
body.dark-mode .sidebar .nav-link .link,
body.dark-mode .sidebar .nav-link .icon {
  color: #FFA500; /* orange links */
}

body.dark-mode .sidebar .nav-link.active,
body.dark-mode .sidebar .nav-link:hover {
  background-color: #FFA500;
}

body.dark-mode .sidebar .nav-link.active .link,
body.dark-mode .sidebar .nav-link.active .icon,
body.dark-mode .sidebar .nav-link:hover .link,
body.dark-mode .sidebar .nav-link:hover .icon {
  color: #000; /* black text on orange background */
}

/* Content areas */
body.dark-mode main.content,
body.dark-mode .landing-container,
body.dark-mode .landing-left,
body.dark-mode .landing-right {
  background-color: #000; /* black background */
  color: #fff;           /* white text */
}

/* Buttons */
body.dark-mode .btn-primary,
body.dark-mode .landing-options a {
  background-color: #FFA500; /* orange buttons */
  color: #000;
}

body.dark-mode .btn-primary:hover,
body.dark-mode .landing-options a:hover {
  background-color: #e69500; /* darker orange on hover */
  color: #000;
}

/* Tables (if any) */
body.dark-mode .points-table,
body.dark-mode .calendar-table {
  background-color: #111;
  color: #FFA500;
  border-color: #FFA500;
}

body.dark-mode .points-table th,
body.dark-mode .calendar-table th {
  background-color: #222;
}

/* Footer */
body.dark-mode footer {
  background-color: #111;
  color: #FFA500;
}

/* Inputs / dropdowns */
body.dark-mode select,
body.dark-mode .year-dropdown-btn {
  background-color: #000;
  color: #FFA500;
  border: 2px solid #FFA500;
}

body.dark-mode select:hover,
body.dark-mode select:focus,
body.dark-mode .year-dropdown-btn:hover {
  background-color: #111;
  box-shadow: 0 4px 10px rgba(255, 165, 0, 0.3);
}

/* Sidebar Dropdown */
.sidebar-dropdown .dropdown-menu {
  display: none;       /* hidden by default */
  list-style: none;
  padding-left: 20px;  /* indent submenu */
  margin: 5px 0 0 0;
}

.sidebar-dropdown .dropdown-menu li a {
  display: block;
  padding: 8px 12px;
  font-size: 14px;
  color: #707070;
  text-decoration: none;
  transition: background 0.2s;
}

.sidebar-dropdown .dropdown-menu li a:hover {
  background-color: #4070f4; /* same hover as sidebar links */
  color: #fff;
}

.sidebar-dropdown.open .dropdown-menu {
  display: block;
}

/* Rotate arrow when open */
.sidebar-dropdown.open .dropdown-icon {
  transform: rotate(180deg);
  transition: transform 0.3s ease;
}

.sidebar-dropdown .dropdown-icon {
  margin-left: auto;
  transition: transform 0.3s ease;
}

/* Match Add/Delete buttons to the profile <select> size */
.subheader-item button {
  background: #ffffff;
  color: #333;
  border: 2px solid #333;

  /* Match select field */
  padding: 6px 12px;
  font-size: 1rem;
  font-weight: 600;

  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  height: 38px;            /* EXACT height of your <select> */
  display: flex;
  align-items: center;
}

/* Hover / active */
.subheader-item button:hover {
  background: #f0f0f0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.subheader-item button:active {
  transform: scale(0.97);
}

/* --- Dark Mode --- */
body.dark-mode .subheader-item button {
  background: #000;
  color: #FFA500;
  border: 2px solid #FFA500;
}

body.dark-mode .subheader-item button:hover {
  background: #111;
  box-shadow: 0 4px 10px rgba(255,165,0,0.3);
}


.dark-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px;
   margin-left: auto; /* pushes the div to the right */
}

/* Hide checkbox */
#darkModeToggle {
  display: none;
}

/* Toggle label */
.toggle-label {
  position: relative;
  width: 80px;
  height: 36px;
  background-color: #eee;
  border-radius: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0 5px;
  transition: background-color 0.3s;
  box-sizing: border-box;
}

/* Slider (circle) */
.toggle-label .slider {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 30px;
  height: 30px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  color: #333;
}

/* Text inside the toggle */
.slider-text {
  position: absolute;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 8px;
  font-size: 12px;
  font-weight: bold;
  pointer-events: none;
  color: #555;
}

/* Checked state */
#darkModeToggle:checked + .toggle-label {
  background-color: #333;
}

#darkModeToggle:checked + .toggle-label .slider {
  transform: translateX(44px);
  color: #fff;
}

.legend {
  display: flex;            /* Arrange children horizontally */
  flex-wrap: wrap;          /* Allow wrapping if screen is too narrow */
  gap: 20px;                /* Space between items */
  align-items: center;      /* Vertically center badges and text */
}

.legend-row {
  display: flex;
  align-items: center;      /* Align badge and text */
  gap: 5px;                 /* Space between badge and text */
  white-space: nowrap;      /* Prevent text from breaking lines */
}

.legend-badge {
  width: 15px;
  height: 15px;
  display: inline-block;
  border-radius: 3px;
}

.gold { background: #FFFFBF; }
.silver { background: #DFDFDF; }
.purple { background: #CFCFFF; }
.red { background: #EFCFFF; }
.bronze { background: #FFDF9F; }
.green { background: #DFFFDF; }

.legend-container {
  margin: 20px 0;
  width: 100%;
}

.legend-toggle {
  width: 100%;
  background: #f4f4f4;
  border: 1px solid #ccc;
  padding: 12px 15px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 6px;
  transition: background 0.3s ease;
}

.legend-toggle:hover {
  background: #e9e9e9;
}

.legend-toggle i {
  transition: transform 0.3s ease;
}

.legend-toggle.active i {
  transform: rotate(180deg);
}

.legend-content {
  background: #fafafa;
  border: 1px solid #ccc;
  border-top: none;
  padding: 15px;
  border-radius: 0 0 6px 6px;
}

.hidden {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
  z-index: 900;
  opacity: 1;
}

/* Light mode modal */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
  color: #333;
  min-width: 340px;
  padding: 22px 26px;
  border-radius: 16px;          /* roundness matching buttons */
  z-index: 901;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  font-family: "Poppins", sans-serif;
  animation: popup 0.18s ease-out;
}

@keyframes popup {
  from { transform: translate(-50%, -48%) scale(0.95); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.modal-header {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.modal-body {
  margin-bottom: 22px;
  font-size: 1rem;
  color: #444;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Buttons matching your subheader style */
.modal button {
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  border: 2px solid #333;
  background: #fff;
  color: #333;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.modal button:hover {
  background: #f0f0f0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.modal .btn-ok {
  background: #1a73e8;
  color: white;
  border-color: #1a73e8;
}

.modal .btn-ok:hover {
  background: #1669d8;
  box-shadow: 0 4px 12px rgba(26,115,232,0.3);
}

/* Cancel button */
.modal .btn-cancel {
  background: #fff;
  color: #333;
  border-color: #333;
}

/* === Dark Mode === */
body.dark-mode .modal {
  background: #000;
  color: #FFA500;
  border: 1px solid #FFA500;
  box-shadow: 0 8px 24px rgba(255,165,0,0.25);
}

body.dark-mode .modal-body {
  color: #FFA500;
}

body.dark-mode .modal button {
  background: #000;
  color: #FFA500;
  border: 2px solid #FFA500;
}

body.dark-mode .modal button:hover {
  background: #111;
  box-shadow: 0 4px 12px rgba(255,165,0,0.3);
}

body.dark-mode .modal .btn-ok {
  background: #FFA500;
  color: #000;
  border-color: #FFA500;
}

body.dark-mode .modal .btn-ok:hover {
  background: #e69500;
}

 /* Calendar Table */
.calendar-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  font-family: 'Arial', sans-serif;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  border-radius: 10px;
  overflow: hidden;
}

.calendar-table thead {
  background: #696969;
  color: white;
}

.calendar-table th,
.calendar-table td {
  padding: 12px 15px;
  text-align: center;
  font-size: 14px;
}

.calendar-table tbody tr {
  background-color: #f9f9f9;
  transition: background-color 0.3s, transform 0.2s;
}

.calendar-table tbody tr:nth-child(even) {
  background-color: #eaeaea;
}

.calendar-table th:first-child,
.calendar-table td:first-child {
  width: 50px;
}

.calendar-table th:nth-child(2),
.calendar-table td:nth-child(2) {
  text-align: left;
}

.calendar-table th,
.calendar-table td {
  border-bottom: 1px solid #ddd;
}

/* Responsive for smaller screens */
@media screen and (max-width: 900px) {
  .calendar-table th,
  .calendar-table td {
    padding: 10px 8px;
    font-size: 12px;
  }
}

@media screen and (max-width: 600px) {
  .calendar-table {
    font-size: 11px;
  }
  .calendar-table th,
  .calendar-table td {
    padding: 8px 5px;
  }
  .calendar-table thead {
    display: none;
  }
  .calendar-table tbody td {
    display: block;
    text-align: right;
    padding-left: 50%;
    position: relative;
  }
  .calendar-table tbody td::before {
    content: attr(data-label);
    position: absolute;
    left: 15px;
    width: 45%;
    text-align: left;
    font-weight: bold;
  }
}