/* ========================================
   CBS RACING - MASTER STYLESHEET
   Universal styling for all manual pages
   ======================================== */

@font-face {
    font-family: 'Ethnocentric';
    src: url('https://test.cbsracingdatabase.com/ethnocentric.rg') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@300;400;500;600;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-red: #dc2626;
    --dark-red: #991b1b;
    --racing-red: #e53e3e;
    --dark-bg: #0a0a0a;
    --card-bg: #1a1a1a;
    --text-light: #e2e8f0;
    --accent-silver: #94a3b8;
    --border-glow: rgba(220, 38, 38, 0.3);
}

/* ========================================
   BASE STYLES
   ======================================== */

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Rajdhani', 'Orbitron', monospace;
    background: var(--dark-bg);
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(220, 38, 38, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(220, 38, 38, 0.08) 0%, transparent 50%),
        linear-gradient(180deg, #0a0a0a 0%, #1a1a1a 100%);
    min-height: 100vh;
    color: var(--text-light);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animated background particles */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23dc2626' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes float {
    5%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

/* FIX FOR ALL LINKS - Make them inherit parent styles */
a {
    color: inherit;
    text-decoration: none;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
}

/* Optional: Add subtle hover effect for general links */
a:hover {
    opacity: 0.9;
}

/* ========================================
   HEADER STYLES
   ======================================== */

.theme-colors.header, .header {
    background: linear-gradient(135deg, 
        rgba(10, 10, 10, 0.95) 0%, 
        rgba(220, 38, 38, 0.1) 30%, 
        rgba(10, 10, 10, 0.95) 70%);
    backdrop-filter: blur(20px);
    border-bottom: 2px solid var(--primary-red);
    box-shadow: 
        0 8px 32px rgba(220, 38, 38, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.plain-link {
    color: var(--text-light);
    text-decoration: none;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
}

.logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 24px;
    background: rgba(220, 38, 38, 0.05);
    border-bottom: 1px solid rgba(220, 38, 38, 0.2);
}

.logo {
    width: 120px;
    height: auto;
    margin-right: 20px;
    filter: drop-shadow(0 0 10px rgba(220, 38, 38, 0.5));
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    5%, 100% { filter: drop-shadow(0 0 10px rgba(220, 38, 38, 0.5)); }
    50% { filter: drop-shadow(0 0 20px rgba(220, 38, 38, 0.8)); }
}

.branding {
    font-family: 'Orbitron', monospace;
    font-weight: 900;
    font-size: 20px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 0 20px rgba(220, 38, 38, 0.6);
    position: relative;
    padding: 12px 24px;
    background: rgba(220, 38, 38, 0.05);
    text-align: center;
}

.branding b {
    font-weight: 900;
}

/* Fix for escaped breadcrumb class names */
a[class*="breadcrumb-part"],
.\\breadcrumb-part,
.\\ breadcrumb-part {
    color: var(--accent-silver);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 6px 12px;
    border-radius: 6px;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 1px;
}

a[class*="breadcrumb-part"]:hover,
.\\breadcrumb-part:hover,
.\\ breadcrumb-part:hover {
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
}

.breadcrumbs {
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
    white-space: nowrap;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* ========================================
   MAIN CONTENT STYLES
   ======================================== */
.hidden {
    display: none !important;
}
.main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 24px;
    position: relative;
}

/* Headers */
h1 {
    font-family: 'Orbitron', monospace;
    font-size: clamp(1.75rem, 3.25vw, 3rem);
    font-weight: 300;
    color: var(--text-light);
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-align: center;
    text-shadow: 
        0 0 20px rgba(220, 38, 38, 0.8),
        0 0 40px rgba(220, 38, 38, 0.4),
        0 0 60px rgba(220, 38, 38, 0.2);
    animation: titleGlow 3s ease-in-out infinite alternate;
    position: relative;
    padding-bottom: 20px;
}

/*h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-red), var(--dark-red), var(--primary-red));
    border-radius: 2px;
    animation: lineGlow 2s ease-in-out infinite alternate;
}
*/
@keyframes titleGlow {
    from { 
        text-shadow: 
            0 0 20px rgba(220, 38, 38, 0.8),
            0 0 40px rgba(220, 38, 38, 0.4),
            0 0 60px rgba(220, 38, 38, 0.2);
    }
    to { 
        text-shadow: 
            0 0 30px rgba(220, 38, 38, 1),
            0 0 60px rgba(220, 38, 38, 0.6),
            0 0 90px rgba(220, 38, 38, 0.3);
    }
}

@keyframes lineGlow {
    from { box-shadow: 0 0 10px rgba(220, 38, 38, 0.5); }
    to { box-shadow: 0 0 20px rgba(220, 38, 38, 1); }
}

h2 {
    font-family: 'Orbitron', monospace;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-light);
    margin: 30px 0 20px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-left: 4px solid var(--primary-red);
    padding-left: 20px;
    text-shadow: 0 0 10px rgba(220, 38, 38, 0.3);
}

h3 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--accent-silver);
    margin: 20px 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ========================================
   BUTTONS & CONTROLS
   ======================================== */

