/* Status Logo - Theater Masks
   Poetry Studio Pro - December 2025
   White line-art masks with dynamic color states
*/

.status-logo {
    position: relative;
    width: 80px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-logo__orbit {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-logo__mask {
    position: absolute;
    height: 40px;
    width: auto;
    transition: filter 0.4s ease, opacity 0.4s ease, transform 0.3s ease;
}

.status-logo__mask--happy {
    left: 2px;
}

.status-logo__mask--sad {
    right: 2px;
}

/* ========== IDLE (Green + Blue) ========== */
.status-logo[data-state="idle"] .status-logo__mask--happy {
    filter: brightness(1.1);
    animation: breathe 4s ease-in-out infinite;
    opacity: 0.95;
}

.status-logo[data-state="idle"] .status-logo__mask--sad {
    filter: brightness(1.1);
    animation: breathe 4s ease-in-out infinite 0.5s;
    opacity: 0.85;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

/* ========== PROCESSING (Purple) ========== */
.status-logo[data-state="processing"] .status-logo__mask {
    filter: saturate(0.3) brightness(0.8) sepia(1) saturate(5) hue-rotate(250deg);
}

.status-logo[data-state="processing"] .status-logo__mask--happy {
    animation: pulse 1.5s ease-in-out infinite;
}

.status-logo[data-state="processing"] .status-logo__mask--sad {
    animation: pulse 1.5s ease-in-out infinite 0.3s;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.08); opacity: 1; }
}

.status-logo[data-state="processing"]::before {
    content: '';
    position: absolute;
    inset: -12px;
    border-radius: 16px;
    background: radial-gradient(ellipse, rgba(139, 92, 246, 0.35) 0%, transparent 70%);
    animation: glow 1.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes glow {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* ========== SUCCESS (Green/Blue + Green Glow) ========== */
.status-logo[data-state="success"] .status-logo__mask--happy {
    filter: brightness(1.2);
    animation: bounce 0.5s ease-out;
    opacity: 1;
}

.status-logo[data-state="success"] .status-logo__mask--sad {
    filter: brightness(1.1);
    opacity: 0.5;
}

@keyframes bounce {
    0% { transform: scale(1); }
    40% { transform: scale(1.2) translateY(-3px); }
    100% { transform: scale(1); }
}

.status-logo[data-state="success"]::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 14px;
    background: radial-gradient(ellipse, rgba(34, 197, 94, 0.5) 0%, transparent 70%);
    animation: flash 1s ease-out forwards;
    pointer-events: none;
}

/* 2026-05-09 (STATUSLOGO-DONE-OPENS-BTO): when a render just
   completed and the logo is now a 'tap to see your Cut' affordance,
   add a subtle pulsing ring + cursor:pointer so user sees it's
   actionable. The class auto-clears when the logo resets to idle
   (3s) or after the user taps once. */
.status-logo--has-completion {
    cursor: pointer;
}
.status-logo--has-completion::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(34, 197, 94, 0.6);
    animation: completion-pulse 1.4s ease-out infinite;
    pointer-events: none;
}
@keyframes completion-pulse {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.5); }
}

@keyframes flash {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.4); }
}

/* ========== ERROR (Red + Shake) ========== */
.status-logo[data-state="error"] .status-logo__mask {
    filter: saturate(0.3) brightness(0.8) sepia(1) saturate(5) hue-rotate(330deg);
}

.status-logo[data-state="error"] .status-logo__mask--happy {
    opacity: 0.4;
}

.status-logo[data-state="error"] .status-logo__mask--sad {
    animation: shake 0.5s ease-out;
    opacity: 1;
}

@keyframes shake {
    0%, 100% { transform: translateX(0) rotate(0); }
    20% { transform: translateX(-3px) rotate(-3deg); }
    40% { transform: translateX(3px) rotate(3deg); }
    60% { transform: translateX(-2px) rotate(-2deg); }
    80% { transform: translateX(2px) rotate(2deg); }
}

