/* ============================================
   Princeton Academy - Training Calendar
   ============================================ */

/* Layout Container */
.hs-calendar-wrap {
    display: flex;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    font-family: inherit;
    position: relative;
    overflow: visible !important;
}

/* Force all ancestors to allow sticky to work */
.hs-calendar-wrap,
.hs-calendar-wrap * {
    /* don't clip the sidebar's sticky context */
}

/* Override any GeneratePress / GB ancestor overflow that kills sticky */
#hs-training-calendar,
#hs-training-calendar .hs-calendar-wrap {
    overflow: visible !important;
}

/* ---- Sidebar Filters ---- */
.hs-calendar-sidebar {
    width: 260px;
    min-width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    align-self: flex-start;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.hs-calendar-sidebar .hs-search-box {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239ca3af' viewBox='0 0 24 24'%3E%3Cpath d='M21.71 20.29l-5.4-5.4A8 8 0 1 0 15 16.31l5.4 5.4a1 1 0 0 0 1.42-1.42ZM10 16a6 6 0 1 1 6-6 6 6 0 0 1-6 6Z'/%3E%3C/svg%3E") 10px center no-repeat;
    outline: none;
    transition: border-color 0.2s;
}

.hs-calendar-sidebar .hs-search-box:focus {
    border-color: #2563eb;
}

.hs-filter-group {
    border-bottom: 1px solid #e5e7eb;
}

.hs-filter-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 0;
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
}

.hs-filter-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
    color: #6b7280;
}

.hs-filter-toggle.is-open svg {
    transform: rotate(180deg);
}

.hs-filter-options {
    display: none;
    padding-bottom: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.hs-filter-options.is-open {
    display: block;
}

.hs-filter-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}

.hs-filter-options label:hover {
    color: #111827;
}

.hs-filter-options input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
    flex-shrink: 0;
}

.hs-filter-count {
    margin-left: auto;
    font-size: 12px;
    color: #9ca3af;
}

.hs-reset-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 6px 16px;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.hs-reset-btn:hover {
    background: #b91c1c;
}

/* ---- Main Content ---- */
.hs-calendar-main {
    flex: 1;
    min-width: 0;
}

/* Sort / Controls Bar */
.hs-controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.hs-controls-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hs-download-btn,
.hs-view-toggle-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    color: #374151;
    transition: all 0.15s;
    padding: 0;
    line-height: 1;
}

.hs-download-btn svg,
.hs-view-toggle-btn svg {
    display: inline-block !important;
    width: 16px !important;
    height: 16px !important;
    min-width: 16px;
    min-height: 16px;
    stroke: currentColor;
    fill: none;
    visibility: visible !important;
    opacity: 1 !important;
}

.hs-view-toggle-btn .hs-icon-hidden {
    display: none !important;
}

.hs-download-btn:hover,
.hs-view-toggle-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #111827;
}

.hs-sort-select {
    padding: 6px 28px 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    appearance: auto;
}

.hs-results-count {
    font-size: 13px;
    color: #6b7280;
}

/* ---- Table ---- */
.hs-calendar-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    table-layout: fixed;
}

.hs-calendar-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    color: #1f2937;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #1f2937;
    white-space: nowrap;
}

/* Fixed column widths — Training gets ~40%, rest share equally */
.hs-calendar-table colgroup .hs-col-w-training { width: 50%; }
.hs-calendar-table colgroup .hs-col-w-date      { width: 17%; }
.hs-calendar-table colgroup .hs-col-w-location   { width: 16%; }
.hs-calendar-table colgroup .hs-col-w-venue      { width: 17%; }

.hs-calendar-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.15s;
}

.hs-calendar-table tbody tr:hover {
    background: #f9fafb;
}

.hs-calendar-table tbody td {
    padding: 14px 16px;
    font-size: 14px;
    color: #374151;
    vertical-align: top;
}

/* Training name column */
.hs-calendar-table .hs-col-training {
    font-weight: 600;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.hs-calendar-table .hs-col-training a {
    color: #1f2937;
    text-decoration: none;
    transition: color 0.2s;
}

.hs-calendar-table .hs-col-training a:hover {
    color: #2563eb;
}

/* Sub-rows within cells for multiple events */
.hs-event-line {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    font-size: 14px;
    line-height: 1.5;
}

.hs-event-line:first-child {
    padding-top: 0;
}

.hs-event-line:last-child {
    padding-bottom: 0;
}

.hs-event-line + .hs-event-line {
    border-top: 1px dashed #e5e7eb;
}

.hs-event-line .hs-line-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: #9ca3af;
}

