/* ==========================================================================
   macOS Mission Control (Exposé) — Interactive Window Spread Overview
   ========================================================================== */

/* Mission Control Top Bar */
.mission-control-bar {
    position: fixed;
    top: 28px;
    left: 0;
    right: 0;
    height: 90px;
    background: rgba(20, 20, 24, 0.72);
    backdrop-filter: blur(35px) saturate(180%);
    -webkit-backdrop-filter: blur(35px) saturate(180%);
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.15);
    z-index: 99995;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.mission-control-active .mission-control-bar {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.mc-space-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.mc-space-thumb {
    width: 104px;
    height: 60px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05)), url('../assets/Wallpapers/thumbs/26-Tahoe-Beach-Day.jpg') center/cover;
    border: 2px solid var(--accent);
    box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 35%, transparent);
    transition: transform 0.15s ease;
}

.mc-space-item:hover .mc-space-thumb {
    transform: scale(1.05);
}

.mc-space-label {
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.01em;
}

/* Background Dimmer when Mission Control is Active */
.mission-control-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9990;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.mission-control-active .mission-control-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* Windows during Mission Control */
.window.in-mission-control {
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, opacity 0.2s ease !important;
    cursor: pointer !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.2) !important;
    z-index: 9992 !important;
}

/* Reduce Motion: windows go straight to their places and back, as on a Mac. */
@media (prefers-reduced-motion: reduce) {
    .window.in-mission-control { transition: box-shadow 0.2s ease, opacity 0.2s ease !important; }
}

.window.in-mission-control:hover {
    transform: scale(var(--mc-scale, 0.55)) translateY(-8px) !important;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.75), 0 0 0 2px var(--accent), 0 0 24px color-mix(in srgb, var(--accent) 45%, transparent) !important;
}

/* Floating Window Title Pill in Mission Control */
.mc-window-badge {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(28, 28, 32, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 0.5px solid rgba(255, 255, 255, 0.22);
    border-radius: 20px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 9998;
}

.mission-control-active .mc-window-badge {
    opacity: 1;
}

.mc-window-badge img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.mission-control-empty {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    z-index: 9500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s var(--ease-macos);
}
.mission-control-empty.visible { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.mission-control-empty i { font-size: 40px; opacity: 0.7; }
.mission-control-empty span { font-size: 17px; font-weight: 600; }
.mission-control-empty small { font-size: 12.5px; color: rgba(255, 255, 255, 0.65); }

/* Windows live inside .desktop, which is its own stacking context (z-index 1),
   so their z-index could never beat the body-level dimmer: every window sat
   UNDER the blur, looked frosted, and a click on one just exited. Lift the
   desktop above the dimmer, hide its icons/widgets (as macOS does), and let
   clicks on empty space fall through to the dimmer to exit. */
body.mission-control-active .desktop { z-index: 9991; pointer-events: none; }
body.mission-control-active .desktop-files,
body.mission-control-active .desktop-widgets-column { opacity: 0; transition: opacity 0.2s ease; }
body.mission-control-active .window.in-mission-control { pointer-events: auto; overflow: visible; }

/* The title pill sits outside the window, so it needs overflow:visible above,
   and it counter-scales so it stays readable on a shrunken window. */
.mc-window-badge {
    transform: translateX(-50%) scale(calc(1 / var(--mc-scale, 0.5)));
    transform-origin: bottom center;
}
