/**
 * Faceted Search Styles
 * For Course Events with Top Bar Filters
 */

/* ========================================
   Filters Section
   ======================================== */

.filters-section {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 20px 0;
    margin-bottom: 30px;
}

.filters-top-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

/* ========================================
   Filter Accordion Styles
   ======================================== */

.filters-accordion {
    margin-bottom: 20px;
}

.filters-accordion .accordion {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.filters-accordion .card {
    border: none;
    border-bottom: 1px solid #dee2e6;
    border-radius: 0;
}

.filters-accordion .card:last-child {
    border-bottom: none;
}

.filters-accordion .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0;
    margin: 0;
}

.filters-accordion .card-header .btn-link {
    color: #223a66;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    transition: all 0.3s ease;
}

.filters-accordion .card-header .btn-link:hover {
    background-color: #e3f2fd;
    text-decoration: none;
}

.filters-accordion .card-header .btn-link:focus {
    text-decoration: none;
    box-shadow: none;
    outline: none;
}

.filters-accordion .card-header .btn-link:not(.collapsed) {
    background-color: #223a66;
    color: #fff;
}

.filters-accordion .card-header .btn-link:not(.collapsed) .filter-count {
    background-color: #e12454;
}

.filters-accordion .card-header .btn-link .filter-count {
    font-size: 13px;
    font-weight: 600;
    background-color: #223a66;
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 28px;
    text-align: center;
    margin-left: 10px;
}

.filters-accordion .card-body {
    padding: 15px 20px;
    background-color: #fff;
}

