* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #1a1a2e 100%);
    min-height: 100vh;
    padding: 20px;
    color: #cbd5e0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #16213e;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

header {
    margin-bottom: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    color: #e2e8f0;
    margin-bottom: 10px;
}

.subtitle {
    color: #a0aec0;
    font-size: 1.1em;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: #4a90d9;
    text-decoration: none;
    font-weight: 600;
    font-size: 1em;
    transition: color 0.2s;
}

.back-link:hover {
    color: #63a4e8;
}

.event-info {
    background: #1a1a2e;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.event-info p {
    margin: 5px 0;
    color: #cbd5e0;
}

.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.event-card-link {
    text-decoration: none !important;
    color: inherit;
    display: block;
}

.event-card-link:hover,
.event-card-link:focus,
.event-card-link:active {
    text-decoration: none !important;
}

.event-card {
    background: #1a1a2e;
    border: 2px solid #2d3748;
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.event-card-link:hover .event-card {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(74, 144, 217, 0.3);
    border-color: #4a90d9;
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.event-header h3 {
    color: #e2e8f0;
    font-size: 1.3em;
    margin: 0;
    flex: 1;
}

.badge {
    background: #48bb78;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: 600;
    white-space: nowrap;
}

.badge.active {
    background: #48bb78;
}

.event-details p {
    margin: 8px 0;
    color: #cbd5e0;
    font-size: 0.95em;
}

.event-details strong {
    color: #e2e8f0;
}

.event-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #2d3748;
}

.view-link {
    color: #4a90d9;
    font-weight: 600;
    font-size: 0.95em;
}

.class-section {
    margin-bottom: 40px;
}

.class-title {
    color: #e2e8f0;
    font-size: 1.5em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 3px solid #4a90d9;
}

table,
.qualifying-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: #121620;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

thead {
    background: linear-gradient(135deg, #0f3460 0%, #0f3460 100%);
    color: white;
}

thead th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr {
    border-bottom: 1px solid #2d3748;
    transition: background-color 0.2s;
}

tbody tr:hover {
    background-color: #1a1a2e;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody td {
    padding: 15px;
    color: #cbd5e0;
}

/* Top 3 positions have bold position numbers */
tbody tr:nth-child(1) td:first-child,
tbody tr:nth-child(2) td:first-child,
tbody tr:nth-child(3) td:first-child {
    font-weight: 700;
}

.time-cell {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #e2e8f0;
    font-size: 1.05em;
}

.no-time {
    opacity: 0.6;
}

.no-time .time-cell {
    color: #4a5568;
    font-style: italic;
}

#loading {
    text-align: center;
    padding: 40px;
    color: #a0aec0;
    font-size: 1.1em;
}

.error {
    background: #3b1a1a;
    color: #fc8181;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #fc8181;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #718096;
    font-size: 1.1em;
    font-style: italic;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
        border-radius: 8px;
    }

    header h1 {
        font-size: 1.5em;
    }

    .subtitle {
        font-size: 0.95em;
    }

    .events-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .event-header h3 {
        font-size: 1.1em;
    }

    .class-title {
        font-size: 1.2em;
    }

    .class-section {
        margin-bottom: 30px;
    }

    /* Make tables responsive with horizontal scroll */
    table,
    .qualifying-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.85em;
        margin-top: 10px;
    }

    table thead,
    table tbody,
    table tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }

    thead th,
    tbody td {
        padding: 8px 6px;
        font-size: 0.9em;
    }

    /* Adjust column widths for mobile */
    thead th:nth-child(1),
    tbody td:nth-child(1) {
        width: 15%;
    }

    thead th:nth-child(2),
    tbody td:nth-child(2) {
        width: 15%;
    }

    thead th:nth-child(3),
    tbody td:nth-child(3) {
        width: 40%;
    }

    thead th:nth-child(4),
    tbody td:nth-child(4) {
        width: 30%;
    }

    .time-cell {
        font-size: 0.95em;
    }

    .event-info {
        padding: 10px;
        font-size: 0.9em;
    }

    .badge {
        font-size: 0.7em;
        padding: 3px 8px;
    }
}
