/*
 * Upcoming sessions grid — [tin_upcoming_sessions]
 *
 * Recreates the Lovable "Eerstvolgende data" block on the Klassikale
 * trainingen page: a card grid of the next N upcoming classroom sessions
 * (product variations of a date/location attribute), rendered server-side by
 * tin_render_upcoming_sessions() in functions.php.
 *
 * Colours/typography come from the --tin-* tokens, so it follows the brand
 * Customizer + Divi font like everything else.
 */

.tin-sessions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
@media (max-width: 980px) { .tin-sessions-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .tin-sessions-grid { grid-template-columns: 1fr; } }

.tin-session-card {
    display: flex;
    flex-direction: column;
    background: var(--tin-card);
    border: 1px solid var(--tin-border);
    border-radius: var(--tin-radius);
    box-shadow: var(--tin-shadow-card);
    padding: 20px;
    text-decoration: none;
    color: var(--tin-foreground);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.tin-session-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--tin-shadow-card-hover);
}

.tin-session-card__title {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--tin-foreground);
}

.tin-session-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--tin-muted-foreground);
}
.tin-session-card__meta > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tin-session-ico {
    flex: 0 0 auto;
    color: var(--gcid-primary-color);
}

.tin-session-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
}
.tin-session-card__badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--gcid-secondary-color);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.tin-session-card__price {
    margin-left: auto;
    font-weight: 700;
    color: var(--tin-foreground);
}
.tin-session-card__price del { color: var(--tin-muted-foreground); font-weight: 400; margin-right: 6px; }

.tin-sessions-empty {
    color: var(--tin-muted-foreground);
}

/* ----------------------------------------------------------------------------
 * Single-product date/location control (js/sessions-control.js)
 * Selectable card list that replaces the native variation <select>, matching
 * the Lovable DateList. The native select is kept but visually hidden.
 * ------------------------------------------------------------------------- */
.tin-native-select-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
/* Divi wraps the native <select> in a chrome <span> (dropdown arrow via
   ::after) AFTER our script runs, so the JS hide can't catch it. Once the card
   control is in the cell, hide that wrapper outright — the select inside stays
   in the DOM (display:none is fine) so WooCommerce keeps working. */
td.value:has(> .tin-datecards) > span {
    display: none !important;
}
/* Divi also paints a dropdown arrow on EVERY span in the cell via
   `.variations td.value span::after` — which hits the spans our cards are built
   from. Suppress that pseudo-element inside the card control. */
.tin-datecards span::after {
    content: none !important;
    display: none !important;
}

.tin-datecards__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.tin-datecard {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--tin-card);
    border: 1px solid var(--tin-border);
    border-radius: var(--tin-radius);
    padding: 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.tin-datecard:hover {
    border-color: var(--gcid-primary-color);
    background: var(--tin-muted);
}
.tin-datecard.is-selected {
    border-color: var(--gcid-primary-color);
    box-shadow: var(--tin-focus-ring);
}
.tin-datecard.is-hidden { display: none; }

.tin-datecard__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}
.tin-datecard__date {
    font-size: 14px;
    font-weight: 600;
    color: var(--tin-foreground);
}
.tin-datecard__check {
    flex: 0 0 auto;
    margin-top: 1px;
    opacity: 0;                 /* shown only on the selected card */
    color: var(--tin-success);
    transition: opacity 0.15s ease;
}
.tin-datecard__check svg { display: block; width: 18px; height: 18px; }
.tin-datecard.is-selected .tin-datecard__check { opacity: 1; }
.tin-datecard__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--tin-muted-foreground);
}
.tin-datecard__meta > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.tin-datecard__meta .tin-ico { flex: 0 0 auto; color: var(--gcid-primary-color); }
.tin-datecard__badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--gcid-secondary-color);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}
.tin-datecards__more {
    margin-top: 8px;
    padding: 6px 0;
    background: none;
    border: 0;
    color: var(--gcid-primary-color);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.tin-datecards__more:hover { text-decoration: underline; }