/* All filters - horizontal layout with enhanced UI */
.filters-accordion .card-body {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filters-accordion .filter-option {
    flex: 0 0 auto;
    margin: 0;
    padding: 10px 16px;
    border: 2px solid #dee2e6;
    border-radius: 20px;
    background-color: #fff;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filters-accordion .filter-option:hover {
    background-color: #e3f2fd;
    border-color: #223a66;
    padding: 10px 16px;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(34, 58, 102, 0.15);
}

/* Active/checked state */
.filters-accordion .filter-option:has(input:checked) {
    background-color: #223a66;
    border-color: #223a66;
    color: #fff;
}

.filters-accordion .filter-option:has(input:checked) .filter-option-label {
    color: #fff;
}

.filters-accordion .filter-option:has(input:checked) .filter-option-count {
    background-color: #e12454;
    color: #fff;
}

/* Hide actual radio/checkbox inputs */
.filters-accordion .filter-option input[type="checkbox"],
.filters-accordion .filter-option input[type="radio"] {
    display: none;
}

/* Price Range Inputs */
.price-range-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.price-range-inputs .form-group {
    margin-bottom: 0;
}

.price-range-inputs label {
    font-size: 12px;
    font-weight: 700;
    color: #223a66;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.price-range-inputs .form-control {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    padding: 10px 14px;
    transition: all 0.3s ease;
}

.price-range-inputs .form-control:focus {
    border-color: #223a66;
    box-shadow: 0 0 0 0.2rem rgba(34, 58, 102, 0.15);
    outline: none;
}

.price-range-inputs .btn-primary {
    background-color: #223a66;
    border-color: #223a66;
    font-size: 14px;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(34, 58, 102, 0.2);
}

.price-range-inputs .btn-primary:hover {
    background-color: #e12454;
    border-color: #e12454;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(225, 36, 84, 0.3);
}

/* Filter Dropdown Button */
.filter-dropdown {
    position: relative;
    display: inline-block;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #223a66;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-btn:hover {
    background-color: #e9ecef;
    border-color: #223a66;
}

.filter-btn.active {
    background-color: #223a66;
    color: #fff;
    border-color: #223a66;
}

.filter-btn .filter-count {
    font-size: 12px;
    opacity: 0.8;
}

.filter-btn .arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.filter-btn.active .arrow {
    transform: rotate(180deg);
}

/* Filter Dropdown Menu */
.filter-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    min-width: 250px;
    max-width: 350px;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 5px;
    padding: 15px;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.filter-dropdown-menu.show {
    display: block;
}

/* Filter Groups */
.filter-group {
    margin-bottom: 20px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group-title {
    font-size: 11px;
    font-weight: 700;
    color: #223a66;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    background-color: #e3f2fd;
    padding: 8px 12px;
    margin: 0 -15px 12px -15px;
    border-left: 3px solid #223a66;
}

.filter-group-divider {
    border: 0;
    border-top: 1px solid #dee2e6;
    margin: 20px 0;
}

/* Filter Options - Base styles (overridden by accordion-specific styles) */
.filter-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #212529;
    cursor: pointer;
    font-weight: 500;
    width: 100%;
}

.filter-option-count {
    font-size: 12px;
    color: #6c757d;
    font-weight: 700;
    background-color: #f0f0f0;
    padding: 3px 10px;
    border-radius: 12px;
    min-width: 32px;
    text-align: center;
    transition: all 0.3s ease;
}

/* Filter Actions */
.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.filter-actions .btn {
    flex: 1;
    font-size: 13px;
    padding: 8px 12px;
}

/* Active Filters Display */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.active-filters .label {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: #223a66;
    color: #fff;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.filter-chip .remove-filter {
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.filter-chip .remove-filter:hover {
    opacity: 1;
}

.clear-all-filters {
    padding: 6px 12px;
    background-color: transparent;
    border: 1px solid #dc3545;
    color: #dc3545;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-all-filters:hover {
    background-color: #dc3545;
    color: #fff;
}

/* ========================================
   Results Section
   ======================================== */

.events-results {
    padding: 30px 0;
}

/* Results Controls */
.results-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.view-toggle {
    display: flex;
    gap: 0;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
}

.view-btn {
    padding: 10px 16px;
    background-color: #fff;
    border: none;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    border-right: 1px solid #dee2e6;
}

.view-btn:last-child {
    border-right: none;
}

.view-btn:hover {
    background-color: #e3f2fd;
}

.view-btn.active {
    background-color: #223a66;
    color: #fff;
}

.sort-select {
    padding: 10px 16px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #223a66;
    cursor: pointer;
    background-color: #fff;
    min-width: 200px;
    transition: all 0.3s ease;
}

.sort-select:hover {
    border-color: #223a66;
    background-color: #e3f2fd;
}

.sort-select:focus {
    outline: none;
    border-color: #223a66;
    box-shadow: 0 0 0 0.2rem rgba(34, 58, 102, 0.15);
}

/* Results Info */
.results-info {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
    color: #495057;
}

/* Events Grid */
.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Grid Card Styling - Match Table Colors */
.events-grid .card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.events-grid .card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
}

.events-grid .card-title a {
    color: #223a66 !important;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s ease;
}

.events-grid .card-title a:hover {
    color: #e12454 !important;
}

.events-grid .event-location-link {
    color: #223a66 !important;
    text-decoration: none !important;
}

.events-grid .event-location-link:hover {
    color: #e12454 !important;
}

.events-grid .event-location-link .event-venue {
    color: #223a66 !important;
}

.events-grid .card-body a,
.events-grid .card-body a span,
.events-grid .card-body a .event-venue,
.events-grid .card-body div a {
    color: #223a66 !important;
    text-decoration: none !important;
}

.events-grid .card-body a:hover,
.events-grid .card-body a:hover span,
.events-grid .card-body a:hover .event-venue {
    color: #e12454 !important;
}

.events-grid .event-venue,
.events-grid span.event-venue {
    color: #223a66 !important;
}

/* Grid location link - prevent global a color override */
.events-grid .grid-location-link,
.events-grid a.grid-location-link,
.events-grid .card-body a.grid-location-link {
    text-decoration: none !important;
    display: block !important;
    color: #223a66 !important;
}

.events-grid .grid-location-text,
.events-grid .grid-location-link .grid-location-text {
    color: #223a66 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
}

.events-grid .grid-location-text span,
.events-grid .grid-location-text .event-venue {
    color: #223a66 !important;
}

.events-grid .grid-location-link:hover,
.events-grid a.grid-location-link:hover,
.events-grid .grid-location-link:hover .grid-location-text,
.events-grid .grid-location-link:hover .grid-location-text span,
.events-grid .grid-location-link:hover .event-venue {
    color: #e12454 !important;
}

/* Grid Card Badges - Match Table */
.events-grid .badge-primary {
    background-color: #223a66;
    color: #fff;
    font-weight: 600;
}

.events-grid .badge-secondary {
    background-color: #6c757d;
    color: #fff;
}

.events-grid .badge-info {
    background-color: #17a2b8;
    color: #fff;
}

/* Price badge - Pink to match table */
.events-grid .badge-success {
    background-color: #e12454 !important;
    color: #fff;
    font-weight: 700;
}

/* Grid Card Buttons - Match Table */
.events-grid .btn-primary,
.events-grid .btn-group .btn-primary,
.events-grid .card-body .btn-primary {
    background-color: #223a66 !important;
    border-color: #223a66 !important;
    color: #fff !important;
    font-weight: 600;
    transition: all 0.3s ease;
}

.events-grid .btn-primary svg {
    fill: #fff !important;
    transition: fill 0.3s ease;
}

.events-grid .btn-primary:hover,
.events-grid .btn-group .btn-primary:hover,
.events-grid .card-body .btn-primary:hover {
    background-color: #1a2d4d !important;
    border-color: #1a2d4d !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(34, 58, 102, 0.3);
}

.events-grid .btn-primary:hover svg {
    fill: #e12454 !important;
}

/* Download button - Pink background */
.events-grid .btn-outline-secondary,
.events-grid .btn-group .btn-outline-secondary,
.events-grid .card-body .btn-outline-secondary {
    background-color: #e12454 !important;
    border-color: #e12454 !important;
    color: #fff !important;
    font-weight: 600;
    transition: all 0.3s ease;
}

.events-grid .btn-outline-secondary svg {
    fill: #fff !important;
    transition: fill 0.3s ease;
}

.events-grid .btn-outline-secondary:hover,
.events-grid .btn-group .btn-outline-secondary:hover,
.events-grid .card-body .btn-outline-secondary:hover {
    background-color: #c41e3f !important;
    border-color: #b01b39 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(225, 36, 84, 0.3);
}

.events-grid .btn-outline-secondary:hover svg {
    fill: #223a66 !important;
}

/* Events Table View */
.events-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.events-table thead {
    background: linear-gradient(135deg, #223a66 0%, #2d4a7c 100%);
    color: #fff;
}

.events-table th {
    padding: 15px 12px;
    text-align: left;
    border-bottom: 2px solid #1a2d4d;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
}

.events-table td {
    padding: 15px 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
    font-size: 14px;
}

/* Location column styling */
.events-table td a,
.events-table td.event-location-cell a {
    color: #223a66 !important;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.events-table td a:hover,
.events-table td.event-location-cell a:hover {
    color: #e12454 !important;
    text-decoration: underline;
}

.events-table tbody tr {
    transition: all 0.2s ease;
    background-color: #fff;
}

.events-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.events-table tbody tr:hover {
    background-color: #e3f2fd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transform: scale(1.001);
}

.events-table tbody tr:last-child td {
    border-bottom: none;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

/* Table action buttons */
.events-table .btn-group-sm {
    display: flex;
    gap: 8px;
}

.events-table .btn-group-sm .btn {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.events-table .btn-group-sm .btn svg {
    margin: 0;
    width: 14px;
    height: 14px;
}

/* Register button - primary blue with white icon */
.events-table .btn-primary {
    background-color: #223a66;
    border-color: #223a66;
    color: #fff;
}

.events-table .btn-primary svg {
    fill: #fff;
}

.events-table .btn-primary:hover {
    background-color: #1a2d4d;
    border-color: #1a2d4d;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(34, 58, 102, 0.3);
}

.events-table .btn-primary:hover svg {
    fill: #e12454;
}

/* Download button - pink with white icon */
.events-table .btn-outline-secondary {
    background-color: #e12454;
    border-color: #e12454;
    color: #fff;
}

.events-table .btn-outline-secondary svg {
    fill: #fff;
}

.events-table .btn-outline-secondary:hover {
    background-color: #c41e3f;
    border-color: #b01b39;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(225, 36, 84, 0.3);
}

.events-table .btn-outline-secondary:hover svg {
    fill: #223a66;
}

/* Price column styling */
.events-table .event-price-cell {
    font-weight: 700;
}

.events-table .event-price-cell .price-amount {
    color: #e12454;
    font-size: 16px;
    font-weight: 700;
}

/* Specific column widths */
.events-table .event-image-cell {
    width: 80px;
}

.events-table .event-location-cell {
    width: 150px;
    font-weight: 600;
}

.events-table .event-dates-cell {
    min-width: 200px;
}

.events-table .event-dates-cell .event-dates {
    color: #495057;
    font-size: 13px;
}

.events-table .event-duration-cell {
    width: 100px;
    text-align: center;
}

.events-table .event-mode-cell {
    width: 100px;
    text-align: center;
}

.events-table .event-price-cell {
    width: 120px;
}

.events-table .event-actions-cell {
    width: 150px;
}

/* Badge styling in table */
.events-table .badge {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
}

.events-table .badge-primary {
    background-color: #223a66;
    color: #fff;
}

.events-table .badge-secondary {
    background-color: #6c757d;
    color: #fff;
}

.events-table .badge-info {
    background-color: #17a2b8;
    color: #fff;
}

/* ========================================
   Pagination
   ======================================== */

.pagination-wrapper {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #dee2e6;
}

.pagination-info {
    text-align: center;
    margin-bottom: 15px;
    font-size: 14px;
    color: #495057;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
}

.page-item {
    display: inline-block;
}

.page-link {
    display: block;
    padding: 10px 16px;
    min-width: 45px;
    text-align: center;
    background-color: #fff !important;
    border: 2px solid #223a66 !important;
    border-radius: 6px;
    color: #223a66 !important;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.page-link:hover {
    background-color: #e12454 !important;
    border-color: #e12454 !important;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(225, 36, 84, 0.2);
}

.page-item.active .page-link {
    background-color: #223a66 !important;
    border-color: #223a66 !important;
    color: #fff !important;
    pointer-events: none;
    box-shadow: 0 4px 8px rgba(34, 58, 102, 0.3);
}

.page-item.disabled .page-link {
    background-color: #f8f9fa !important;
    border-color: #dee2e6 !important;
    color: #adb5bd !important;
    pointer-events: none;
    cursor: not-allowed;
    opacity: 0.6;
}

.pagination-summary {
    text-align: center;
    font-size: 13px;
    color: #6c757d;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   Loading States
   ======================================== */

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #223a66;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .filters-top-bar {
        flex-direction: column;
    }

    .filter-btn {
        width: 100%;
        justify-content: space-between;
    }

    .filter-dropdown-menu {
        left: 0;
        right: 0;
        max-width: none;
    }

    .results-controls {
        flex-direction: column;
    }

    .search-input,
    .sort-select {
        width: 100%;
    }

    .view-toggle {
        width: 100%;
    }

    .view-btn {
        flex: 1;
    }

    .events-grid {
        grid-template-columns: 1fr;
    }

    .pagination {
        gap: 3px;
    }

    .page-link {
        padding: 6px 10px;
        min-width: 35px;
        font-size: 13px;
    }
}

@media (max-width: 576px) {
    .filters-section {
        padding: 15px 0;
    }

    .filter-chip {
        font-size: 12px;
        padding: 5px 10px;
    }

    .pagination-info,
    .pagination-summary {
        font-size: 12px;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .filters-section,
    .results-controls,
    .pagination-wrapper {
        display: none;
    }

    .events-grid {
        grid-template-columns: 1fr;
    }
}
