/**
 * Generic Library Styles
 * Reusable styles for library/gallery pages (case studies, resources, etc.)
 * Cloned from partners.css and generalized with 'library' prefix
 */

/* ==========================================================================
   Variables and Base Setup
   ========================================================================== */

:root {
    --library-text-primary: #121c66;
    --library-text-body: #000000;
    --library-checkbox-active: #2b388f;
    --library-grid-gap: 21px;
    --library-card-padding: 16px;
    --library-tag-bg: rgba(18, 28, 102, 0.1);
    --library-tag-hover-bg: rgba(18, 28, 102, 0.2);
}

/* ==========================================================================
   Layout Structure
   ========================================================================== */

.success-stories-library {
    padding: 76px 0;
}

.success-stories-library__container {
    max-width: 1512px;
    margin: 0 auto;
    padding: 0 84px;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
    align-items: start;
}

/* ==========================================================================
   Filters Sidebar
   ========================================================================== */

.library-filters {
    position: sticky;
    top: 12%;
}

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

.library-filter-group__title {
    font-family: 'Avenir Next', Arial, sans-serif;
    font-size: 24px;
    font-weight: 700;
    line-height: normal;
    color: #121C66;
    margin: 0 0 24px 0;
}

.library-filter-group__options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Filter Options */
.library-filter-option {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-family: 'Avenir Next', Arial, sans-serif;
    font-size: 16px;
    color: var(--library-text-body);
    user-select: none;
}

.library-filter-option--child {
    padding-left: 24px;
}

/* Custom Checkbox */
.library-filter-checkbox {
    display: none;
}

.library-filter-checkbox__custom {
    width: 15px;
    height: 15px;
    border: 1px solid var(--library-checkbox-active);
    border-radius: 100px;
    display: inline-block;
    position: relative;
    flex-shrink: 0;
}

.library-filter-checkbox:checked + .library-filter-checkbox__custom {
    background-color: var(--library-checkbox-active);
    border-color: var(--library-checkbox-active);
}

.library-filter-checkbox:checked + .library-filter-checkbox__custom::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 1px;
    width: 6px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Hover States */
.library-filter-option:hover .library-filter-checkbox__custom {
    border-color: var(--library-text-primary);
}

/* Clear Filters Button */
.library-clear-filters,
.library-clear-filters-button {
    background: none;
    border: 1px solid var(--library-text-body);
    color: var(--library-text-body);
    font-family: 'Avenir Next', Arial, sans-serif;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.library-clear-filters:hover,
.library-clear-filters-button:hover {
    background-color: var(--library-text-body);
    color: white;
}

/* ==========================================================================
   Library Section
   ========================================================================== */

.library-section {
    min-height: 600px;
}

/* Search Bar */
.library-search {
    margin-bottom: 40px;
}

.library-search__input-wrapper {
    position: relative;
    background: #f0f0f0;
    border-radius: 30px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 668px;
}

.library-search__icon {
    width: 24px;
    height: 24px;
    color: var(--library-text-body);
    flex-shrink: 0;
    order: -1;
}

.library-search__input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: 'Avenir Next', Arial, sans-serif;
    font-size: 16px;
    color: var(--library-text-body);
    outline: none;
}

.library-search__input::placeholder {
    color: var(--library-text-body);
}

/* ==========================================================================
   Library Grid
   ========================================================================== */

.library-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--library-grid-gap);
    margin-bottom: 40px;
}

/* ==========================================================================
   Library Cards (Case Study)
   ========================================================================== */

.library-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.library-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.library-card__main-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.library-card__inner {
    display: flex;
    flex-direction: column;
}

/* Card Image */
.library-card__image {
    position: relative;
    overflow: hidden;
}

.library-card__image-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.library-card:hover .library-card__image-img {
    transform: scale(1.05);
}

.library-card__image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #00A894 0%, #2B388F 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-family: 'Avenir Next', Arial, sans-serif;
    font-size: 18px;
    text-align: center;
    padding: 20px;
}