button, .button {
    background: linear-gradient(135deg, 
        var(--primary-red) 0%, 
        var(--dark-red) 50%, 
        #7f1d1d 100%);
    color: white;
    border: none;
    padding: 7px 10px;
    border-radius: 12px;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.4s ease;
    box-shadow: 
        0 8px 25px rgba(220, 38, 38, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    
}

button::before, .button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

button:hover::before, .button:hover::before {
    left: 100%;
}

button:hover, .button:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 
        0 15px 40px rgba(220, 38, 38, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

button:active, .button:active {
    transform: translateY(-2px) scale(1.02);
}

#expand-all, #collapse-all {
    margin: 1px;
    margin-bottom: 10px;
}

/* ========================================
   CONTENT CARDS & LISTS
   ======================================== */

ul {
    list-style: none;
    margin-left: 0;
    padding: 0;
}

li {
    margin-bottom: 20px;
    background: linear-gradient(135deg, 
        rgba(26, 26, 26, 0.9) 5%, 
        rgba(30, 30, 30, 0.9) 100%);
    border-radius: 3px;
    padding: 8px 20px;
    border: 2px solid rgba(220, 38, 38, 0.2);
    border-left: 3px solid var(--primary-red);
    transition: all 0.4s ease;
    box-shadow: 
        0 0px 0px rgba(0, 0, 0, 0.3),
        inset 0 0px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-red), var(--dark-red), var(--primary-red));
    opacity: 0;
    transition: opacity 0.3s ease;
}

li:hover::before {
    opacity: 1;
}

li:hover {
    transform: translateX(8px) translateY(-4px);
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(220, 38, 38, 0.3);
    border-left-color: var(--racing-red);
    border-color: var(--primary-red);
}

.folder-icon {
    width: 32px;
    height: 32px;
    margin-right: 16px;
    vertical-align: middle;
    filter: 
        hue-rotate(340deg) 
        saturate(1.5) 
        brightness(1.2)
        drop-shadow(0 0 8px rgba(220, 38, 38, 0.3));
    transition: all 0.3s ease;
}

li:hover .folder-icon {
    transform: scale(1.15) rotate(5deg);
    filter: 
        hue-rotate(340deg) 
        saturate(2) 
        brightness(1.5)
        drop-shadow(0 0 15px rgba(220, 38, 38, 0.6));
}

li a {
    color: var(--text-light);
    padding: 8px 20px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

li a:hover {
    color: var(--primary-red);
    text-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
    opacity: 1;
}

/*li a::after {
    content: 'â†'';
    margin-left: 10px;
    transition: transform 0.3s ease;
    font-size: 18px;
}
*/
li a:hover::after {
    transform: translateX(5px);
}

/* ========================================
   CONTENT GRID LAYOUTS
   ======================================== */

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

.content-card {
    background: linear-gradient(135deg, 
        rgba(26, 26, 26, 0.9) 5%, 
        rgba(30, 30, 30, 0.9) 100%);
    border-radius: 20px;
    padding: 30px;
    border: 2px solid rgba(220, 38, 38, 0.2);
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.content-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-red), var(--dark-red), var(--primary-red));
    border-radius: 20px 20px 0 0;
}

.content-card:hover {
    transform: translateY(-10px) rotateX(5deg);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.7),
        0 0 30px rgba(220, 38, 38, 0.3);
    border-color: var(--primary-red);
}

.card-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 20px;
    filter: 
        hue-rotate(340deg) 
        saturate(1.5) 
        brightness(1.2)
        drop-shadow(0 0 10px rgba(220, 38, 38, 0.5));
    transition: all 0.3s ease;
}

