/*
 * REVISED FOR BOOTSTRAP 5
 * Unnecessary or outdated Bootstrap 3 overrides have been removed or commented out.
 * Your custom component styles (events, tooltips, etc.) have been kept as they don't conflict.
*/


/* --- General Layout & Body --- */

/* This is still needed to push content down below your .fixed-top navbar.
   You may need to adjust the value if your navbar height changes. */
body {
  padding-top: 40px;
  /* Increased slightly for a common BS5 navbar height */
  /* If you implement a sticky footer using flexbox, you may add more styles here */
}

h2 {
  font-weight: bold;
}

/* --- Navbar & Header --- */

.top-container {
  padding-left: 50px;
  padding-right: 50px;
}

.navbar-top {
  border-bottom: none;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  /* A more modern shadow effect */
  /* NOTE: You can also use Bootstrap's built-in shadow classes like `.shadow-sm`
       directly on the navbar element in your HTML for a similar effect. */
}

/*
 * Navbar Logo Size
*/
.navbar-brand {
  width: 107px;
  height: 70px;
  display: inline-block;
  margin-bottom: -70px;
  /* Be careful with large negative margins. */
}

.navbar-brand img {
  width: auto;
  height: 90px;
  margin-top: -38px;
  margin-left: -20px;
}

/*
 * Dark Mode Logo Swap
*/

/* By default, hide the dark logo */
.logo-dark {
  display: none;
}

.logo-light {
  display: block;
}

/* When dark mode is active, hide the light logo and show the dark one */
[data-bs-theme="dark"] .logo-dark {
  display: block;
}

[data-bs-theme="dark"] .logo-light {
  display: none;
}

.navbar.bg-light {
  background-color: white !important;
  /* Overriding BS5's default .bg-light */
}

.navbar .navbar-nav .nav-link {
  color: black;
  font-size: 18px;
}

[data-bs-theme="dark"] .navbar .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.65);
  /* A slightly muted white, Bootstrap's default */
}

[data-bs-theme="dark"] .navbar .navbar-nav .nav-link:hover {
  color: #fff;
  /* Full white on hover */
}

/* Optional: To make the entire navbar even shorter, you can reduce its padding. */
.navbar {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  background-color: #f8f9fa;
  /* Bootstrap's light color */
  border-bottom: 1px solid #dee2e6;
}

[data-bs-theme="dark"] .navbar {
  background-color: #212529;
  /* Bootstrap's dark color */
  border-bottom: 1px solid #343a40;
}

/*
 * Mobile Navbar Fix
 * Adds a top margin to the expanded menu on small screens
 * to prevent it from being overlapped by the site logo.
*/
@media (max-width: 991.98px) {
  .navbar-collapse {
    margin-top: 20px;
    /* This creates the space. Adjust this value as needed. */
    border-bottom: 1px solid #dee2e6;
    /* Adds a clean bottom border */
  }
}

/* --- Registered runners grouping --- */
/* Visual Banding for Teams */

/* 1. REMOVE HORIZONTAL LINES */
/* Use 'hidden' instead of 'none'. 'Hidden' overrides the bottom border of the previous row. */
tr.same-group td {
  border-top: hidden !important;
}

/* 2. Hide repeated bib numbers completely for a cleaner look */
tr.same-group td.bib-cell {
  color: transparent;
  /* Keeps the text selectable but invisible */
  user-select: none;
}

/* Hide repeated race names. */
tr.same-group td.race-name-cell {
  color: transparent;
  /* Keeps the text selectable but invisible */
  user-select: none;
}

/* Hide repeated Team Names */
tr.same-group td.team-name-cell {
  color: transparent;
  /* Hides the text but keeps the layout/width stable */
  user-select: none;
  /* Optional: prevents user from selecting the invisible text */
}

/* Hide repeated Invoice. */
tr.same-group td.invoice-cell {
  color: transparent;
  user-select: none;
}

/* --- General Utilities & Custom Components (SAFE) --- */
/* The following styles are custom to your site and do not clash with Bootstrap 5. They are safe to keep. */

a[href^="http://"]:not(.btn),
a[href^="https://"]:not(.btn),
a[href^="mailto:"]:not(.btn) {
  background: url("../img/external-link-10.f31a95bdda13.png") center right no-repeat;
  padding-right: 13px;
}

.black_text {
  color: black;
  font-weight: bold;
}

.copyright-text {
  color: black;
  vertical-align: middle;
  padding-top: 14px;
}

img.diploma {
  border: 5px solid black;
}

.events-title {
  border-bottom: 1px solid lightgray;
}

