/* css/eventsv2.css */

/* ── Page wrapper ─────────────────────────────────────────────────────────── */
.events-v2-container {
    padding: 20px 0;
}

/* ── Filter panel (Bootstrap .panel override) ──────────────────────────── */
.events-filter-panel { background: #f7f7f7; margin-bottom: 16px; }
.events-filter-panel .panel-body { padding: 14px 16px 2px; }
.events-filter-panel .form-group { margin-bottom: 12px; }

/* Uppercase small label applied via .filter-label on top of Bootstrap .control-label */
.filter-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    margin-bottom: 4px;
    display: block;
}

/* Distance buttons — Bootstrap .btn.btn-default.btn-sm base; active state override only */
.btn-distance.active,
.btn-distance.active:focus,
.btn-distance.active:hover { background-color: #2c6fad; border-color: #235a8c; color: #fff; }

/* ── Legend panel ─────────────────────────────────────────────────────────── */
.events-legend-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 5px;
    margin-bottom: 20px;
    overflow: hidden;
}
.legend-section {
    flex: 1;
    min-width: 260px;
    padding: 14px 18px;
}
.legend-section + .legend-section {
    border-left: 1px solid #e8e8e8;
}
.legend-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #999;
    margin-bottom: 10px;
}

/* Type legend items */
.legend-chip-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #444;
}
.legend-chip-mini {
    display: inline-flex;
    flex-direction: column;
    border-radius: 4px;
    overflow: hidden;
    min-width: 44px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.legend-chip-mini .cat-type-label { font-size: 7px; padding: 2px 5px; background: rgba(0,0,0,0.22); color: rgba(255,255,255,0.9); }
.legend-chip-mini .cat-dist-label { font-size: 12px; font-weight: 800; color: #fff; padding: 3px 5px 2px; }
.legend-chip-mini.cat-bp     { background: #17a2b8; }
.legend-chip-mini.cat-brm    { background: #1d6fa4; }
.legend-chip-mini.cat-lrm    { background: #2d7a2d; }
.legend-chip-mini.cat-fleche { background: #d97c00; }

/* Status legend items */
.legend-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 7px;
    font-size: 13px;
    color: #444;
}
.legend-status-bar {
    width: 4px;
    height: 30px;
    border-radius: 2px;
    flex-shrink: 0;
}
.bar-reg-open    { background: #5cb85c; }
.bar-reg-closed  { background: #bbb; }
.bar-coming-soon { background: #ddd; }
.bar-homologated { background: #5cb85c; }
.bar-cancelled   { background: #d9534f; }
.legend-status-text strong { display: block; font-size: 12px; }
.legend-status-text small   { color: #888; font-size: 11px; }

/* ── Event count row ──────────────────────────────────────────────────────── */
.event-count-info { margin-bottom: 10px; }

/* ── Grid card layout ─────────────────────────────────────────────────────── */
/*
  6 fixed columns — every row shares the same column widths so
  content never shifts regardless of which optional badges are present.
  date | club | chip | route | status+fee | actions
*/
.events-grid { display: flex; flex-direction: column; gap: 8px; }

.event-list-item {
    display: grid;
    grid-template-columns: 70px 1fr 100px 1fr 160px 90px;
    align-items: center;
    background: #fff;
    border: 1px solid #ddd;
    border-left: 4px solid transparent;
    border-radius: 4px;
    transition: box-shadow 0.15s;
    overflow: hidden;
}
.event-list-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.09); }

/* Column dividers */
.event-list-item > div {
    padding: 10px 12px;
    border-right: 1px solid #f2f2f2;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.event-list-item > div:last-child { border-right: none; }

/* Date box */
.event-date-box {
    align-items: center;
    background: #fafafa;
}
.event-date-day {
    font-size: 22px;
    font-weight: 800;
    color: #222;
    line-height: 1;
}
.event-date-month {
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    margin-top: 2px;
    letter-spacing: 1px;
}

/* Club / location */
.event-club-name {
    font-size: 14px;
    font-weight: 700;
    color: #222;
    line-height: 1.2;
    margin-bottom: 3px;
}
.event-location {
    font-size: 12px;
    color: #777;
}
.event-location .glyphicon { font-size: 10px; }

/* Category chip column */
.event-cat-col { align-items: flex-start; justify-content: center; }
.event-cat-chip {
    display: inline-flex;
    flex-direction: column;
    border-radius: 5px;
    overflow: hidden;
    min-width: 58px;
    max-width: 80px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.cat-type-label {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 6px 2px;
    background: rgba(0,0,0,0.22);
    color: rgba(255,255,255,0.88);
}
.cat-dist-label {
    font-size: 20px;
    font-weight: 900;
    color: #fff;
    padding: 5px 6px 4px;
    line-height: 1;
}
.cat-dist-label small { font-size: 10px; font-weight: 600; opacity: 0.85; margin-left: 1px; }
.cat-bp     { background: #17a2b8; }
.cat-brm    { background: #1d6fa4; }
.cat-lrm    { background: #2d7a2d; }
.cat-fleche { background: #d97c00; }
.cat-other  { background: #6c757d; }

/* Route / start point */
.event-route-col { }
.meta-label {
    font-size: 10px;
    text-transform: uppercase;
    color: #aaa;
    letter-spacing: 0.4px;
    margin-bottom: 3px;
}
.meta-value {
    font-size: 13px;
    color: #333;
    font-weight: 500;
    line-height: 1.3;
    word-break: break-word;
}

/* Status + fee column */
.event-status-col {
    gap: 2px;
    align-items: flex-start;
}
.status-pill {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    cursor: default;
}
a.status-pill { cursor: pointer; }
a.status-pill:hover { opacity: 0.85; }

.pill-reg-open    { background: #e6f6e6; color: #1e6e1e; border: 1px solid #b2dfb7; }
.pill-reg-closed  { background: #f5f5f5; color: #888;    border: 1px solid #ddd; }
.pill-coming-soon { background: #fafafa; color: #bbb;    border: 1px dashed #d0d0d0; }
.pill-cancelled   { background: #fdecea; color: #842029; border: 1px solid #f5c2c7; }
.pill-results     { background: #d1e7dd; color: #0f5132; border: 1px solid #a3cfbb; }

.event-fee {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.event-fee-na { font-weight: 400; color: #aaa; }

/* Active early bird: column layout so price sits above the badge */
.event-fee.eb-active-fee {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}
.eb-amount {
    font-size: 15px;
    font-weight: 800;
    color: #c97000;
    line-height: 1;
}
.early-bird-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-style: normal;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: linear-gradient(90deg, #ff8c00, #ffb300);
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 2px 7px;
    box-shadow: 0 1px 4px rgba(255,140,0,0.40);
    white-space: nowrap;
}
.early-bird-ended {
    font-style: normal;
    font-size: 10px;
    background: #f0f0f0;
    color: #888;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 1px 5px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

/* Actions column */
.event-actions-col {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    justify-content: flex-end;
}
.action-btn { white-space: nowrap; }

/* ── Row state overrides ──────────────────────────────────────────────────── */
.registration-open   { border-left-color: #5cb85c; }
.registration-closed { border-left-color: #bbb; }

.event-not-activated {
    border-left-color: #e0e0e0;
    background: #fafafa;
    opacity: 0.72;
}
.event-not-activated .event-date-day,
.event-not-activated .event-club-name { color: #aaa; }

.event-cancelled {
    border-left-color: #d9534f;
    background: #fff8f8;
}
.event-cancelled .event-date-day,
.event-cancelled .event-club-name { color: #b94a48; }

.event-homologated {
    border-left-color: #5cb85c;
    background: #f8fff8;
    border-color: #c8e6c9;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.no-events {
    text-align: center;
    padding: 40px;
    color: #777;
    font-size: 15px;
}

/* ── Responsive — tablet (≤991px) ────────────────────────────────────────── */
@media (max-width: 991px) {
    .event-list-item {
        grid-template-columns: 64px 1fr 90px;
        grid-template-rows: auto auto auto;
    }
    /* Row 1: date | club | chip */
    .event-date-box   { grid-column: 1; grid-row: 1; }
    .event-main-info  { grid-column: 2; grid-row: 1; }
    .event-cat-col    { grid-column: 3; grid-row: 1; }
    /* Row 2: route spanning all 3 cols */
    .event-route-col  { grid-column: 1 / -1; grid-row: 2; border-top: 1px solid #f2f2f2; }
    /* Row 3: status+fee | actions */
    .event-status-col  { grid-column: 1 / 3; grid-row: 3; border-top: 1px solid #f2f2f2; flex-direction: row; align-items: center; gap: 10px; }
    .event-actions-col { grid-column: 3;      grid-row: 3; border-top: 1px solid #f2f2f2; justify-content: flex-end; }
}

/* ── Responsive — mobile (≤767px) ────────────────────────────────────────── */
@media (max-width: 767px) {
    .events-v2-container {
        padding-left: 8px;
        padding-right: 8px;
    }
    .events-grid { gap: 6px; }

    /* 3-column grid: [date 54px] [club+location flex] [chip auto] */
    .event-list-item {
        grid-template-columns: 54px 1fr auto;
        grid-template-rows: auto auto auto;
    }
    .event-list-item > div {
        padding: 8px 9px;
        min-height: 0;
    }

    /* Row 1: date | club+location | category chip */
    .event-date-box   { grid-column: 1; grid-row: 1; }
    .event-main-info  { grid-column: 2; grid-row: 1; }
    .event-cat-col    { grid-column: 3; grid-row: 1; padding-left: 6px; align-items: center; justify-content: center; }

    /* Row 2: start point as a compact single line */
    .event-route-col  {
        grid-column: 1 / -1;
        grid-row: 2;
        border-top: 1px solid #f2f2f2;
        flex-direction: row;
        align-items: center;
        gap: 5px;
        padding: 5px 10px;
        background: #fafafa;
    }
    .event-route-col .meta-label { display: none; }
    .event-route-col .meta-value {
        font-size: 11px;
        color: #666;
        font-weight: 400;
    }
    .event-route-col .meta-value::before {
        content: '\25CF\00a0';
        font-size: 6px;
        color: #bbb;
        vertical-align: middle;
    }

    /* Row 3: status+fee (left) | details button (right) */
    .event-status-col  {
        grid-column: 1 / 3;
        grid-row: 3;
        border-top: 1px solid #f2f2f2;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        align-items: center;
        padding: 7px 9px;
    }
    .event-actions-col {
        grid-column: 3;
        grid-row: 3;
        border-top: 1px solid #f2f2f2;
        display: flex !important;
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        padding: 7px 8px;
    }
    /* hide map button on mobile, keep only Details */
    .event-actions-col .btn-default { display: none; }

    .event-date-day  { font-size: 19px; }
    .event-date-month { font-size: 10px; }
    .event-club-name { font-size: 13px; }
    .event-location  { font-size: 11px; }

    /* shrink chip slightly */
    .event-cat-chip { min-width: 46px; max-width: 58px; }
    .cat-dist-label { font-size: 16px; }

    .filter-distance-group { width: 100%; }
    .events-legend-panel { flex-direction: column; }
    .legend-section + .legend-section { border-left: none; border-top: 1px solid #e8e8e8; }
}

/* ── Help modal tweaks ────────────────────────────────────────────────────── */
#eventsHelpModal .modal-header { background: #2c6fad; color: #fff; border-radius: 5px 5px 0 0; }
#eventsHelpModal .modal-title  { color: #fff; }
#eventsHelpModal .close        { color: #fff; opacity: 0.8; }
#eventsHelpModal .help-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #2c6fad;
    border-bottom: 2px solid #e8e8e8;
    padding-bottom: 5px;
    margin: 18px 0 10px;
}
#eventsHelpModal .help-section-title:first-child { margin-top: 0; }
#eventsHelpModal .pill-demo-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #444;
}
#eventsHelpModal .pill-demo-row .status-pill { flex-shrink: 0; margin-top: 1px; }
#eventsHelpModal .chip-demo-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #444;
}

/* Time limits table */
#eventsHelpModal .time-limit-table {
    width: auto;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 4px;
    font-size: 13px;
}
#eventsHelpModal .time-limit-table td {
    padding: 4px 16px 4px 0;
    color: #444;
    white-space: nowrap;
    vertical-align: middle;
}
#eventsHelpModal .time-limit-table td:first-child {
    font-weight: 600;
    color: #1d6fa4;
    padding-right: 24px;
    min-width: 80px;
}
#eventsHelpModal .time-limit-table tr:not(:last-child) td {
    border-bottom: 1px solid #f0f0f0;
}

/* ── Compact page header ── */
.events-page-header {
    padding: 10px 0 6px;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 14px;
}
.events-page-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
}
.events-page-title {
    font-size: 20px;
    font-weight: 700;
    color: #1d3a5e;
    display: block;
}
.events-page-subtitle {
    font-size: 12px;
    color: #777;
    display: block;
    margin-top: 2px;
}
.events-page-year-badge {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: #1d6fa4;
    padding: 3px 10px;
    border-radius: 3px;
    white-space: nowrap;
    align-self: center;
}
.events-page-notice {
    font-size: 12px;
    color: #888;
    margin: 5px 0 0;
}
.events-page-notice a { color: #1d6fa4; }

/* ── Filter bar hint ── */
.filter-bar-hint {
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
}

/* ── Distance hint ── */
.distance-hint {
    font-size: 11px;
    color: #bbb;
    margin-top: 5px;
    font-style: italic;
}