/**
 * filter_pptviewer - Lightbox overlay styles
 *
 * Provides a full-screen, black-backdrop gallery-style viewer
 * for PowerPoint files embedded via Office Online.
 *
 * @package    filter_pptviewer
 * @copyright  2024 Your Name
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

/* ============================================================
   1. BODY LOCK (prevent scroll when overlay is open)
   ============================================================ */
body.pptviewer-body-lock {
    overflow: hidden !important;
}

/* ============================================================
   2. TRIGGER BUTTON (replaces the original <a> link)
   ============================================================ */
.pptviewer-trigger-wrap {
    display: inline-block;
}

.pptviewer-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    padding: 0.35em 0.85em;
    font-size: 0.925rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    background: #f4f4f6;
    color: #c43b1e;           /* PowerPoint brand red */
    transition: background 0.18s, box-shadow 0.18s, transform 0.1s;
    text-decoration: none;
    vertical-align: middle;
    line-height: 1.4;
}

.pptviewer-trigger:hover,
.pptviewer-trigger:focus-visible {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
    outline: 2px solid #c43b1e;
    outline-offset: 2px;
    transform: translateY(-1px);
}

.pptviewer-trigger:active {
    transform: translateY(0);
}

.pptviewer-icon {
    font-size: 1.1em;
    line-height: 1;
}

/* ============================================================
   3. OVERLAY BACKDROP
   ============================================================ */
#pptviewer-overlay {
    position: fixed;
    inset: 0;                 /* top/right/bottom/left: 0 */
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;

    /* Hidden by default */
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.28s ease, visibility 0s linear 0.28s;
}

#pptviewer-overlay.pptviewer-visible {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.28s ease;
}

#pptviewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    cursor: pointer;
}

/* ============================================================
   4. MODAL CONTAINER
   ============================================================ */
#pptviewer-modal {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 92vw;
    max-width: 1280px;
    height: 90vh;
    max-height: 900px;
    background: #1a1a1a;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.7),
                0 0 0 1px rgba(255, 255, 255, 0.06);

    /* Slide-up entrance animation */
    transform: translateY(30px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
}

#pptviewer-overlay.pptviewer-visible #pptviewer-modal {
    transform: translateY(0) scale(1);
}

/* Focus outline reset for modal */
#pptviewer-modal:focus {
    outline: none;
}

/* ============================================================
   5. HEADER BAR
   ============================================================ */
#pptviewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    height: 52px;
    min-height: 52px;
    background: #111;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    gap: 1rem;
}

.pptviewer-header-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 600;
    color: #e8e8e8;
    letter-spacing: 0.01em;
}

.pptviewer-header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.pptviewer-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #aaa;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}

.pptviewer-icon-btn:hover,
.pptviewer-icon-btn:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    outline: none;
}

.pptviewer-icon-btn svg {
    pointer-events: none;
}

/* ============================================================
   6. IFRAME WRAPPER + LOADING SPINNER
   ============================================================ */
#pptviewer-iframe-wrap {
    position: relative;
    flex: 1;
    overflow: hidden;
    background: #fff;   /* white bg for when iframe is loading */
}

#pptviewer-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: #1a1a1a;
    color: #aaa;
    font-size: 0.9rem;
    z-index: 2;
}

.pptviewer-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #c43b1e;
    border-radius: 50%;
    animation: pptviewer-spin 0.8s linear infinite;
}

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

#pptviewer-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    transition: opacity 0.25s ease;
}

/* ============================================================
   7. FOOTER BAR
   ============================================================ */
#pptviewer-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    min-height: 34px;
    background: #111;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0 1rem;
}

#pptviewer-footer-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    font-size: 0.75rem;
    color: #666;
    user-select: none;
}

#pptviewer-footer-hint svg {
    flex-shrink: 0;
    opacity: 0.6;
}

#pptviewer-footer-hint kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 0.72rem;
    line-height: 1.4;
    border: 1px solid #444;
    border-radius: 3px;
    background: #222;
    color: #999;
    font-family: monospace;
}

/* ============================================================
   8. RESPONSIVE ADJUSTMENTS
   ============================================================ */
@media (max-width: 640px) {
    #pptviewer-modal {
        width: 100vw;
        height: 100dvh;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    #pptviewer-footer {
        display: none;  /* Hide hint on mobile to save space */
    }

    .pptviewer-trigger {
        font-size: 0.875rem;
    }
}