/* Event tiles styling */
.event-tile {
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  /* Use flexbox to control the inner layout */
  flex-direction: column;
  /* Stack image and content vertically */
  height: 100%;
  /* Ensure tile fills its container (for grid layouts) */
  border-radius: 15px;
  overflow: hidden;
  /* Ensures the image and background don't poke out of the corners */
}

.event-tile:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.event-tile .card-img-top {
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background-color: transparent;
}

/* --- Frosted Glass Event Image Styles (NEW) --- */

.event-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  /* Forces the perfect square */
  overflow: hidden;
  /* Crops the blurred edges */
  background-color: #f0f0f0;
  /* Fallback color */
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* The Blurred Background */
.event-image-wrapper .blur-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Fills the square by cropping */
  filter: blur(20px) brightness(0.9);
  /* Heavy blur + slight dimming */
  transform: scale(1.15);
  /* Zoom to hide white edges from blur */
  z-index: 0;
}

/* The Sharp Foreground */
.event-image-wrapper .sharp-fg {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Ensures whole flyer is visible */
  z-index: 1;
  filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.3));
  /* Shadow for depth */
}

/* Dark mode overrides for the wrapper */
[data-bs-theme="dark"] .event-image-wrapper {
  background-color: #2b3035;
  border-bottom: 1px solid #495057;
}

/* ------------------------------------------- */


.event-tile .card-body {
  display: flex;
  flex-direction: column;
  /* Stack content inside the body */
  flex-grow: 1;
  /* Allow the body to grow and fill space */
}

.event-tile .card-title {
  font-size: 1.25rem;
  font-weight: bold;
}

.event-tile .card-text.event-tile-status {
  margin-top: auto;
  /* This pushes the status to the bottom */
  font-weight: bold;
}

/* Event list item styling (SAFE) */
/*
 * Flexbox Wrapping Grid for Event Tiles
*/
.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1rem;
  justify-content: center;
}

/*
 * Card Image Customization
 * Creates a square image container for event tiles.
*/
.card .card-img-top {
  width: 100%;
  /* Make the image container take the full width of the card */
  object-fit: contain;
  /* Scale image down to fit inside the square, without cropping */
  background-color: transparent;
  /* Optional: A light background for any empty space */
}

[data-bs-theme="dark"] .card {
  background-color: #2b3035;
  /* A slightly lighter dark gray than the body */
  color: #dee2e6;
  /* A light gray for text */
  border-color: #495057;
  /* A subtle border in dark mode */
}

/* For event titles within the card */
[data-bs-theme="dark"] .card .card-title {
  color: #f8f9fa;
  /* Ensure titles are bright white */
}

[data-bs-theme="dark"] .card .card-body {
  background-color: inherit;
  /* This makes it match the card's background */
}

/* For muted text (like dates, registration counts) within the card */
[data-bs-theme="dark"] .card .text-body-secondary {
  color: #adb5bd !important;
  /* Muted light gray for secondary text */
}

/* For the status text (Open/Closed) */
[data-bs-theme="dark"] .event-tile-status.text-success {
  color: #74b88f !important;
  /* A light green for success */
}

[data-bs-theme="dark"] .event-tile-status.text-danger {
  color: #ea868f !important;
  /* A light red for danger */
}

/* Dropzone styling (SAFE) */
div#gray-cover {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  /* Adjusted z-index */
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: table;
  text-shadow: 1px 1px 2px #000;
  color: #fff;
  font: bold 42px Oswald, DejaVu Sans, Tahoma, sans-serif;
}

div.gray-cover-text {
  display: table-cell;
  text-align: center;
  vertical-align: middle;
}

.event-cover-image-upload {
  max-width: 100%;
  /* Let the grid system control the size */
  border-radius: 10px;
}

.dropzone {
  border-radius: 10px;
}

.dz-message {
  font-size: 30px;
  font-weight: bold;
}

[data-bs-theme="dark"] .dropzone {
  background-color: var(--bs-dark-bg-subtle) !important;
  border-color: var(--bs-border-color) !important;
  color: var(--bs-body-color) !important;
}

/*
 * Dark Mode Fix for Dropzone.js Thumbnail Background
*/
[data-bs-theme="dark"] .dropzone .dz-preview .dz-image {
  border-radius: 0;
}

/* Custom tooltips (SAFE) */

/* Your custom modal styles (SAFE) */
.rc-modal-background {
  position: fixed;
  z-index: 1060;
  /* Position it just above BS5's backdrop z-index */
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.4);
}

.rc-modal-message {
  margin: 5px;
}

.rc-modal-messages-container {
  width: 100%;
  margin: 0 auto;
  top: 0;
  position: relative;
  overflow: auto;
  max-height: 100%;
  padding: 50px 25%;
}