.content-card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
    filter: 
        hue-rotate(340deg) 
        saturate(2) 
        brightness(1.5)
        drop-shadow(0 0 20px rgba(220, 38, 38, 0.8));
}

.card-title {
    font-family: 'Orbitron', monospace;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* ========================================
   TABLES & DATA
   ======================================== */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: rgba(26, 26, 26, 0.9);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 2px solid rgba(220, 38, 38, 0.2);
}

th {
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    color: white;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 14px;
}

td {
    color: var(--text-light);
    font-weight: 500;
}

tr:hover {
    background: rgba(220, 38, 38, 0.1);
}

/* ========================================
   FORMS & INPUTS
   ======================================== */

input, select, textarea {
    background: rgba(26, 26, 26, 0.9);
    border: 2px solid rgba(220, 38, 38, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-light);
    font-family: 'Rajdhani', sans-serif;
    font-size: 16px;
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.4);
}

/* ========================================
   FOOTER
   ======================================== */

.theme-colors.footer, .footer {
    background: linear-gradient(135deg, 
        rgba(0, 0, 0, 0.9) 0%, 
        rgba(26, 26, 26, 0.9) 5%);
    border-top: 2px solid var(--primary-red);
    color: var(--text-light);
    text-align: center;
    padding: 40px 24px;
    margin-top: 80px;
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        var(--primary-red), 
        transparent);
}

