/* ==========================================================================
   Dashboard — the [stsed_user_dashboard] shortcode.

   No plugin ships CSS for .stsed-dashboard*, so this file owns it outright.
   The markup (stsed-dashboard/src/Dashboard/Dashboard.php) is:

     .stsed-dashboard
       nav.stsed-dashboard__nav > ul > li(.is-active) > a
       .stsed-dashboard__panel

   The <ul> is unclassed, hence the structural selectors below.
   ========================================================================== */

.stsed-dashboard {
    display: grid;
    gap: var( --stsed-space-md );
}

/* --- Tabs --------------------------------------------------------------- */

.stsed-dashboard__nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: var( --stsed-space-3xs );
    margin: 0;
    padding: 0;
    list-style: none;
    border-block-end: 1px solid var( --stsed-color-border );
}

.stsed-dashboard__nav li {
    margin: 0;
}

.stsed-dashboard__nav a {
    display: block;
    padding: var( --stsed-space-2xs ) var( --stsed-space-sm );
    color: var( --stsed-color-text-muted );
    font-weight: var( --stsed-weight-medium );
    text-decoration: none;
    border-radius: var( --stsed-radius-sm ) var( --stsed-radius-sm ) 0 0;
    /* Reserve the active underline on every tab so switching doesn't shift
       the row by 2px. */
    border-block-end: 2px solid transparent;
    margin-block-end: -1px;
    transition: color var( --stsed-transition ), background-color var( --stsed-transition );
}

.stsed-dashboard__nav a:hover,
.stsed-dashboard__nav a:focus-visible {
    color: var( --stsed-color-link );
    background: var( --stsed-color-surface-sunken );
    text-decoration: none;
}

.stsed-dashboard__nav li.is-active a {
    color: var( --stsed-color-primary );
    font-weight: var( --stsed-weight-semibold );
    border-block-end-color: var( --stsed-color-primary );
    background: none;
}

/* --- Panel -------------------------------------------------------------- */

.stsed-dashboard__panel > :first-child {
    margin-block-start: 0;
}

.stsed-dashboard__panel > :last-child {
    margin-block-end: 0;
}

.stsed-dashboard__panel table {
    width: 100%;
}

.stsed-dashboard__panel :is( h2, h3 ):first-child {
    margin-block-start: 0;
}

/* Tables in a panel scroll rather than forcing the page sideways. */
.stsed-dashboard__panel .stsed-table-scroll {
    overflow-x: auto;
}

.stsed-dashboard__login {
    padding: var( --stsed-space-sm );
    background: var( --stsed-color-surface-sunken );
    border: 1px solid var( --stsed-color-border );
    border-radius: var( --stsed-radius-md );
    text-align: center;
}

/* --- My Bookings list --------------------------------------------------
   Contributed by stsed-events (dashboard/my-bookings.php), which ships no CSS.
   Match the LMS "My Courses" list rows so the two tabs read the same. */

.stsed-my-bookings__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.stsed-my-bookings__item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var( --stsed-space-2xs ) var( --stsed-space-sm );
    padding: var( --stsed-space-xs ) 0;
    border-block-end: 1px solid var( --stsed-color-border );
}

.stsed-my-bookings__item:last-child {
    border-block-end: 0;
}

.stsed-my-bookings__item a {
    font-weight: var( --stsed-weight-medium );
}

.stsed-my-bookings__when {
    margin-inline-start: auto;
    color: var( --stsed-color-text-muted );
    font-size: var( --stsed-text-sm );
}

@media ( max-width: 39.999em ) {
    .stsed-dashboard__nav ul {
        /* Tabs scroll horizontally on a phone instead of stacking into a wall
           of full-width rows. */
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .stsed-dashboard__nav ul::-webkit-scrollbar {
        display: none;
    }

    .stsed-dashboard__nav a {
        white-space: nowrap;
    }
}