/* --- Footer Link Styling --- */
.footer .nav-link {
  color: #212529;
  /* A standard dark gray, Bootstrap's default body text color */
  text-decoration: none;
  /* Removes the underline by default */
}

[data-bs-theme="dark"] .footer .nav-link {
  color: #adb5bd;
  /* A muted light gray */
}

.footer .nav-link:hover {
  color: #000;
  /* Makes the link black on hover */
  text-decoration: underline;
  /* Adds an underline on hover for clear feedback */
}

[data-bs-theme="dark"] .footer .nav-link:hover {
  color: #fff;
  /* White on hover */
}

/*
 * Fixed Navbar Anchor Link Fix
*/
.scroll-anchor {
  display: block;
  position: relative;
  top: -70px;
  /* This value should be a little MORE than your navbar's height */
  visibility: hidden;
}

.table-nowrap th,
.table-nowrap td {
  white-space: nowrap;
}

.table-wrap-text th,
.table-wrap-text td {
  white-space: normal !important;
}

/*
 * "To Top" Floating Button
*/
#toTopBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1030;
  /* Ensure it's above most content */
}

/*
 * PRINTING STYLES - leave at the end of the file
 * These styles make the print preview look good on a computer screen.
*/
.print-header {
  font-size: 20pt;
  font-weight: bold;
}

.print-row-header {
  font-size: 12pt;
  font-weight: bold;
}

.printable-table {
  margin-top: 5mm;
  border: 0.75mm solid black;
}

/* Main table border for screen */
.printable-table td,
.printable-table th {
  /* Cell borders for screen */
  border: 0.25mm solid black;
  padding: 5px;
  vertical-align: top;
}

.signature-box {
  border: 3px solid black;
}

.print-large {
  font-size: 26pt;
  font-weight: bold;
}

.print-row-header-strong {
  font-size: 18pt;
  font-weight: bold;
}

.print-small {
  font-size: 11pt;
}

.print-td-value {
  margin-left: 5px;
}

/* --- Payment Form Dark Mode Fix --- */
/* Forces payment slips to always look like paper (White bg, Black text) */
.payment-slip-fixed {
  background-color: #ffffff !important;
  color: #000000 !important;
  /* Ensure the container border is black */
  border-color: #000000 !important;
}

/* Force all inner elements to inherit black text and borders */
.payment-slip-fixed div,
.payment-slip-fixed span,
.payment-slip-fixed p,
.payment-slip-fixed strong,
.payment-slip-fixed b,
.payment-slip-fixed .box {
  color: #000000 !important;
  border-color: #000000 !important;
}



/* --- Fat Footer Styling --- */
.fat-footer {
  border-top: 1px solid #dee2e6;
  padding: 3rem 0;
  background-color: #ffffff;
}

[data-bs-theme="dark"] .fat-footer {
  background-color: #212529;
  border-top: 1px solid #343a40;
}

.fat-footer .footer-col {
  padding: 0 1.5rem;
}

.fat-footer h5 {
  font-weight: bold;
  margin-bottom: 1.5rem;
  color: #212529;
}

[data-bs-theme="dark"] .fat-footer h5 {
  color: #f8f9fa;
}

.fat-footer .nav-link {
  padding: 0.25rem 0;
  color: #6c757d;
}

[data-bs-theme="dark"] .fat-footer .nav-link {
  color: #adb5bd;
}

.fat-footer .nav-link:hover {
  color: #212529;
  text-decoration: underline !important;
}

[data-bs-theme="dark"] .fat-footer .nav-link:hover {
  color: #ffffff;
}

/* --- Brand Styles --- */
.footer-logo-container img {
  height: 70px;
  width: auto;
  margin-bottom: 1rem;
}

.footer-copyright {
  color: #6c757d;
  font-size: 0.9rem;
}

.swiss-made {
  font-size: 0.8rem;
  opacity: 0.8;
  cursor: help;
}

/* --- Partner Logos Recreated with CSS --- */
.partner-logo {
  display: flex;
  align-items: center;
  text-decoration: none !important;
  margin-bottom: 1.5rem;
  background: none !important;
  padding-right: 0 !important;
  cursor: help;
}

/* Hronometar Style */
.logo-hronometar {
  font-family: inherit;
  font-weight: 700;
  color: #000;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
}

[data-bs-theme="dark"] .logo-hronometar {
  color: #fff;
}

.stopwatch-icon {
  width: 32px;
  height: 32px;
  margin: 0 8px;
  position: relative;
  border: 3px solid #000;
  border-radius: 50%;
  background-color: #ff0000;
}

[data-bs-theme="dark"] .stopwatch-icon {
  border-color: #fff;
}