.footer-content {
    font-family: 'Orbitron', monospace;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.footer i {
    color: var(--primary-red);
    text-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
    font-weight: 700;
}

.footer a {
    color: var(--accent-silver);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.footer a:hover {
    color: var(--primary-red);
    text-shadow: 0 0 15px rgba(220, 38, 38, 0.6);
}

/* ========================================
   RACING STRIPES
   ======================================== */

.racing-stripes {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: repeating-linear-gradient(
        90deg,
        var(--primary-red) 0px,
        var(--primary-red) 10px,
        transparent 10px,
        transparent 20px
    );
    z-index: 1001;
    animation: race 2s linear infinite;
}

@keyframes race {
    0% { transform: translateX(-20px); }
    100% { transform: translateX(0px); }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .logo-section {
        flex-direction: column;
        text-align: center;
        padding: 16px;
    }

    .logo {
        width: 80px;
        margin-right: 0;
        margin-bottom: 15px;
    }

    .branding {
        font-size: 16px;
        letter-spacing: 2px;
        padding: 8px 16px;
    }

    .breadcrumbs {
        padding: 12px 16px;
        font-size: 12px;
        flex-direction: column;
        align-items: flex-start;
    }

    .main {
        padding: 30px 16px;
    }

    .content-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .content-card, li {
        padding: 20px;
    }

    h1 {
        font-size: 2rem;
        margin-bottom: 20px;
        letter-spacing: 2px;
    }

    button, .button {
        width: 100%;
        max-width: 250px;
        margin: 5px auto;
        display: flex;
        justify-content: center;
    }

    table {
        font-size: 14px;
    }

    th, td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .breadcrumbs {
        font-size: 11px;
    }
    
    h1 {
        font-size: 1.5rem;
        letter-spacing: 1px;
    }
    
    .content-card, li {
        padding: 16px;
    }
    
    button, .button {
        padding: 12px 24px;
        font-size: 12px;
    }
}

/* ========================================
   AUTOMATIC IMAGE WRAPPING - DISABLED
   ======================================== */

/* DISABLED: This was causing messy layouts on manual pages 
.main img:not(.folder-icon):not(.card-icon):not(.logo) {
    float: left;
    margin: 0 20px 20px 0;
    max-width: 40%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
*/

/* ========================================
   IMAGE SIZING - NO FLOAT
   ======================================== */

/* Constrain image sizes but keep normal document flow */
.main img:not(.folder-icon):not(.card-icon):not(.logo) {
    max-width: 50%;
    height: auto;
    display: block;
    margin: 15px 0;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* For really large diagrams, constrain them more */
.main img[width]:not(.folder-icon):not(.card-icon):not(.logo) {
    max-width: 50%;
}

/* Option 2: Alternate - every odd image floats left, even floats right */
/*
.main img:not(.folder-icon):not(.card-icon):not(.logo):nth-of-type(odd) {
    float: left;
    margin: 0 20px 20px 0;
    max-width: 40%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.main img:not(.folder-icon):not(.card-icon):not(.logo):nth-of-type(even) {
    float: right;
    margin: 0 0 20px 20px;
    max-width: 40%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
*/

/* Option 3: Only first image in a section floats */
/*
.main h2 + p img:first-child,
.main h3 + p img:first-child {
    float: left;
    margin: 0 20px 20px 0;
    max-width: 40%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
*/

/* Clear floats after certain elements to prevent layout issues */
.main h1, .main h2, .main h3 {
    clear: both;
}

/* Responsive: On small screens, remove float */
@media (max-width: 768px) {
    .main img:not(.folder-icon):not(.card-icon):not(.logo) {
        float: none !important;
        display: block;
        margin: 20px auto !important;
        max-width: 100% !important;
    }
}

/* ========================================
   ANIMATIONS & EFFECTS
   ======================================== */

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main > * {
    animation: fadeInUp 0.6s ease forwards;
}

.main > *:nth-child(2) {
    animation-delay: 0.1s;
}

.main > *:nth-child(3) {
    animation-delay: 0.2s;
}

.main > *:nth-child(4) {
    animation-delay: 0.3s;
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    border-radius: 10px;
    border: 2px solid var(--dark-bg);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--dark-red), #7f1d1d);
}

/* ========================================
   AUTO-DETECT TREE VIEW COMPACT MODE
   ======================================== */

/* Automatically detect tree pages and apply compact styling */
/* Pages with many nested ul > li structures get compact treatment */

/* Auto-detect tree pages by looking for deep nesting or specific patterns */
ul ul ul li,
.li-folder,
li[class*="folder"] li,
body:has(.li-folder) li {
    margin-bottom: 2px;
    padding: 4px 18px;
    border-radius: 3px;
    font-size: 15px;
    line-height: 1.0;
}

/* More compact for very deep nesting (4+ levels) */
ul ul ul ul li {
    margin-bottom: 2px;
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.2;
}

/* Compact icons for tree structures */
ul ul ul .folder-icon,
.li-folder .folder-icon,
body:has(.li-folder) .folder-icon {
    width: 0px;
    height: 0px;
    margin-right: 0px;
}

ul ul ul ul .folder-icon {
    width: 0px;
    height: 0px;
    margin-right: 0px;
}

/* Compact text for nested items */
ul ul ul li a,
.li-folder a,
body:has(.li-folder) li a {
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: none;
}

ul ul ul ul li a {
    font-size: 12px;
    font-weight: 400;
}

/* Even more compact for pages with lots of folders */
body:has(.li-folder) li.li-folder {
    margin-bottom: 2px;
    padding: 8px 20px;
}

/* ========================================
   JAVASCRIPT FOR TREE FUNCTIONALITY
   
   Add this script to your HTML files:
   
   <script>
   document.addEventListener('DOMContentLoaded', function() {
       // Initialize folder functionality
       function initializeFolders() {
           const folders = document.querySelectorAll('.li-folder');
           
           folders.forEach(folder => {
               const link = folder.querySelector('a');
               if (link) {
                   link.addEventListener('click', function(e) {
                       e.preventDefault();
                       folder.classList.toggle('expanded');
                   });
               }
           });
       }

       // Expand all functionality
       const expandBtn = document.getElementById('expand-all');
       if (expandBtn) {
           expandBtn.addEventListener('click', function() {
               document.querySelectorAll('.li-folder').forEach(folder => {
                   folder.classList.add('expanded');
               });
               
               // Visual feedback
               this.style.transform = 'scale(0.95)';
               setTimeout(() => {
                   this.style.transform = 'scale(1)';
               }, 150);
           });
       }

       // Collapse all functionality  
       const collapseBtn = document.getElementById('collapse-all');
       if (collapseBtn) {
           collapseBtn.addEventListener('click', function() {
               document.querySelectorAll('.li-folder').forEach(folder => {
                   folder.classList.remove('expanded');
               });
               
               // Visual feedback
               this.style.transform = 'scale(0.95)';
               setTimeout(() => {
                   this.style.transform = 'scale(1)';
               }, 150);
           });
       }

       // Image click to zoom functionality
       const images = document.querySelectorAll('.main img:not(.folder-icon):not(.card-icon)');
       images.forEach(img => {
           img.addEventListener('click', function() {
               // Create overlay
               const overlay = document.createElement('div');
               overlay.className = 'image-overlay';
               overlay.style.display = 'flex';
               
               const enlargedImg = document.createElement('img');
               enlargedImg.src = this.src;
               enlargedImg.style.cursor = 'zoom-out';
               
               overlay.appendChild(enlargedImg);
               document.body.appendChild(overlay);
               
               // Close on click
               overlay.addEventListener('click', function() {
                   document.body.removeChild(overlay);
               });
               
               // Close on escape
               document.addEventListener('keydown', function escHandler(e) {
                   if (e.key === 'Escape') {
                       if (document.body.contains(overlay)) {
                           document.body.removeChild(overlay);
                       }
                       document.removeEventListener('keydown', escHandler);
                   }
               });
           });
       });

       // Initialize everything
       initializeFolders();
   });
   </script>
   
   ======================================== */
body:has(ul ul ul ul ul ul) li {
    margin-bottom: 20px;
    padding: 8px 20px;
    font-size: 15px;
    line-height: 1.1;
    max-width: 75%;
}

body:has(ul ul ul ul ul ul) .folder-icon {
    width: 12px;
    height: 12px;
    margin-right: 3px;
}

body:has(ul ul ul ul ul ul) li a {
    font-size: 15px;
    font-weight: 400;
}

/* Special handling for folder-type list items */
.li-folder > a {
    font-weight: 600;
    color: var(--text-light);
}

.li-folder > a:hover {
    color: var(--primary-red);
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.mb-40 { margin-bottom: 40px; }

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mt-40 { margin-top: 40px; }

.glow-red {
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.5);
}

.racing-border {
    border: 2px solid var(--primary-red);
    border-radius: 8px;
}

.racing-bg {
    background: linear-gradient(135deg, 
        rgba(26, 26, 26, 0.9) 5%, 
        rgba(30, 30, 30, 0.9) 100%);
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    body {
        background: white;
        color: black;
    }
    
    .header, .footer, .racing-stripes {
        display: none;
    }
    
    .main {
        padding: 20px;
        max-width: none;
    }
    
    h1, h2, h3 {
        color: black;
        text-shadow: none;
    }
}

/* ========================================
   SEARCH FUNCTIONALITY STYLES
   ======================================== */

/* Remove ugly white background and use racing theme */
.search-container {
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.9) 0%, rgba(30, 30, 30, 0.9) 100%) !important;
    border: 2px solid rgba(220, 38, 38, 0.3) !important;
    border-radius: 12px !important;
    padding: 25px !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
}

