/* =========================================
   Video Library Page Styles
   ========================================= */

/* Page hero and .nav__link--active are defined in main.css */

/* Filter Bar */
.video-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 2rem 0 1rem;
}

.video-filter__btn {
    padding: 0.5rem 1.2rem;
    border: 2px solid var(--border-color);
    background: var(--background-white);
    color: var(--text-main);
    border-radius: 2rem;
    font-size: 0.9rem;
    font-family: var(--font-body);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.video-filter__btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.video-filter__btn--active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.video-filter__btn--active:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
}

/* Video Count */
.video-count {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

/* Video Card */
.video-card {
    background: var(--background-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.video-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.video-card:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Thumbnail */
.video-card__thumb {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: #1D2939;
    overflow: hidden;
}

.video-card__thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.video-card__thumb img.loading {
    opacity: 0;
}

.video-card__thumb img.loaded {
    opacity: 1;
}

.video-card__play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.25);
    transition: background 0.2s ease;
}

.video-card:hover .video-card__play {
    background: rgba(0,0,0,0.45);
}

.video-card__play-icon {
    width: 52px;
    height: 52px;
    background: rgba(21, 183, 158, 0.92);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    padding-left: 4px; /* optical centering for play arrow */
    transition: transform 0.2s ease, background 0.2s ease;
}

.video-card:hover .video-card__play-icon {
    transform: scale(1.1);
    background: var(--primary-color);
}

/* Category badge */
.video-card__badge {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    padding: 0.2rem 0.65rem;
    border-radius: 1rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
}

.badge--Husbandry   { background: #2E7D32; }
.badge--Aquatics    { background: #0277BD; }
.badge--Medical     { background: #C62828; }
.badge--Studbooks   { background: #6A1B9A; }
.badge--Conservation{ background: #E65100; }

/* Card body */
.video-card__body {
    padding: 0.9rem 1rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.video-card__title {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary-color);
    line-height: 1.35;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hidden cards */
.video-card--hidden {
    display: none;
}

/* Empty state */
.video-grid__empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-light);
}

.video-grid__empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    color: var(--border-color);
}

/* =========================================
   Video Modal
   ========================================= */
.video-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.video-modal.open {
    opacity: 1;
    pointer-events: all;
}

.video-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.8);
    cursor: pointer;
}

.video-modal__content {
    position: relative;
    background: var(--background-white);
    border-radius: 12px;
    width: 100%;
    max-width: 860px;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}

.video-modal.open .video-modal__content {
    transform: scale(1);
}

.video-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

.video-modal__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin: 0;
    line-height: 1.4;
}

.video-modal__close {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.2rem;
    padding: 0.25rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.video-modal__close:hover {
    color: var(--secondary-color);
}

.video-modal__player {
    background: #000;
}

.video-modal__iframe-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
}

.video-modal__iframe-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.video-modal__footer {
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
}

.video-modal__vimeo-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--primary-color);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.video-modal__vimeo-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 1rem;
    }

    .video-filter {
        gap: 0.4rem;
    }

    .video-filter__btn {
        padding: 0.4rem 0.9rem;
        font-size: 0.85rem;
    }

    .video-modal__content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

@media (max-width: 480px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
}