/* Logo Badge */
.library-card__logo-badge {
    position: absolute;
    bottom: -24px;
    left: 16px;
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.library-card__logo-badge img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Card Content */
.library-card__content {
    padding: 32px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.library-card__client {
    font-family: 'Avenir Next', Arial, sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #00A894;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.library-card__title {
    font-family: 'Avenir Next', Arial, sans-serif;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--library-text-primary);
    margin: 0;
}

.library-card__description {
    font-family: 'Avenir Next', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #666;
    margin: 0;
}

/* Tags */
.library-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.library-tag {
    background-color: var(--library-tag-bg);
    font-family: 'Avenir Next', Arial, sans-serif;
    font-size: 12px;
    color: var(--library-text-primary);
    padding: 4px 10px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.library-tag:hover {
    background-color: var(--library-tag-hover-bg);
}

/* Card Button */
.library-card__action {
    margin-top: auto;
    padding-top: 12px;
}

.library-card__button {
    background-color: #121C66;
    color: #FFFFFF;
    font-family: 'Avenir Next', Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 24px;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s ease;
}

.library-card:hover .library-card__button {
    background-color: #0D1449;
}

/* ==========================================================================
   Loading Skeleton
   ========================================================================== */

.library-card-skeleton {
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.library-card-skeleton__image {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: library-loading 1.5s infinite;
    height: 200px;
}

.library-card-skeleton__title {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: library-loading 1.5s infinite;
    height: 24px;
    margin: 40px 16px 12px;
    border-radius: 4px;
    width: 70%;
}

.library-card-skeleton__description {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: library-loading 1.5s infinite;
    height: 40px;
    margin: 0 16px 12px;
    border-radius: 4px;
}

.library-card-skeleton__button {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: library-loading 1.5s infinite;
    height: 36px;
    margin: 0 16px 16px;
    border-radius: 18px;
    width: 100px;
}

@keyframes library-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================================================
   No Results State
   ========================================================================== */

.library-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
}

.library-no-results h3 {
    font-family: 'Avenir Next', Arial, sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--library-text-body);
    margin: 0 0 16px 0;
}

.library-no-results p {
    font-family: 'Avenir Next', Arial, sans-serif;
    font-size: 16px;
    color: var(--library-text-body);
    margin: 0 0 24px 0;
}

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

.library-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
}

.library-pagination__btn {
    background: none;
    border: none;
    color: var(--library-text-body);
    cursor: pointer;
    padding: 12px;
    border-radius: 50px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
}

.library-pagination__btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.library-pagination__btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.library-pagination__numbers {
    display: flex;
    gap: 4px;
}

.library-pagination__number {
    background: none;
    border: none;
    color: var(--library-text-body);
    font-family: 'Avenir Next', Arial, sans-serif;
    font-size: 16px;
    cursor: pointer;
    padding: 12px 16px;
    border-radius: 50px;
    transition: all 0.2s ease;
    min-width: 44px;
}

.library-pagination__number:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.library-pagination__number--current {
    background-color: #2B388F;
    color: white;
}

.library-pagination__number--current:hover {
    background-color: #3D4AAF;
}

/* ==========================================================================
   Mobile Filter Toggle
   ========================================================================== */

.library-filters-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    background: #121C66;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: 20px;
}

.library-filters-toggle:hover {
    background: #0F1654;
}

.library-filters-toggle__icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.library-filters-toggle__count {
    background: #6B7280;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
}

/* Mobile Filters Backdrop */
.library-filters-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.library-filters-backdrop.is-active {
    display: block;
    opacity: 1;
}

/* Mobile Filters Close Button */
.library-filters__close {
    display: none;
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    z-index: 1001;
}

.library-filters__close:hover {
    background: #f0f0f0;
    color: #333;
}

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

/* Tablet */
@media (max-width: 1024px) {
    .success-stories-library__container {
        grid-template-columns: 250px 1fr;
        gap: 30px;
    }

    .library-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media (max-width: 980px) {
    .success-stories-library__container {
        padding: 0 16px;
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .success-stories-library {
        padding: 40px 0;
    }

    /* Show filter toggle button */
    .library-filters-toggle {
        display: flex;
    }

    /* Show close button */
    .library-filters__close {
        display: block;
    }

    /* Transform filters to slide-out sidebar */
    .library-filters {
        position: fixed;
        top: 0;
        left: -100%;
        width: 320px;
        max-width: 80vw;
        height: 100vh;
        background: white;
        z-index: 1000;
        padding: 60px 20px 20px;
        overflow-y: auto;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .library-filters.is-active {
        left: 0;
    }

    .library-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .library-card__title {
        font-size: 16px;
    }

    .library-card__description {
        font-size: 13px;
    }
}

/* Small Mobile */
@media (max-width: 600px) {
    .library-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.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;
}

/* Prevent body scroll when mobile filters are open */
body.no-scroll {
    overflow: hidden;
}

/* Focus States */
.library-card:focus-visible,
.library-filter-option:focus-visible,
.library-tag:focus-visible,
.library-pagination__btn:focus-visible,
.library-pagination__number:focus-visible {
    outline: 2px solid var(--library-text-primary);
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .library-card,
    .library-card__image-img,
    .library-card__button {
        transition: none;
    }

    .library-card:hover {
        transform: none;
    }

    .library-card:hover .library-card__image-img {
        transform: none;
    }
}
