/* ============================================================
   GLOBAL THEME
   ============================================================ */

body {
    font-family: Arial, sans-serif;
    margin: 0; /* moved margin off body to fix Android Chrome */
    background: #1a1a1a;
    color: #f0f0f0;
}

/* Wrapper to replace body margin (Android Chrome safe) */
.page-wrapper {
    margin: 40px;
}

h1 {
    color: #ffffff;
    border-bottom: 4px solid #cc0000;
    padding-bottom: 10px;
}

a {
    color: #66aaff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============================================================
   BANNER
   ============================================================ */

.banner {
    background: linear-gradient(to right, #cc0000, #ffffff, #0033cc);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    text-align: center;
    font-size: 1.6em;
    font-weight: bold;
    color: #000;
}

/* ============================================================
   GENERIC SECTION BLOCKS
   ============================================================ */

.section {
    background: #2a2a2a;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
}

.series-header {
    font-size: 1.3em;
    margin-bottom: 10px;
    border-bottom: 2px solid #444;
    padding-bottom: 5px;
}

/* ============================================================
   DAYTONA SPEEDWEEKS BLOCK
   ============================================================ */

.daytona-section {
    background: #2a2a2a;
    border: 2px solid #444;
    padding: 20px;
    margin-bottom: 40px;
    border-radius: 8px;
}

.daytona-title {
    margin-top: 0;
    color: #ffffff;
    font-size: 1.8em;
    border-bottom: 3px solid #cc0000;
    padding-bottom: 8px;
}

.daytona-subtitle {
    color: #cccccc;
    margin-top: -10px;
    margin-bottom: 20px;
    font-style: italic;
}

/* ============================================================
   SERIES BLOCKS (Dark Theme + NASCAR Colors)
   ============================================================ */

.series-block {
    margin-bottom: 25px;
    padding: 15px 18px;
    border-radius: 6px;
    background: #1f1f1f;
    border-left: 6px solid #666;
    transition: background 0.2s ease, transform 0.2s ease;
}

/* Hover effect */
.series-block:hover {
    background: #292929;
    transform: translateX(4px);
}

/* Series-specific color coding */
.series-block.cup {
    border-left-color: #cc0000; /* Cup red */
}

.series-block.oreilly {
    border-left-color: #00aa44; /* O'Reilly green */
}

.series-block.truck {
    border-left-color: #0066cc; /* Truck blue */
}

.series-block.arca {
    border-left-color: #ffcc00; /* ARCA yellow */
}

/* Series header inside Daytona blocks */
.series-block .series-header {
    color: #f0f0f0;
    border-bottom: 2px solid #444;
}

/* ============================================================
   CURRENT RACE SUMMARY (Clash)
   ============================================================ */

.current-section {
    background: #2a2a2a;
    border: 2px solid #555;
    padding: 20px;
    border-radius: 8px;
}

.inactive-series {
    color: #888;
}

/* ============================================================
   SERIES COLOR LEGEND
   ============================================================ */

.series-legend {
    display: flex;
    gap: 20px;
    margin: 20px 0;
}

.series-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
}

.series-legend-swatch {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    display: inline-block;
}

.legend-cup { background: #cc0000; }
.legend-oreilly { background: #00aa44; }
.legend-truck { background: #0066cc; }
.legend-arca { background: #ffcc00; }

/* ============================================================
   SPEEDWEEKS HOT TRACK – COLLAPSIBLE BLOCK
   ============================================================ */

/* Header that toggles the collapsible */
.collapsible-header {
    cursor: pointer;
    user-select: none;
    padding-right: 30px;
    margin: 0;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collapsible-header:hover {
    color: #ff4444;
}


/* Table styling */
.hottrack-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.95em;
    background: #1f1f1f;
    border-radius: 6px;
    overflow: hidden;
}

.hottrack-table th {
    text-align: left;
    padding: 8px;
    background: #333;
    color: #eee;
    font-weight: bold;
}

.hottrack-table td {
    padding: 8px;
    border-top: 1px solid #444;
}

/* Series color bars (left border) */
.cup-row {
    border-left: 6px solid #cc0000;
}

.oreilly-row {
    border-left: 6px solid #00aa44;
}

.truck-row {
    border-left: 6px solid #0066cc;
}

.arca-row {
    border-left: 6px solid #ffcc00;
}

/* Optional: subtle hover highlight */
.hottrack-table tr:hover {
    background: #2a2a2a;
}


.daytona-subtitle {
    margin-top: 6px;
}
.speedweeks-hottrack hr {
    margin: 10px 0 12px 0;
}

.day-separator td {
  background: #222;
  color: #fff;
  font-weight: bold;
  text-align: center;
  padding: 6px 0;
  border-top: 2px solid #444;
  border-bottom: 2px solid #444;
}

/* ============================================================
   EXPAND / COLLAPSE CONTROLS (Race Week History)
   ============================================================ */

.expand-controls {
    margin-bottom: 12px;
}

.expand-controls button {
    background: #333;
    color: #eee;
    border: 1px solid #555;
    padding: 6px 12px;
    border-radius: 4px;
    margin-right: 8px;
    cursor: pointer;
    font-size: 0.9em;
}

.expand-controls button:hover {
    background: #444;
}
/* ============================================================
   COLLAPSIBLE CONTENT — DEFAULT CLOSED + MULTI-EXPAND SUPPORT
   ------------------------------------------------------------
   This block ensures:
     • All collapsible sections start CLOSED (JS handles hiding)
     • No max-height animations (prevents clipping/truncation)
     • Content expands naturally to full height
     • Multiple sections can be open at once (Option A)
     • Android Chrome properly recalculates layout when opened
   ============================================================ */

.collapsible-content {
    /* Remove any height restrictions so content can fully expand */
    max-height: none !important;

    /* Prevent clipping when multiple collapsibles are open */
    overflow: visible !important;

    /* Disable max-height animation (not compatible with multi-expand) */
    transition: none !important;

    /* REMOVED: contain: layout breaks height calculation on Android Chrome
       The containment was supposed to force reflows, but instead it breaks
       the browser's ability to calculate the actual height of the content.
       Result: offsetHeight=0 even though content exists.
       
       Instead, we explicitly force a reflow in JavaScript using offsetHeight,
       which is more reliable across Android Chrome versions.
    */
}

/* ============================================================
   ANDROID CHROME PARENT EXPANSION FIX
   ------------------------------------------------------------
   `.section` must always be block-level so that when its child
   collapsible-content expands, the parent recalculates height.

   DO NOT include `.collapsible-content` here — that was the bug.
   ============================================================ */

.section {
    display: block !important;
}
/* Android Chrome — prevent parent clipping */
.section,
.series-block,
.upcoming-section,
.daytona-section {
    overflow: visible !important;
}

/* Android Chrome — prevent <hr> from clipping collapsibles */
hr {
    overflow: visible !important;
}

/* ============================================================
   RACE WEEK HISTORY – SUBHEADER VISIBILITY IMPROVEMENT
   ------------------------------------------------------------
   Purpose:
   The default white text for <h3 class="collapsible-header subheader">
   was too low‑contrast when all weeks were expanded, making it
   difficult to visually separate each race week.

   Enhancement:
   Apply a warm yellow‑gold color to improve readability while
   keeping the dark theme intact.

   Placement:
   Append this block at the *bottom* of the main stylesheet so it
   cleanly overrides earlier rules without affecting other sections.
   ============================================================ */

.collapsible-header.subheader {
  color: #ffd65c; /* improved visibility for week headers */
}