.stopwatch-icon::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 4px;
  background-color: #000;
}

[data-bs-theme="dark"] .stopwatch-icon::before {
  background-color: #fff;
}

.stopwatch-hand {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 10px;
  background-color: #000;
  transform-origin: bottom;
  transform: translate(-50%, -100%) rotate(45deg);
}

[data-bs-theme="dark"] .stopwatch-hand {
  background-color: #fff;
}

/* BibBuilder Style */
.logo-bibbuilder {
  font-family: Arial, sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
}

.bib-icon {
  display: inline-flex;
  flex-direction: column;
  width: 44px;
  height: 44px;
  background-color: #fdb913;
  /* Primary yellow */
  border-radius: 6px;
  margin-right: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.bib-icon-top {
  height: 8px;
  width: 100%;
}

.bib-icon-middle {
  background-color: #004a99;
  /* Deep blue band */
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
  text-align: center;
  width: 100%;
  padding: 1px 0;
  letter-spacing: 0.5px;
}

.bib-icon-bottom {
  color: #e02020;
  /* Bright red */
  background-color: #fdb913;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  width: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
}

.text-bib {
  color: #fdb913;
}

.text-builder {
  color: #ffffff;
}

[data-bs-theme="light"] .text-builder {
  color: #333333;
}

.cta-step small {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.65rem;
  opacity: 0.8;
}


/*
 * Print Styles (REVISED AGAIN FOR BOOTSTRAP 5)
 * These styles are only applied when the user prints the page.
*/

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm 8mm;
    /* Consistent margins */
  }

  .dashboard_content h1,
  .dashboard_content h2 {
    display: none !important;
  }

  /* --- General Reset for Print --- */
  body {
    padding-top: 0 !important;
    /* Force remove top padding */
    background: transparent !important;
    /* Ensure no background colors */
    font-size: 7pt !important;
    /* Smaller base font size for print */
    color: black !important;
    -webkit-print-color-adjust: exact;
    /* Ensure background colors are printed if used for design */
    print-color-adjust: exact;
  }

  /* Universal reset for elements that might introduce unwanted space or styling */
  * {
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transition: none !important;
    border-color: black !important;
    /* Ensure borders are black */
  }

  /* --- Hide Unwanted Elements --- */
  #sidebarMenu,
  footer.footer,
  nav[aria-label="breadcrumb"],
  #djDebug,
  .screen-only,
  .h2 {
    display: none !important;
  }

  /* --- Handle the Main Navbar and Logo --- */
  /* Only allow specific elements within the navbar to show */
  .navbar {
    min-height: auto !important;
    /* Remove min-height */
    padding: 0 !important;
    /* Remove padding */
    margin-bottom: 5mm !important;
    /* Add space below the logo */
  }

  .navbar-brand {
    display: block !important;
    /* Ensure brand is visible */
    text-align: left !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    /* Allow image to define height */
  }

  .navbar-brand img {
    max-height: 1.2cm !important;
    /* Smaller logo for print */
    width: auto !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Hide other navbar components */
  .navbar button,
  .navbar .navbar-toggler,
  .navbar .navbar-nav,
  .navbar .container-fluid>div:not(.navbar-brand),
  /* Hide other elements in navbar-fluid */
  .navbar .offcanvas {
    display: none !important;
  }

  /* --- Table Specific Print Styles --- */
  .printable-table {
    margin-top: 2mm !important;
    border: none !important;
    /* Remove outer table border if cell borders are active */
  }

  .printable-table table {
    width: 100% !important;
    /* Ensure table spans full width */
    border-collapse: collapse !important;
    /* Crucial for clean cell borders */
    /* Removed the table-level border as we're doing cell borders */
  }

  .printable-table td,
  .printable-table th {
    border: 0.25mm solid black !important;
    /* RE-ADDED: Cell borders for print */
    padding: 0.5mm !important;
    /* Reduced padding for more content */
    vertical-align: top !important;
    font-size: inherit !important;
    /* Inherit font size from body */
    line-height: 1.2 !important;
  }

  /* --- Adjust Print Content Font Sizing --- */
  /* Further reduction of font sizes to fit more on the page */
  .print-header {
    font-size: 10pt !important;
  }

  .print-row-header-strong {
    font-size: 9pt !important;
  }

  .print-row-header {
    font-size: 7pt !important;
  }

  .print-small {
    font-size: 6pt !important;
  }

  .print-large {
    font-size: 16pt !important;
  }

  /* --- Page Break Rules --- */
  .page_break {
    page-break-after: always !important;
    margin-top: 1cm !important;
    /* Add space between pages */
  }

  .no_page_break {
    page-break-inside: avoid !important;
  }
}