/* =============================
   Base Color & Theme Styles
   ============================= */
   :root {
    --bg-lightest: #ffffff;
    --bg-lighter: #f3f4f6;
    --bg-light: #ced0d3;
    --bg-medium: #374151;
    --bg-dark: #1e2a37;
    --bg-darker: #001731;
    --bg-darkest: #000000;

    --text-lightest: #ffffff;
    --text-light: #ced0d3;
    --text-muted: #a0aec0;
    --text-medium: #374151;
    --text-dark: #1e2a37;
    --text-darker: #001731;
    --text-darkest: #000000;

    --accent-primary: #f97317;
    --accent-secondary: #e5d954;
    --accent-tertiary: #00a2ff;
    --accent-orange: #f97317;
    --accent-yellow: #e5d954;
    --accent-blue: #00a2ff;

    --border-color: #4a5568;
    --border-light: #c0c0c0;
    --border-dark: #4a5568;

    --fm-green: #10b981;
    --fm-red: #ef4444;
    --fm-gray: #c0c0c0;
    --fm-orange: #f97317;
    --fm-yellow: #e5d954;
    --fm-blue: #00a2ff;
}

/* =============================
   Global New Sticker Styles
   ============================= */

    .new-sticker {
        position: absolute;
        left: -18px;
        top: -4px;
        background: #ffeb3b;
        color: #d7263d;
        font-size: 0.7rem;
        font-weight: bold;
        padding: 1px 4px;
        border-radius: 5px;
        transform: rotate(-15deg);
        z-index: 7;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    }

        .badge-wrapper .new-sticker {
        position: absolute;
        left: -18px;
        top: -4px;
        width: 30px;
        background: #ffeb3b;
        color: #d7263d;
        font-size: 10px;
        font-weight: bold;
        padding: 0px 2px;
        border-radius: 3px;
        transform: rotate(-15deg);
        z-index: 7;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    }



    
/* Fix font colors in form fields */
select, input, textarea, .form-control, option {
    color: var(--text-light);
    color: var(--text-dark);
}

/* Better Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-medium);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.racefont {
  font-display: swap;
}

.budget-indicator-sticky {
    position: sticky;
    top: 45px;
    z-index: 5;
    background-color: var(--bg-lighter);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 6px var(--bg-darkest);
    transition: all 0.3s ease;
  }

.svg {
    display: inline !important;
}
  
  /* Make driver/constructor cards 60% of height */
  .driver-card, .constructor-card {
    max-height: calc(60% * var(--original-height, 120px));
    overflow: hidden;
  }
  
  /* Improved team name styling */
  .team-name {
    font-size: 13px !important;
    font-weight: 600;
    color: black !important;
    /* text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3); */
  }
  
  /* Tooltip styles */
  .tooltip {
    position: relative;
    display: inline-block;
  }
  
  .tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: var(--bg-medium);
    color: var(--text-light);
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
  }
  
  .tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
  }

  /* Add these styles to your CSS file for better last 5 records display */

.last-five-record {
    display: flex;
    gap: 2px;
  }
  
  .last-five-item {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.8rem;
  }
  
  .last-five-win {
    background-color: rgba(16, 185, 129, 0.15);
    color: rgb(16, 185, 129);
  }
  
  .last-five-loss {
    background-color: rgba(239, 68, 68, 0.15);
    color: rgb(239, 68, 68);
  }
  
  .last-five-tie {
    background-color: rgba(107, 114, 128, 0.15);
    color: rgb(107, 114, 128);
  }
  
  .last-five-none {
    background-color: rgba(229, 231, 235, 0.5);
    color: rgb(156, 163, 175);
  }
  
  /* Optional animation for hovering over last 5 record */
  .last-five-item:hover {
    transform: scale(1.1);
    transition: transform 0.2s ease;
  }



/* Additional styling for the matchup cards */
.matchup-card {
  transition: all 0.3s ease;
}

.matchup-container .team-name {
  color: white;
}

.matchup-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.matchup-details {
  transition: all 0.3s ease;
  max-height: 0;
  overflow: hidden;
}

.matchup-details:not(.hidden) {
  max-height: 1000px;
  overflow: visible;
}