.status-logo[data-state="error"]::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 14px;
    background: radial-gradient(ellipse, rgba(239, 68, 68, 0.5) 0%, transparent 70%);
    animation: errorPulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes errorPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ========== UPLOADING (Blue) ========== */
.status-logo[data-state="uploading"] .status-logo__mask {
    filter: saturate(0.3) brightness(0.8) sepia(1) saturate(5) hue-rotate(190deg);
}

.status-logo[data-state="uploading"] .status-logo__mask--happy,
.status-logo[data-state="uploading"] .status-logo__mask--sad {
    animation: pulse 1.2s ease-in-out infinite;
}

.status-logo[data-state="uploading"]::before {
    content: '';
    position: absolute;
    inset: -12px;
    border-radius: 16px;
    background: radial-gradient(ellipse, rgba(59, 130, 246, 0.35) 0%, transparent 70%);
    animation: glow 1.2s ease-in-out infinite;
    pointer-events: none;
}

/* ========== HOVER ========== */
.status-logo:hover .status-logo__mask--happy {
    transform: rotate(-5deg) scale(1.1);
}

.status-logo:hover .status-logo__mask--sad {
    transform: rotate(5deg) scale(1.1);
}

/* ========== COUNT BADGE ========== */
.status-logo__count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    /* 2026-05-12: was #8b5cf6 (orphan violet — not in SP palette).
       Now uses --accent which is SP's gold #d4a54a per index.html.
       Falls back to gold if --accent isn't defined on the loading
       page (e.g. admin.html, curated.html). */
    background: var(--accent, #d4a54a);
    color: #1a1a1a;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s;
}

.status-logo__count.visible {
    opacity: 1;
    transform: scale(1);
}

/* ========== TOOLTIP ========== */
.status-logo__tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 10px;
    padding: 8px 12px;
    background: #1f2937;
    color: white;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    pointer-events: none;
    z-index: 100;
}

.status-logo:hover .status-logo__tooltip {
    opacity: 1;
    visibility: visible;
}

.status-logo__tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: #1f2937;
}

/* ============================================================
   PROG-STD Phase 3 — Active-tasks panel (flat task list).
   One row per in-flight activity, fed by 'activity:list' and
   rendered via the shared PSPProgress component.
   ============================================================ */
.status-logo__panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 280px;
    max-width: 340px;
    background: #1f2937;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.45);
    padding: 12px;
    z-index: 10050;
    max-height: 360px;
    overflow-y: auto;
}
.status-logo__panel-title {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}
.status-logo__task {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.status-logo__task:first-child { border-top: none; }
.status-logo__task-icon { font-size: 15px; line-height: 1.3; flex-shrink: 0; }
.status-logo__task-body { flex: 1; min-width: 0; }
.status-logo__task-text {
    font-size: 13px;
    color: #ECECF4;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.status-logo__task-bar {
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 999px;
    overflow: hidden;
}
.status-logo__task-bar .psp-progress-fill {
    height: 100%;
    width: 0;
    background: #8b5cf6;
    border-radius: 999px;
    transition: width 0.3s ease;
}
/* Indeterminate — moving sheen when percent is unknown (NOT silent 0%). */
.status-logo__task.is-indeterminate .psp-progress-fill {
    width: 40% !important;
    animation: status-logo-indeterminate 1.2s ease-in-out infinite;
}
@keyframes status-logo-indeterminate {
    0% { margin-left: -40%; } 100% { margin-left: 100%; }
}
/* Failed / error rows — red bar, never reads as success. */
.status-logo__task.is-failed .psp-progress-fill,
.status-logo__task.is-error .psp-progress-fill { background: #ef4444; }
.status-logo__task.is-error .status-logo__task-text { color: #fca5a5; }
.status-logo__task.is-done .psp-progress-fill { background: #10b981; }
