/**
 * Material Bank Archive Styles - Matching Screenshot Exactly
 * Font faces are now loaded from fonts.css
 */

/* Page header adjustments */
#page-header-wrap {
    margin-bottom: 0;
}

/* Main Layout */
.material-bank-page {
    padding: 0;
    min-height: 100vh;
}

.material-bank-layout {
    display: flex;
    gap: 0;
    padding: 0;
}

/* Sidebar Filters */
.filters-sidebar {
    flex: 0 0 380px;
    max-width: 380px;
    background: var(--vsliitto-keltainen-var-2);
    padding: 48px;
}

.filters-sidebar .sidebar-title,
.material-bank-page .sidebar-title {
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #003d5c !important;
    margin: 0 0 40px 0 !important;
    padding: 0 !important;
    line-height: 1.2 !important;
}

.material-filters-form {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

/* Filter Sections */
.filter-section {
    margin-bottom: 35px;
}

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

/* Always visible search */
.filter-section.search-section.always-visible {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(0, 61, 92, 0.2);
}

.filter-section.search-section .filter-title.vsliitto-filter-title {
    font-family: "Basier Circle", sans-serif;
    font-weight: 500;
    font-size: 22px;
    padding-top: 0;
    line-height: 125%;
    letter-spacing: 0%;
    color: var(--vsliitto-tumma-sininen, #003d5c);
    margin-bottom: 15px;
}

/* Collapsible filter sections */
.filter-section-collapsible {
    margin-bottom: 25px;
    border: none;
}

.filter-section-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.filter-section-summary::-webkit-details-marker {
    display: none;
}

.filter-section-summary .filter-title.vsliitto-filter-title {
    margin: 0;
    font-family: "Basier Circle", sans-serif;
    font-weight: 500;
    font-size: 22px;
    padding-top: 0;
    line-height: 125%;
    letter-spacing: 0%;
    color: var(--vsliitto-tumma-sininen, #003d5c);
}

.filter-section-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.filter-section-icon::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--vsliitto-tumma-sininen, #003d5c);
    border-bottom: 2px solid var(--vsliitto-tumma-sininen, #003d5c);
    transform: rotate(45deg);
    transition: transform 0.3s ease;
}

.filter-section-collapsible[open] .filter-section-icon::after {
    transform: rotate(-135deg);
}

/* On large screens, make filters always expanded and hide icons */
@media (min-width: 1301px) {

    /* Force details content to always be visible, regardless of open attribute */
    details.filter-section-collapsible .filter-section-content {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Override any closed state styles */
    details.filter-section-collapsible:not([open]) .filter-section-content {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Make summary non-clickable but keep content interactive */
    .filter-section-collapsible summary.filter-section-summary {
        cursor: default;
        pointer-events: none;
        user-select: auto;
    }

    /* Hide expand/collapse icon */
    .filter-section-icon {
        display: none;
    }
}

.filter-section-content {
    padding-top: 15px;
}

/* Clear filters button */
.clear-filters-btn {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 20px;
    background: transparent;
    color: var(--vsliitto-tumma-sininen, #003d5c);
    border: 2px solid var(--vsliitto-tumma-sininen, #003d5c);
    border-radius: 4px;
    font-family: "Basier Circle", sans-serif;
    font-weight: 500;
    font-size: 15px;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    text-align: center;
}

.clear-filters-btn:hover {
    background: var(--vsliitto-tumma-sininen, #003d5c);
    color: white;
}

.clear-filters-btn:active {
    transform: translateY(1px);
}

/* Search Section */
.filter-section .search-wrapper {
    position: relative;
    display: flex;
}

.filter-section .search-wrapper .search-field {
    width: 100%;
    height: 70px;
    padding: 22px;
    border: 1px solid #ddd;
    border-radius: 0;
    background: white;
    color: var(--vsliitto-tumma-sininen);
    transition: border-color 0.3s ease;
    font-family: "Basier Circle";
    font-weight: 500;
    font-size: 15px;
    line-height: 125%;
    letter-spacing: 0%;
}

.filter-section .search-wrapper .search-field::placeholder {
    font-family: "Basier Circle";
    font-weight: 500;
    font-size: 15px;
    line-height: 125%;
    letter-spacing: 0%;
}

.filter-section .search-wrapper .search-field:focus {
    outline: none;
    border-color: var(--vsliitto-tumma-sininen);
}

.filter-section .search-wrapper .search-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    color: var(--vsliitto-tumma-sininen);
}

.filter-section .search-wrapper .search-button svg {
    width: 17px;
    height: 17px;
}

.filter-section .search-wrapper .search-button:hover {
    color: var(--vsliitto-vaalean-sininen);
}

/* Checkbox Filters */
.filter-options {
    padding-right: 5px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    cursor: pointer;
    font-family: "Basier Circle", sans-serif;
    font-weight: 500;
    font-size: 15px;
    padding-top: 0;
    line-height: 125%;
    letter-spacing: 0%;
    color: var(--vsliitto-tumma-sininen)
}

.checkbox-label:hover {
    color: #0066cc;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    min-width: 16px;
    height: 16px;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: none;
    border-radius: 3px;
    background: white;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked {
    background: var(--vsliitto-tumma-sininen);
    border: none;
}

.checkbox-label input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-label input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--vsliitto-vaalean-sininen);
    outline-offset: 2px;
}

.checkbox-label .label-text {
    flex: 1;
    padding-right: 8px;
}

.checkbox-label .count {
    margin-left: auto;
    color: #666;
    font-size: 13px;
    white-space: nowrap;
}

/* Main Content Area */
.materials-content {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    padding-left: 60px;
    overflow: visible;
    /* Ensure pseudo-elements can display */
}

@media (max-width: 1300px) {
    .materials-content {
        padding-left: 0;
    }
}

/* Spinner styles handled by ajax-spinner.css and JavaScript */

/* Materials List - Vertical list like screenshot */
body .material-bank-page .materials-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* Material Card - Horizontal layout matching screenshot */
body .material-bank-page .materials-list .material-card {
    background: #ebf5f9;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    padding: 50px;
    transition: box-shadow 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

body .material-bank-page .materials-list .material-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

/* Card Image */
body .material-bank-page .materials-list .material-card .card-image {
    flex: 0 0 200px;
    width: 200px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;

}

body .material-bank-page .materials-list .material-card .card-image img,
body .material-bank-page .materials-list .material-card .card-image picture img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

body .material-bank-page .materials-list .material-card .material-card__image--cover {
    object-fit: cover;
}

/* Card Content */
body .material-bank-page .materials-list .material-card .card-content {
    flex: 1;
    padding: 0 0 0 50px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-width: 0;
}

body .material-bank-page .materials-list .material-card .card-content .card-title,
body .material-bank-page .materials-list .material-card .card-content .card-excerpt,
body .material-bank-page .materials-list .material-card .card-content .card-category {
    overflow-wrap: anywhere;
    word-break: normal;
}

/* Card Meta - Document Type */
body .material-bank-page .materials-list .material-card .card-meta {
    margin-bottom: 10px;
}

body .material-bank-page .materials-list .material-card .material-type {
    display: inline-block;
    font-family: "Basier Circle Mono";
    font-weight: 400;
    font-style: "Regular";
    font-size: 18px;
    padding-top: 0;
    line-height: 110%;
    letter-spacing: 0%;
    color: var(--vsliitto-tumma-sininen);
}

/* Card Title */
body .material-bank-page .materials-list .material-card h3.card-title,
body .material-bank-page .materials-list .material-card h3.card-title {
    font-family: "Basier Circle";
    font-weight: 500;
    font-style: "Medium";
    font-size: 22px;
    padding-top: 0;
    line-height: 110%;
    letter-spacing: 0%;
    color: var(--vsliitto-tumma-sininen);

}

/* Card Category */
body .material-bank-page .materials-list .material-card .card-category {
    font-family: "Basier Circle";
    font-weight: 400;
    font-size: 16px;
    padding-top: 0;
    line-height: 125%;
    letter-spacing: 0%;
    color: var(--vsliitto-tumma-sininen);
    opacity: .8;
    text-transform: uppercase;
}

/* Card Excerpt */
body .material-bank-page .materials-list .material-card .card-excerpt {
    font-family: "Basier Circle";
    font-weight: 400;
    font-style: Regular;
    font-size: 18px;
    padding-top: 0;
    line-height: 125%;
    letter-spacing: 0%;
    margin: 15px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--vsliitto-tumma-sininen);

}

/* Card Download Link */
body .material-bank-page .materials-list .material-card .card-download {
    margin: 15px 0;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

body .material-bank-page .materials-list .material-card .download-text-link {
    color: #0066cc;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s;
}

body .material-bank-page .materials-list .material-card .download-text-link:hover {
    color: #003d5c;
    text-decoration: underline;
}

body .material-bank-page .materials-list .material-card .download-text-link::before {
    content: "📄";
    margin-right: 8px;
    font-size: 16px;
}

/* Card Actions */
body .material-bank-page .materials-list .material-card .card-actions {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-top: auto;
    padding-top: 15px;
}

body .material-bank-page .materials-list .material-card .material-card__action {
    display: inline-flex;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    color: var(--vsliitto-tumma-sininen, #003d5c);
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

body .material-bank-page .materials-list .material-card .material-card__icon {
    display: block;
    max-width: 24px;
    max-height: 24px;
}

body .material-bank-page .materials-list .material-card .material-card__action:hover,
body .material-bank-page .materials-list .material-card .material-card__action:focus {
    color: #001f33;
    transform: translateY(-1px);
}

/* Pagination styles in shared.css */

/* No Materials Found */
body .material-bank-page .no-materials-found {
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    color: #666;
    background: white;
}

/* Intermediate screens - Two column filter layout */
@media (max-width: 1300px) and (min-width: 768px) {
    body .material-bank-page .material-bank-layout {
        flex-direction: column;
    }

    /* Override Salient column constraints */
    body .material-bank-page .material-bank-layout .col.span_3.filters-sidebar {
        max-width: 100% !important;
        width: 100% !important;
        flex: 0 0 100% !important;
        padding: 0 !important;
        background: transparent;
        margin-bottom: 25px;
    }

    body .material-bank-page .material-bank-layout .filters-sidebar .material-filters {
        background: var(--vsliitto-keltainen-var-2);
        padding: 30px;
        border-radius: 8px;
    }

    body .material-bank-page .material-bank-layout .filters-sidebar .material-filters-form {
        display: flex;
        gap: 30px;
        align-items: flex-start;
    }

    /* Search section takes the left side */
    body .material-bank-page .material-bank-layout .filter-section.search-section {
        flex: 1;
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }

    /* Right column containing filter dropdowns */
    body .material-bank-page .material-bank-layout .filters-left-column {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    /* Remove margins from filter dropdowns */
    body .material-bank-page .material-bank-layout .filter-section-collapsible {
        margin-bottom: 0 !important;
    }

    /* Reduce padding from filter content */
    body .material-bank-page .material-bank-layout .filter-section-content {
        padding-top: 10px !important;
    }

    /* Clear button positioning for two-column layout */
    body .material-bank-page .material-bank-layout .clear-filters-btn {
        grid-column: 1 / -1;
        /* Span full width */
        margin-top: 10px;
    }

    body .material-bank-page .material-bank-layout .col.span_9 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
}

/* Small screens - Stacked layout */
@media (max-width: 767px) {

    /* Stack filters vertically on mobile */
    body .material-bank-page .material-bank-layout .filters-sidebar .material-filters-form {
        flex-direction: column;
        gap: 20px;
    }

    body .material-bank-page .material-bank-layout .filters-left-column {
        width: 100%;
    }

    body .material-bank-page .material-bank-layout .filter-section.search-section {
        width: 100%;
    }

    body .material-bank-page .material-bank-layout {
        flex-direction: column;
    }

    /* Override Salient column constraints */
    body .material-bank-page .material-bank-layout .col.span_3.filters-sidebar {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        background: transparent;
        margin-bottom: 30px;
    }

    body .material-bank-page .material-bank-layout .filters-sidebar .material-filters {
        background: var(--vsliitto-keltainen-var-2);
        padding: 20px;
        border-radius: 8px;
    }

    body .material-bank-page .material-bank-layout .col.span_9 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding: 0 !important;
    }

    body .material-bank-page .material-bank-layout .material-card {
        flex-direction: column;
        min-height: auto;
    }

    body .material-bank-page .material-bank-layout .card-image {
        flex: none;
        max-width: 240px;
    }

    body .material-bank-page .material-bank-layout .card-content {
        padding: 0;
    }

    /* Adjust filter section spacing on mobile */
    body .material-bank-page .material-bank-layout .filter-section.search-section {
        margin-bottom: 20px;
        padding-bottom: 20px;
    }

    body .material-bank-page .material-bank-layout .filter-section-collapsible {
        margin-bottom: 15px;
    }
}


/* Salient Theme Compatibility */
body .material-bank-page .material-bank-layout .col.span_3 {
    width: 380px;
    flex: 0 0 380px;
}

body .material-bank-page .material-bank-layout .col.span_9 {
    flex: 1;
    width: auto;
}

/* Override Salient styles for this page */
body .material-bank-page {
    background: #ffffff !important;
}

/* Force specific font sizes with custom classes */
body .vsliitto-main-title,
body h1.vsliitto-main-title {
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #003d5c !important;
    margin: 0 0 40px 0 !important;
    padding: 0 !important;
    line-height: 1.2 !important;
}

.vsliitto-sidebar .filter-section h3.vsliitto-filter-title {
    font-family: "Basier Circle", sans-serif;
    font-weight: 500;
    font-size: 22px;
    padding-top: 0;
    line-height: 125%;
    letter-spacing: 0%;
    color: var(--vsliitto-tumma-sininen, #003d5c);
    margin-bottom: 10px;

}

body .material-bank-layout {
    display: flex !important;
}

body .materials-list {
    display: flex !important;
    flex-direction: column !important;
}


/* Remove default Salient container padding for hero */
.material-bank-hero+.content-area .container {
    padding-top: 0;
}