/* Training badges (New, Trending, Best Seller) */
.hs-training-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}

.hs-training-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1.5;
    border-width: 1.5px;
    border-style: solid;
    white-space: nowrap;
}

/* Online badge */
.hs-badge-online {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

/* ---- Pagination ---- */
.hs-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
    padding: 16px 0;
}

.hs-pagination button {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
}

.hs-pagination button:hover:not(:disabled):not(.is-active) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.hs-pagination button.is-active {
    background: #1f2937;
    color: #fff;
    border-color: #1f2937;
}

.hs-pagination button:disabled {
    opacity: 0.4;
    cursor: default;
}

.hs-pagination .hs-page-ellipsis {
    padding: 0 4px;
    color: #9ca3af;
}

/* ---- Loading & Empty States ---- */
.hs-loading {
    text-align: center;
    padding: 48px 16px;
    color: #6b7280;
    font-size: 15px;
}

.hs-loading .hs-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: hs-spin 0.6s linear infinite;
    margin-bottom: 12px;
}

@keyframes hs-spin {
    to { transform: rotate(360deg); }
}

.hs-empty-state {
    text-align: center;
    padding: 48px 16px;
    color: #6b7280;
}

.hs-empty-state p {
    font-size: 15px;
    margin: 0;
}

.hs-retry-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: #2563eb;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.hs-retry-btn:hover {
    background: #1d4ed8;
}

/* ---- Card View ---- */
.hs-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.hs-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.15s;
}

.hs-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.hs-card-header {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.hs-card-title {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    text-decoration: none;
    line-height: 1.4;
}

a.hs-card-title:hover {
    color: #2563eb;
}

.hs-card-header .hs-training-badges {
    margin-top: 8px;
}

.hs-card-events {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hs-card-event {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
}

.hs-card-event + .hs-card-event {
    border-top: 1px dashed #e5e7eb;
}

.hs-card-detail {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #374151;
}

.hs-card-detail .hs-line-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: #9ca3af;
}

/* Unlinked training name styling */
.hs-training-name-text {
    font-weight: 600;
    color: #1f2937;
}

/* ---- Mobile Top Bar (Filter + Reset) ---- */
.hs-mobile-top-bar {
    display: none;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.hs-mobile-filter-btn {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #1f2937;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.hs-mobile-filter-btn svg {
    width: 16px;
    height: 16px;
}

.hs-mobile-reset-btn {
    display: none;
    padding: 8px 16px;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.hs-mobile-reset-btn:hover {
    background: #b91c1c;
}

/* Mobile combined date+location separator */
.hs-mobile-separator {
    margin: 0 4px;
    color: #9ca3af;
    font-weight: 700;
}

.hs-event-line-combined {
    flex-wrap: wrap;
}

.hs-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
}

.hs-sidebar-close {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .hs-calendar-wrap {
        flex-direction: column;
    }

    .hs-mobile-top-bar {
        display: flex;
    }

    .hs-mobile-filter-btn {
        display: inline-flex;
    }

    .hs-mobile-reset-btn {
        display: inline-block;
    }

    .hs-calendar-sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 300px;
        height: 100vh;
        background: #fff;
        z-index: 1000;
        padding: 16px;
        overflow-y: auto;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    .hs-calendar-sidebar.is-open {
        display: block;
    }

    .hs-sidebar-close {
        display: block;
    }

    .hs-sidebar-overlay.is-open {
        display: block;
    }

    /* Stack table on mobile — reset fixed layout */
    .hs-calendar-table {
        table-layout: auto;
    }

    .hs-calendar-table colgroup {
        display: none;
    }

    .hs-calendar-table thead {
        display: none;
    }

    .hs-calendar-table tbody tr {
        display: block;
        padding: 14px 0;
    }

    .hs-calendar-table tbody td {
        display: block;
        padding: 4px 16px;
        width: 100% !important;
    }

    .hs-calendar-table tbody td:before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #9ca3af;
        margin-bottom: 2px;
    }

    .hs-calendar-table .hs-col-training {
        font-size: 15px;
    }

    .hs-card-grid {
        grid-template-columns: 1fr;
    }

    .hs-controls-bar {
        flex-wrap: wrap;
        gap: 8px;
    }
}
