body {
    max-width: none;
    /* remove width limit */
    margin: 20px auto;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    box-sizing: border-box;
    background-color: #f9f9f9;
    color: #333;
}

#topBar {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 5px 20px;
    background: #2bc903;
    border-radius: 8px;
    margin-bottom: 15px;
}

#topBar h2 {
    margin: 0;
    flex-grow: 1;
    /* pushes username and button to the right */
    font-size: 1.0rem;
    color: #2c3e50;
}

#usernameDisplay {
    white-space: nowrap;
}

#logoutBtn {
    padding: 6px 15px;
    background-color: #b92929;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

#logoutBtn:hover {
    background-color: #1f6391;
}

#instrBtn {
    display: inline-block;
    padding: 6px 15px;
    background-color: #2980b9;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: background-color 0.3s ease;
}

#instrBtn:hover {
    background-color: #1f6391;
}


h2 {
    margin-bottom: 15px;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
    font-size: 1.8rem;
    letter-spacing: 0.05em;
}

#filters {
    min-width: 1300px;
    /* big enough to fit all filters */
    flex-wrap: nowrap;
    /* no wrapping */
    display: flex;
    gap: 15px;
    justify-content: flex-start;
    align-items: center;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
    flex-shrink: 0;
    /* remove any overflow-x or white-space */
}


label {
    margin-right: 8px;
    font-weight: 500;
    min-width: 120px;
    color: #34495e;
    white-space: nowrap;
    /* Prevent label text from wrapping */
}

select {
    margin-right: 20px;
    min-width: 170px;
    padding: 6px 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    white-space: nowrap;
    /* Prevent select text wrapping */
}

select:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 5px #2980b9;
}

#submitBtn {
    /* remove display:none */
    margin-top: 0;
    padding: 10px 25px;
    background-color: #2980b9;
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    cursor: not-allowed;
    /* initially disabled */
    transition: background-color 0.3s ease;
    align-self: center;
}

#submitBtn:enabled {
    cursor: pointer;
}

#submitBtn:hover:enabled {
    background-color: #1f6391;
}

#submitBtn:disabled {
    background-color: #a4c3e8;
    cursor: not-allowed;
}

#exportCsvBtn {
    margin-left: 50px;
    padding: 10px 20px;
    background-color: #27ae60;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    align-self: center;
}

#exportCsvBtn:enabled {
    cursor: pointer;
    opacity: 1;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

#exportCsvBtn:enabled:hover {
    background-color: #1e874b;
    box-shadow: 0 6px 18px rgba(30, 135, 75, 0.6);
}

#viewDiv {
    flex-grow: 1;
    width: 100%;
    max-height: 500px;
    margin-top: 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    box-shadow: inset 0 0 12px #e1e1e1;
    background-color: white;
}

#tablePreview {
    margin-top: 20px;
    overflow: auto;
    max-height: 40vh;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background: white;
    font-size: 15px;
    color: #444;
    box-sizing: border-box;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
}

table,
th,
td {
    border: 1px solid #ccc;
    border-collapse: collapse;
    padding: 4px 8px;
    text-align: center;
    transition: background-color 0.15s ease;
}

th {
    background-color: #f0f3f7;
    position: sticky;
    top: 0;
    z-index: 1;
    font-weight: 600;
    color: #2c3e50;
}

tbody tr:hover {
    background-color: #f9fbfd;
}

/* Responsive adjustments */
@media (max-width: 600px) {

    /* Allow horizontal scroll on small screens, no wrapping */
    #filters {
        gap: 10px;
    }

    label,
    select {
        margin-right: 15px;
    }

    #exportCsvBtn {
        width: 100%;
        padding: 14px 0;
        font-size: 1.1rem;
    }
}