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

/* =========================
   BASE
========================= */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #000;
    color: #fff;
    line-height: 1.6;
}

/* =========================
   LAYOUT
========================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Keep results centered and stable */
.results {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
}

/* Fix dropdown positioning */
.table-selector-wrapper {
    margin: 2rem 0;
}


/* =========================
   HEADER
========================= */
header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 500;
    letter-spacing: -0.02em;
}

header p {
    font-size: 1.1rem;
    color: #888;
}

/* =========================
   SEARCH
========================= */
.search-section {
    position: relative;
    max-width: 600px;
    margin: 0 auto 2rem;
}

#searchInput {
    width: 100%;
    padding: 0.8rem 1.25rem;
    font-size: 1rem;
    background-color: #111;
    border: 1px solid #333;
    border-radius: 8px;
    color: #fff;
    transition: border-color 0.2s;
}

#searchInput:focus {
    outline: none;
    border-color: #888;
}

#searchInput::placeholder {
    color: #666;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background-color: #111;
    border: 1px solid #333;
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 1rem 1.25rem;
    cursor: pointer;
    border-bottom: 1px solid #222;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: #1a1a1a;
}

.search-result-item .result-details {
    font-size: 0.95rem;
    color: #ccc;
}

/* =========================
   STUDENT INFO
========================= */
.student-info {
    padding: 1.5rem 0;
}

.student-info h2 {
    font-size: 2rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.student-info p {
    color: #888;
    font-size: 1rem;
}

/* =========================
   TABLE SELECTOR
========================= */
.table-selector {
    margin: 2rem 0;
    display: flex;
    align-items: center;
    background: #141414;
    padding: 0.75rem;
    border-radius: 8px;
}

#tableSelect {
    width: 300px;          /* Fixed width */
    max-width: 100%;
    flex: 1;
    padding: 0.6rem 2.5rem 0.6rem 1rem; /* extra right padding for arrow spacing */
    background-color: #111;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
}

#tableSelect:hover,
#tableSelect:focus {
    outline: none;
    border-color: #c9d1d9;
}

/* =========================
   TABLE VIEWER
========================= */
#currentTableTitle {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.table-container {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid #222;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: #000;
    font-size: 0.9rem;
}

th {
    background-color: #111;
    color: #888;
    font-weight: 500;
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #222;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #111;
    color: #ccc;
}

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

tr:hover td {
    background-color: #111;
}

/* =========================
   FAILING GRADES
========================= */
.failing-row {
    background-color: rgba(255, 0, 0, 0.05);
}

.failing-grade {
    color: #ff6b6b !important;
    font-weight: 500;
    position: relative;
    padding-left: 1.75rem !important;
}

.failing-grade::before {
    content: '⚠️';
    position: absolute;
    left: 0.25rem;
    opacity: 0.7;
    font-size: 0.8rem;
}

/* =========================
   LOADING / ERROR
========================= */
.error {
    max-width: 600px;
    margin: 1rem auto;
    padding: 1rem;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #ff6b6b;
    text-align: center;
}

.loading {
    text-align: center;
    padding: 3rem;
}

.spinner {
    border: 2px solid #222;
    border-top: 2px solid #fff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =========================
   UTILITIES
========================= */
.hidden {
    display: none !important;
}

::-webkit-scrollbar {
    width: 0px;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 768px) {
    .container {
        padding: 2rem 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .student-info h2 {
        font-size: 1.5rem;
    }

    .table-selector {
        flex-direction: column;
        align-items: stretch;
    }

    #tableSelect {
        width: 100%;
    }
}