/* Animation for score reveal */
@keyframes scoreReveal {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.score-reveal {
  animation: scoreReveal 0.5s ease-out forwards;
}

/* Winner indicator styling */
.winner-indicator {
  background-color: #4CAF50;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: bold;
  display: inline-block;
  margin-top: 4px;
}

/* Team logos styling */
.team-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Team pic styling - 24x24 rounded-lg version */
.team-pic {
  width: 24px;
  height: 24px;
  border-radius: 0.5rem; /* rounded-lg */
  object-fit: cover;
}

/* TEAM MATCHUPS */
/* Ensure team names don't break layout on small screens */


@media (max-width: 480px) {
    .team-name {
        max-width: 80px;
    }
}

/* Make sure the carousel controls are properly sized on mobile */
#prev-matchup, #next-matchup {
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensure the matchup carousel behaves well on small screens */
#matchup-carousel {
    width: 100%;
    overflow-x: hidden;
}

#matchup-slider {
    width: 100%;
    display: flex;
}

.matchup-slide {
    width: 100%;
    flex-shrink: 0;
}

/* Improved touch targets for mobile */
.matchup-slide a {
    display: block;
    padding: 8px 0;
}

/* Fix for small screens */
@media (max-width: 640px) {
    .text-xs {
        font-size: 10px;
        row-gap: 14px;
    }
}





/* ===================================================
   Error Message Styling 
   =================================================== */
.error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9000;
}

.error-message {
    background-color: var(--bg-dark);
    border: 2px solid var(--accent-primary);
    padding: 20px;
    border-radius: 8px;
    max-width: 400px;
    text-align: center;
}

.error-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-primary);
    margin-bottom: 10px;
}

.error-content {
    color: var(--text-light);
    margin-bottom: 20px;
}

.error-button {
    background-color: var(--accent-primary);
    color: white;
    padding: 8px 20px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
}

/* ===================================================
   Fix player cards and add/remove buttons 
   =================================================== */
.driver-card, .constructor-card {
    transition: all 0.2s ease;
}

.driver-card:hover, .constructor-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.player-action-btn {
    min-width: 40px;
    text-align: center;
}

/* ===================================================
   Decimal formatting helper classes 
   =================================================== */
.decimal-1 {
    display: inline-block;
}

.decimal-1::after {
    content: attr(data-value);
}



/* Fix for mobile player selection */
@media (max-width: 768px) {
  .selected-driver-info.hidden,
  .selected-constructor-info.hidden {
    display: none !important;
  }
  
  .driver-slot .empty-slot:not(.hidden),
  .constructor-slot .empty-slot:not(.hidden) {
    display: block !important;
  }
}

/* ===================================================
   Race Schedule Table Styling
   =================================================== */

#schedule-section table {
    width: 100%;
    border-collapse: collapse; /* Use collapse for cleaner lines */
    margin-top: 1rem;
    background-color: var(--bg-darker, #0f1319); /* Dark background like mockup */
    color: var(--text-medium, #e2e8f0);
    border-spacing: 0; /* Remove default spacing */
}

#schedule-section th,
#schedule-section td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color, #4a5568); /* Separator lines */
    vertical-align: top; /* Align content to the top */
}

#schedule-section th {
    background-color: var(--bg-darker, #0f1319); /* Header background */
    font-weight: bold;
    color: var(--text-muted, #a0aec0); /* Muted header text */
    text-transform: uppercase; /* Uppercase headers */
    font-size: 0.9em;
    letter-spacing: 0.5px;
}

/* Remove bottom border from the last row */
#schedule-section tr:last-child td {
    border-bottom: none;
}


#schedule-section tr.past {
    opacity: 0.6; /* Dim past races */
}

#schedule-section tr.current-race-row {
    background-color: white; /* Highlight background */
    color: var(--bg-darker, #0f1319); /* Dark text on white background */
    font-weight: bold;
}

/* Style for the cell containing the round number and the vertical label */
#schedule-section td.round-cell {
    position: relative; /* Needed for absolute positioning of the indicator */
    width: 80px; /* Adjust width */
    font-size: 1.8rem; /* Larger round number */
    font-weight: bold;
    padding-left: 35px; /* Make space for the vertical text */
    vertical-align: middle; /* Center round number vertically */
    border-right: 1px solid var(--border-color, #4a5568); /* Vertical line after round */
}

