/**
 * HCI Video Library - Front-End Styles
 *
 * Embed styles match ACME theme patterns.
 * Lightbox styles remain neutral per spec.
 */

/* ==========================================================================
   Video Embed (Theme-Matched)
   ========================================================================== */

.hci-video-embed {
    max-width: 600px;
    margin: 1.5rem auto;
}

.hci-video-trigger {
    display: block;
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 0.25rem;
    background: #000;
    text-decoration: none;
}

.hci-video-trigger:focus {
    outline: 3px solid #B52159; /* HCRG burgundy */
    outline-offset: 2px;
}

.hci-video-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 350ms cubic-bezier(.50, 0, .50, 1); /* ACME theme timing */
}

.hci-video-trigger:hover .hci-video-thumbnail,
.hci-video-trigger:focus .hci-video-thumbnail {
    opacity: 0.8;
}

.hci-video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1d2327;
}

/* Play Button - Matches ACME theme video module */
.hci-video-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 5rem;  /* @base-size*5 from ACME theme */
    height: 5rem;
    background: #B52159; /* @hcrg-burgundy-01 */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 350ms cubic-bezier(.50, 0, .50, 1),
                background 350ms cubic-bezier(.50, 0, .50, 1);
    z-index: 15;
}

.hci-video-play svg {
    width: 2rem; /* @base-size*2 from ACME theme */
    height: 2rem;
    color: #fff;
    margin-left: 0.25rem; /* Optical center adjustment for play icon */
}

.hci-video-trigger:hover .hci-video-play,
.hci-video-trigger:focus .hci-video-play {
    transform: translate(-50%, -50%) scale(1.1);
    background: #882038; /* @hcrg-burgundy-02 - darker on hover */
}

/* Video Title */
.hci-video-title {
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.95rem;
    color: inherit;
    font-family: "avenir-lt-pro", Verdana, Geneva, sans-serif; /* ACME theme font */
}

/* ==========================================================================
   Alignment Classes (WordPress)
   ========================================================================== */

.hci-video-embed.alignleft {
    float: left;
    margin-right: 1.5rem;
    max-width: 50%;
}

.hci-video-embed.alignright {
    float: right;
    margin-left: 1.5rem;
    max-width: 50%;
}

.hci-video-embed.aligncenter {
    margin-left: auto;
    margin-right: auto;
}

.hci-video-embed.alignwide {
    max-width: 1000px;
}

.hci-video-embed.alignfull {
    max-width: 100%;
}

/* ==========================================================================
   Lightbox (Neutral - Per Spec)
   ========================================================================== */

.hci-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hci-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
}

.hci-lightbox-content {
    position: relative;
    width: 100%;
    max-width: 900px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.hci-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    color: #fff;
    opacity: 0.8;
    transition: opacity 0.2s;
    padding: 0;
    z-index: 10;
}

.hci-lightbox-close:hover,
.hci-lightbox-close:focus {
    opacity: 1;
}

.hci-lightbox-close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.hci-lightbox-close svg {
    width: 24px;
    height: 24px;
}

.hci-lightbox-video {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    background: #000;
}

.hci-lightbox-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Unavailable Message */
.hci-lightbox-unavailable {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 16px;
    text-align: center;
    padding: 2rem;
}

.hci-lightbox-unavailable p {
    margin: 0.25rem 0;
}

.hci-lightbox-unavailable p:first-child {
    font-size: 18px;
    color: #fff;
}

/* Disclaimer Toggle & Panel */
.hci-lightbox .hci-disclaimer-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none !important;
    border: none !important;
    color: #999 !important;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    white-space: nowrap;
    line-height: inherit;
    min-height: 0;
    box-shadow: none !important;
    text-decoration: none;
    flex-shrink: 0;
}

.hci-lightbox .hci-disclaimer-toggle svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.hci-lightbox .hci-disclaimer-toggle:hover,
.hci-lightbox .hci-disclaimer-toggle:focus {
    color: #fff !important;
    background: none !important;
}

.hci-lightbox-disclaimer {
    padding: 16px 20px;
    background: #111;
    color: #aaa;
    font-size: 13px;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
}

.hci-lightbox-disclaimer p {
    margin: 0 0 0.75em;
}

.hci-lightbox-disclaimer p:last-child {
    margin-bottom: 0;
}

/* Attribution Bar */
.hci-lightbox-attribution {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #1a1a1a;
    color: #ccc;
    font-size: 14px;
}

.hci-attribution-logo {
    height: 24px;
    width: auto;
}

.hci-attribution-text {
    flex: 1;
}

.hci-attribution-text a {
    color: #fff;
    text-decoration: underline;
}

.hci-attribution-text a:hover,
.hci-attribution-text a:focus {
    text-decoration: none;
}

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

@media (max-width: 600px) {
    .hci-video-embed.alignleft,
    .hci-video-embed.alignright {
        float: none;
        margin-left: auto;
        margin-right: auto;
        max-width: 100%;
    }

    .hci-lightbox {
        padding: 10px;
    }

    .hci-lightbox-close {
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
        padding: 4px;
        width: 36px;
        height: 36px;
    }

    .hci-lightbox-attribution {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .hci-video-play {
        width: 4rem;
        height: 4rem;
    }

    .hci-video-play svg {
        width: 1.5rem;
        height: 1.5rem;
    }
}

/* ==========================================================================
   Animation
   ========================================================================== */

.hci-lightbox {
    animation: hci-fade-in 0.2s ease-out;
}

@keyframes hci-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.hci-lightbox-content {
    animation: hci-scale-in 0.2s ease-out;
}

@keyframes hci-scale-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================================================
   Body Scroll Lock
   ========================================================================== */

body.hci-lightbox-open {
    overflow: hidden;
}

/* ==========================================================================
   Video Library Page Template
   ========================================================================== */

.hci-library-intro {
    margin-bottom: 2rem;
}

/* Toolbar */
.hci-library-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.hci-library-search {
    flex: 1;
    min-width: 200px;
}

.hci-library-search-input {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    font-family: inherit;
}

.hci-library-search-input:focus {
    outline: 2px solid #B52159;
    outline-offset: 1px;
    border-color: #B52159;
}

.hci-library-filter select {
    padding: 0.6rem 1rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    font-family: inherit;
    min-width: 180px;
}

.hci-library-filter select:focus {
    outline: 2px solid #B52159;
    outline-offset: 1px;
    border-color: #B52159;
}

/* Count */
.hci-library-count {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

/* Video Grid */
.hci-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

.hci-library-grid .hci-video-embed {
    margin: 0;
    max-width: none;
}

/* Load More */
.hci-library-loadmore {
    text-align: center;
    margin-top: 2rem;
}

.hci-library-loadmore-btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-family: inherit;
    color: #fff;
    background: #B52159;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background 350ms cubic-bezier(.50, 0, .50, 1);
}

.hci-library-loadmore-btn:hover,
.hci-library-loadmore-btn:focus {
    background: #882038;
}

/* Loading Spinner */
.hci-library-loading {
    text-align: center;
    padding: 2rem;
}

.hci-library-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #eee;
    border-top-color: #B52159;
    border-radius: 50%;
    animation: hci-spin 0.6s linear infinite;
}

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

/* Empty State */
.hci-library-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 600px) {
    .hci-library-toolbar {
        flex-direction: column;
    }

    .hci-library-filter select {
        width: 100%;
    }

    .hci-library-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }
}
