/* ============================================================
   Kids Kingdom - Worksheet Floating Trigger + Popup
   ONE small corner icon (not a wide banner). Counts down once,
   then becomes a clickable icon with a little sparkle pulse.
   Tapping it opens a compact popup (zooms in from the corner)
   listing every worksheet type available for this page - each
   with its own small "Download" button that opens in a new tab.
   Works the same on mobile and desktop, just sized down further
   on small screens.
   ============================================================ */

.worksheet-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 92px;
    text-align: center;
    background: #fff;
    border: 2px solid var(--color-bg, #FFF9F0);
    border-radius: 16px;
    padding: 8px 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    font-family: var(--font-heading);
    color: var(--color-dark, #2D3142);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.worksheet-fab.visible {
    opacity: 1;
    transform: translateY(0);
}

.worksheet-fab.ready {
    cursor: pointer;
    pointer-events: auto;
    background: var(--color-primary, #FF6B6B);
    color: #fff;
    border-color: var(--color-primary, #FF6B6B);
    animation: worksheetSparkle 1.3s ease-in-out 2;
}
.worksheet-fab.ready .worksheet-fab-label,
.worksheet-fab.ready .worksheet-fab-status {
    color: #fff;
}

.worksheet-fab.ready:hover {
    transform: translateY(-2px);
}

.worksheet-fab-label {
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-dark, #2D3142);
}

.worksheet-fab-status {
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1.2;
}

@keyframes worksheetSparkle {
    0%   { box-shadow: 0 0 0 0 rgba(255,107,107,0.55); }
    70%  { box-shadow: 0 0 0 16px rgba(255,107,107,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,107,107,0); }
}

/* ---- Popup panel: zooms in from the same corner ---- */
.worksheet-popup {
    position: fixed;
    bottom: 74px;
    right: 20px;
    z-index: 10000;
    width: 240px;
    max-width: 85vw;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.22);
    padding: 14px;
    transform-origin: bottom right;
    transform: scale(0.2);
    opacity: 0;
    transition: transform 0.22s ease, opacity 0.18s ease;
    pointer-events: none;
}

.worksheet-popup.open {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

.worksheet-popup-title {
    text-align: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.92rem;
    color: var(--color-dark, #2D3142);
    margin-bottom: 10px;
}

.worksheet-popup-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.worksheet-popup-row:last-child { margin-bottom: 0; }

.worksheet-popup-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #666;
}

.worksheet-popup-btn {
    flex-shrink: 0;
    background: var(--color-primary, #FF6B6B);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 7px 14px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.74rem;
    cursor: pointer;
}
.worksheet-popup-btn:hover { transform: translateY(-1px); }

@media (max-width: 480px) {
    .worksheet-fab {
        right: 14px;
        bottom: 14px;
        max-width: 140px;
        padding: 9px 14px;
        font-size: 0.75rem;
    }
    .worksheet-popup {
        right: 14px;
        bottom: 68px;
        width: 210px;
    }
}

/* ---- Card-style version (used inside .cat-card on /worksheet
   listing/archive page - small inline status, not fixed) ---- */
.worksheet-card {
    margin-top: 10px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--color-bg, #FFF9F0);
    text-align: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--color-dark, #2D3142);
}

.worksheet-card.ready {
    cursor: pointer;
    background: var(--color-primary, #FF6B6B);
    color: #fff;
    animation: worksheetSparkle 1.3s ease-in-out 2;
}

.worksheet-card.ready:hover {
    transform: translateY(-2px);
}