/* Style for the vertical "CURRENT" label */
.current-race-indicator {
    position: absolute;
    left: 0px; /* Position at the left edge of the cell */
    top: 50%; /* Center vertically relative to the cell */
    transform: translateY(-50%) rotate(-90deg); /* Rotate and center */
    transform-origin: left center; /* Rotate around the top-left corner */
    background-color: var(--accent-primary, #f97316); /* Orange background */
    color: white;
    padding: 4px 8px;
    font-size: 0.65rem; /* Small font size */
    font-weight: bold;
    letter-spacing: 1px;
    white-space: nowrap; /* Prevent text wrapping */
    border-radius: 3px; /* Slightly rounded corners */
    text-transform: uppercase;
}

/* Adjustments for smaller text in circuit/date */
#schedule-section td small {
    display: block;
    font-size: 0.85em;
    color: var(--text-muted, #a0aec0);
    margin-top: 3px;
    font-weight: normal; /* Normal weight for sub-text */
}

/* Adjust muted color for the highlighted current row */
#schedule-section tr.current-race-row td small {
     color: #4a5568; /* Darker muted color on white background */
}

/* Ensure round number color contrasts on highlight */
#schedule-section tr.current-race-row td.round-cell {
    color: var(--bg-darker, #0f1319);
    border-right-color: #ddd; /* Lighter border on white background */
}

/* Add hover effect for rows */
#schedule-section tbody tr:not(.current-race-row):hover {
    background-color: var(--bg-medium, #2d3748); /* Subtle hover */
}

/* ===================================================
   Wagtail CMS Content Styling
   =================================================== */
.cms-content h2 {
    font-size: 1.75rem;
    font-weight: bold;
    margin-top: .25rem;
    margin-bottom: 0.75rem;
    color: #ff6600; /* Formula 1 orange */
}

.cms-content h3 {
    font-size: 1.5rem;
    font-weight: bold;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.cms-content p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.cms-content ul, .cms-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.cms-content li {
    margin-bottom: 0.25rem;
}

.cms-content a {
    color: #00ffff; /* cyan */
    text-decoration: none;
}

.cms-content a:hover {
    text-decoration: underline;
}

/* Custom content blocks you can use in HTML mode */
.cms-content .highlight-box {
    background-color: rgba(255, 102, 0, 0.1);
    border-left: 4px solid #ff6600;
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 0.25rem;
}

.cms-content .feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.cms-content .feature-item {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Special sections */
.cms-content .rules-section {
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    background-color: rgba(0, 0, 0, 0.2);
}

.cms-content .important-notice {
    background-color: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 0.25rem;
    font-weight: bold;
}


/* ===================================================
   Improved Tooltip System 2.0
   =================================================== */
.tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tooltip-trigger {
    cursor: help;
    /* border-bottom: 1px dotted var(--text-muted); */
}

.tooltip-content {
    visibility: hidden;
    width: auto;
    min-width: 220px;
    max-width: 520px;
    background: #23272f;
    color: var(--text-lightest);
    text-align: left;
    border-radius: 8px;
    padding: 14px 18px;
    position: absolute;
    z-index: 300;
    box-shadow: 0 8px 32px 0 rgba(0,0,0,0.45), 0 0 0 2px var(--accent-primary);
    border: 2px solid var(--accent-primary);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.2s, visibility 0.2s;
    white-space: normal;
    display: block;
}

/* Tooltip stays open when hovered */
.tooltip-container:hover .tooltip-content,
.tooltip-container:focus .tooltip-content,
.tooltip-container:focus-within .tooltip-content,
.tooltip-content:hover {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* Add arrow to tooltip */
.tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #23272f transparent transparent transparent;
}

.tooltip-top .tooltip-content {
    top: 125%;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
}

.tooltip-top .tooltip-content::after {
    bottom: auto;
    top: -10px;
    border-color: transparent transparent #23272f transparent;
}

.tooltip-bottom .tooltip-content {
    top: 125%;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
}

.tooltip-bottom .tooltip-content::after {
    bottom: auto;
    top: -10px;
    border-color: transparent transparent #23272f transparent;
}

.tooltip-left .tooltip-content {
    top: 50%;
    right: 125%;
    bottom: auto;
    left: auto;
    transform: translateY(-50%);
}

.tooltip-left .tooltip-content::after {
    top: 50%;
    right: -10px;
    bottom: auto;
    left: auto;
    margin-left: 0;
    margin-top: -5px;
    border-color: transparent transparent transparent var(--text-dark);
}

.tooltip-right .tooltip-content {
    top: 50%;
    left: 125%;
    bottom: auto;
    transform: translateY(-50%);
}

.tooltip-right .tooltip-content::after {
    top: 50%;
    right: auto;
    bottom: auto;
    left: -10px;
    margin-left: 0;
    margin-top: -5px;
    border-color: transparent #23272f transparent transparent;
}