/*
 * Course calendar: filters and card list.
 * Markup: includes/calendar-list.php, behaviour: assets/js/calendar-filter.js.
 * Plain CSS, loaded only on the calendar_type pages (includes/course-calendar.php).
 */

.post-type-archive-drop-in-calendar .posts-filter,
.tax-calendar_type .posts-filter {
    margin-bottom: 32px;
}

.course-calendar {
    --course-accent: #EE3727;
    --course-accent-dark: #db2211;
    --course-text: #232323;
    --course-muted: #8D8D8D;
    --course-line: #E1E1E1;
    --course-tint: #FDECEA;
    margin-bottom: 92px;
    font-family: 'Azo Sans', sans-serif;
    color: var(--course-text);
}

.course-calendar [hidden] {
    display: none !important;
}

/* Filters ----------------------------------------------------------------- */

.course-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--course-line);
}

.course-filter label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    line-height: 1;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--course-muted);
}

.course-filter input,
.course-filter select {
    display: block;
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--course-line);
    border-radius: 10px;
    background-color: #fff;
    font-family: inherit;
    font-size: 15px;
    color: var(--course-text);
    box-sizing: border-box;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.course-filter select {
    padding-right: 38px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23767676' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
}

.course-filter input::placeholder {
    color: var(--course-muted);
}

.course-filter input:focus,
.course-filter select:focus {
    outline: 0;
    border-color: var(--course-accent);
    box-shadow: 0 0 0 3px rgba(238, 55, 39, .15);
}

/* Toolbar: result count, clear, sort ---------------------------------------- */

.course-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    margin: 24px 0;
}

.course-count {
    margin: 0;
    font-size: 15px;
    color: var(--course-muted);
}

.course-count strong {
    color: var(--course-text);
}

.course-clear {
    padding: 0;
    border: 0;
    background: none;
    font-family: inherit;
    font-size: 15px;
    color: var(--course-accent);
    text-decoration: underline;
    cursor: pointer;
}

.course-clear:hover {
    color: var(--course-accent-dark);
}

.course-sort {
    display: inline-flex;
    margin-left: auto;
    padding: 4px;
    border: 1px solid var(--course-line);
    border-radius: 10px;
    background: #fff;
}

.course-sort button {
    padding: 8px 16px;
    border: 0;
    border-radius: 7px;
    background: none;
    font-family: inherit;
    font-size: 15px;
    color: var(--course-muted);
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}

.course-sort button:hover {
    color: var(--course-text);
}

.course-sort button[aria-pressed="true"] {
    background: var(--course-accent);
    color: #fff;
    font-weight: bold;
}

/* Cards ------------------------------------------------------------------- */

.course-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.course-card {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) auto;
    align-items: center;
    gap: 24px;
    margin: 0 0 16px;
    padding: 22px 24px;
    border: 1px solid var(--course-line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(35, 35, 35, .05);
    transition: box-shadow .2s ease, border-color .2s ease;
}

.course-card:hover {
    border-color: #cfcfcf;
    box-shadow: 0 6px 18px rgba(35, 35, 35, .08);
}

.course-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    border-radius: 14px;
    background: var(--course-accent);
    color: #fff;
    text-align: center;
}

.course-date-day {
    font-size: 30px;
    font-weight: bold;
    line-height: 1;
}

.course-date-month {
    margin-top: 6px;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}

.course-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.course-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--course-tint);
    font-size: 12px;
    font-weight: bold;
    line-height: 1.2;
    color: #a71d10;
}

.course-badge-low {
    background: #FFE4BD;
    color: #7a4300;
}

.course-title {
    margin: 0 0 10px;
    font-family: inherit;
    font-size: 19px;
    font-weight: bold;
    line-height: 1.3;
    color: var(--course-text);
}

.course-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.course-meta li {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    padding: 0;
    font-size: 15px;
    line-height: 1.3;
    color: #555;
}

.course-meta li::before,
.course-meta li::after {
    content: none;
}

.course-icon {
    flex: 0 0 auto;
    color: var(--course-accent);
    /* Azo Sans sits high in its line box (13px above the baseline, 5px below at
       15px), so capitals and digits are centred ~1.5px above the middle of the
       line. Centring the icon on the box alone makes it look low. */
    position: relative;
    top: -1px;
}

.course-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    text-align: right;
}

.course-price {
    font-size: 21px;
    font-weight: bold;
    line-height: 1.2;
    white-space: nowrap;
}

.course-when {
    font-size: 13px;
    color: var(--course-muted);
}

.course-card .button.apply {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-top: 10px;
    padding: 0 28px;
    border: 0;
    border-radius: 56px;
    background: var(--course-accent);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.2;
    color: #fff;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .2s ease;
}

.course-card .button.apply:hover {
    background: var(--course-accent-dark);
}

.course-card .button.apply.disabled {
    background: #d9d9d9;
    color: #6b6b6b;
    cursor: default;
    pointer-events: none;
}

/* Empty state ---------------------------------------------------------------- */

.course-empty {
    padding: 48px 24px;
    border: 1px dashed var(--course-line);
    border-radius: 16px;
    text-align: center;
}

.course-empty p {
    margin: 0 0 12px;
    font-size: 17px;
}

.course-empty p:last-child {
    margin-bottom: 0;
}

/* Small screens -------------------------------------------------------------- */

@media (max-width: 768px) {
    .course-calendar {
        margin-bottom: 56px;
    }

    .course-filters {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .course-filter-search {
        grid-column: 1 / -1;
    }

    .course-sort {
        margin-left: 0;
    }

    .course-card {
        grid-template-columns: 60px minmax(0, 1fr);
        gap: 16px 16px;
        padding: 18px 16px;
        align-items: start;
    }

    .course-date {
        width: 60px;
        height: 60px;
        border-radius: 12px;
    }

    .course-date-day {
        font-size: 24px;
    }

    .course-title {
        font-size: 17px;
    }

    .course-meta {
        flex-direction: column;
        gap: 6px;
    }

    .course-side {
        grid-column: 1 / -1;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 8px 16px;
        padding-top: 14px;
        border-top: 1px solid var(--course-line);
        text-align: left;
    }

    .course-when {
        order: 3;
        flex: 0 0 100%;
    }

    .course-card .button.apply {
        margin-top: 0;
    }
}

@media (max-width: 768px) {
    .course-filter input,
    .course-filter select {
        padding-left: 12px;
        font-size: 14px;
    }

    .course-filter select {
        padding-right: 30px;
        background-position: right 10px center;
    }
}