/* Fix search input */
.search-box, #searchInput {
    background: rgba(10, 10, 10, 0.8) !important;
    border: 2px solid rgba(220, 38, 38, 0.3) !important;
    color: #ffffff !important;
    border-radius: 8px !important;
    padding: 12px 45px 12px 15px !important;
    font-family: 'Rajdhani', sans-serif !important;
    font-size: 16px !important;
}

.search-box:focus, #searchInput:focus {
    border-color: #dc2626 !important;
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.4) !important;
}

/* Force placeholder to be white */
.search-box::placeholder, #searchInput::placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

/* Fix button */
.search-btn, #searchBtn {
    background: linear-gradient(135deg, #dc2626, #991b1b) !important;
    border: none !important;
    color: white !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-family: 'Orbitron', monospace !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
}

.search-btn:hover, #searchBtn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4) !important;
}

/* Fix examples text */
.search-examples {
    color: #ffffff !important;
    font-family: 'Rajdhani', sans-serif !important;
}

.search-examples strong {
    color: #ffffff !important;
}

.example-link {
    color: #ffffff !important;
    font-family: 'Rajdhani', sans-serif !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
}

.example-link:hover {
    color: #dc2626 !important;
    text-shadow: 0 0 10px rgba(220, 38, 38, 0.5) !important;
}

/* Fix loading status */
#loadingStatus {
    color: #ffffff !important;
    font-family: 'Rajdhani', sans-serif !important;
}

/* Fix results */
.search-results {
    background: none !important;
}

.result-item {
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.9) 0%, rgba(30, 30, 30, 0.9) 100%) !important;
    border: 2px solid rgba(220, 38, 38, 0.2) !important;
    border-left: 4px solid #dc2626 !important;
    color: #ffffff !important;
    border-radius: 8px !important;
}

.result-item * {
    color: #ffffff !important;
}

.no-results {
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.9) 0%, rgba(30, 30, 30, 0.9) 100%) !important;
    border: 2px solid rgba(220, 38, 38, 0.2) !important;
    color: #ffffff !important;
}