/**
 * Frontend styles for Kinetics Course Schedule.
 * Includes Shortcodes, Archive Cards, Status Badges, Filtering, and Expiry Effects.
 */

/* ==========================================================================
 * Shortcodes & Single Course Styles
 * ========================================================================== */

.kcs-course-schedule {
    margin: 24px 0;
    padding: 20px 24px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.kcs-schedule-title {
    margin: 0 0 18px 0;
    padding: 0 0 14px 0;
    font-size: 18px;
    font-weight: 700;
    color: #1d2327;
    border-bottom: 2px solid #2271b1;
    line-height: 1.3;
}

.kcs-schedule-status {
    margin-bottom: 16px;
}

.kcs-schedule-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.kcs-schedule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f1;
    gap: 16px;
}

.kcs-schedule-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.kcs-schedule-item:first-child {
    padding-top: 0;
}

.kcs-schedule-label {
    font-weight: 600;
    font-size: 14px;
    color: #646970;
    white-space: nowrap;
    flex-shrink: 0;
}

.kcs-schedule-value {
    font-size: 14px;
    color: #1d2327;
    font-weight: 500;
    text-align: right;
}

/* ==========================================================================
 * Status Badges
 * ========================================================================== */

.kcs-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.5;
}

.kcs-badge--small {
    padding: 2px 8px;
    font-size: 11px;
}

.kcs-badge--upcoming { background: #e7f3ff; color: #0073aa; }
.kcs-badge--registration_open { background: #d4edda; color: #155724; }
.kcs-badge--registration_closed { background: #fff3cd; color: #856404; }
.kcs-badge--running { background: #d1ecf1; color: #0c5460; }
.kcs-badge--completed { background: #e2e3e5; color: #383d41; }
.kcs-badge--expired { background: #f8d7da; color: #721c24; }

/* ==========================================================================
 * Archive Cards Info
 * ========================================================================== */

.kcs-archive-info {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.kcs-archive-dates {
    margin-top: 6px;
    font-size: 12px;
    color: #646970;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kcs-archive-date span {
    font-weight: 600;
}

/* ==========================================================================
 * Dates Only Shortcode
 * ========================================================================== */

.kcs-dates-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.kcs-dates-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f1;
    font-size: 14px;
}

.kcs-dates-label {
    font-weight: 600;
    color: #646970;
}

.kcs-dates-value {
    color: #1d2327;
}

/* ==========================================================================
 * Filter Widget/List
 * ========================================================================== */

.kcs-filter__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.kcs-filter__item {
    margin: 0;
}

.kcs-filter-link {
    display: block;
    padding: 6px 14px;
    border: 1px solid #dcdcde;
    border-radius: 20px;
    font-size: 13px;
    color: #2271b1;
    text-decoration: none;
    transition: all 0.2s ease;
}

.kcs-filter-link:hover {
    background: #f6f7f7;
    border-color: #2271b1;
}

.kcs-filter-link--active {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

/* ==========================================================================
 * Date Range Filter Form
 * ========================================================================== */

.kcs-date-filter {
    margin-bottom: 24px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
}

.kcs-date-filter__form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.kcs-date-filter__group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 180px;
}

.kcs-date-filter__group label {
    font-size: 13px;
    font-weight: 600;
    color: #50575e;
}

.kcs-date-filter__group input[type="date"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
    color: #2c3338;
    background: #fff;
    box-sizing: border-box;
}

.kcs-date-filter__group input[type="date"]:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.kcs-date-filter__submit {
    flex: 0 0 auto;
    min-width: auto;
}

.kcs-date-filter__btn {
    display: inline-block;
    padding: 8px 20px;
    background: #2271b1;
    color: #fff;
    border: 1px solid #2271b1;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    height: 38px;
    transition: background 0.2s ease;
}

.kcs-date-filter__btn:hover {
    background: #135e96;
    border-color: #135e96;
}

/* ==========================================================================
 * THE MAGIC: Unclickable Expired Course Cards
 * Uses modern CSS ':has()' to target the parent container of the expired marker.
 * ========================================================================== */

.course-item:has(.kcs-expired-marker),
.lp-course:has(.kcs-expired-marker),
article.lp-course:has(.kcs-expired-marker),
.thim-course-grid-item:has(.kcs-expired-marker) {
    pointer-events: none !important; /* Disables all clicks completely */
    cursor: not-allowed !important;
    position: relative;
    filter: grayscale(100%); /* Makes it black and white */
    opacity: 0.6; /* Dims it */
    transition: all 0.3s ease;
}

/* Add a visual "EXPIRED" stamp overlay */
.course-item:has(.kcs-expired-marker)::after,
.lp-course:has(.kcs-expired-marker)::after,
article.lp-course:has(.kcs-expired-marker)::after,
.thim-course-grid-item:has(.kcs-expired-marker)::after {
    content: 'Expired';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    background: rgba(114, 28, 36, 0.85);
    color: #fff;
    padding: 8px 30px;
    border-radius: 6px;
    font-size: 20px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    z-index: 99;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    pointer-events: none; /* Ensures the text itself doesn't interfere */
}

/* ==========================================================================
 * Responsive
 * ========================================================================== */

@media (max-width: 600px) {
    .kcs-course-schedule { padding: 16px; margin: 16px 0; }
    .kcs-schedule-title { font-size: 16px; margin-bottom: 14px; padding-bottom: 10px; }
    .kcs-schedule-item { flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 0; }
    .kcs-schedule-value { text-align: left; }
    
    .kcs-date-filter__form {
        flex-direction: column;
    }
    .kcs-date-filter__submit {
        width: 100%;
    }
    .kcs-date-filter__btn {
        width: 100%;
    }

    /* Make expired stamp smaller on mobile */
    .course-item:has(.kcs-expired-marker)::after,
    .lp-course:has(.kcs-expired-marker)::after {
        font-size: 16px;
        padding: 6px 20px;
    }
}