/* Launchpad Overlay - Premium macOS/Vision Pro Style */
:root {
    --lp-bg: rgba(5, 5, 10, 0.7);
    /* Darker, more premium */
    --lp-blur: 30px;
    --app-size: 80px;
    --app-gap: 40px;
    --page-transition: 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    /* Apple-like ease */
    --neon-accent: rgba(0, 194, 255, 0.6);
}

.launchpad-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--lp-bg);
    backdrop-filter: blur(var(--lp-blur));
    -webkit-backdrop-filter: blur(var(--lp-blur));
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Align to top */
    padding-top: 5vh;
    /* Initial top padding */
    overflow: hidden;
}

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

/* SEARCH BAR */
.lp-search-bar {
    width: 300px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 22px;
    padding: 0 20px;
    color: white;
    font-size: 16px;
    outline: none;
    margin-bottom: 20px;
    /* Space between search and grid */
    transition: 0.3s;
    text-align: center;
    backdrop-filter: blur(10px);
}

.lp-search-bar:focus {
    width: 340px;
    /* Expand on focus */
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 20px rgba(0, 194, 255, 0.2);
}

.lp-search-bar::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Close Area (Click empty space) */
.launchpad-backdrop {
    position: absolute;
    inset: 0;
    z-index: -1;
}

/* Pages Container */
.launchpad-pages-container {
    width: 100%;
    height: auto;
    flex: 1;
    /* Take remaining height */
    display: flex;
    align-items: flex-start;
    /* Top align pages */
    transition: transform var(--page-transition);
}

/* Mobile First Layout */
.launchpad-page {
    min-width: 100%;
    /* Grid layout */
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, 1fr);
    /* Fixed 4 rows */
    gap: 20px;
    padding: 20px 30px;
    justify-items: center;
    align-content: start;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .launchpad-page {
        grid-template-columns: repeat(5, 1fr);
        /* 5 cols for desktop */
        grid-template-rows: auto;
        /* Allow rows to be natural */
        padding: 40px 15%;
        gap: 50px 30px;
        /* Vertical / Horizontal gap */
    }
}

/* App Item */
.lp-app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    transition: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy spring */
    width: 90px;
    position: relative;
    cursor: pointer;
}

/* App Icon Container - Glass Style */
.lp-app-icon-box {
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.08);
    /* Dark glass */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 10px;
    transition: 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.lp-app-text {
    color: white;
    font-size: 13px;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    opacity: 0.9;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Hover Effects */
.lp-app-item:hover .lp-app-icon-box {
    transform: translateY(-8px) scale(1.1);
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3), 0 0 20px var(--neon-accent);
}

.lp-app-item:hover .lp-app-text {
    opacity: 1;
    transform: scale(1.05);
}

.lp-app-item:active .lp-app-icon-box {
    transform: scale(0.95);
}

/* Staggered Entry Animation */
.launchpad-overlay.active .lp-app-item {
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

/* Generate staggered delays (up to 20 items) */
.launchpad-overlay.active .lp-app-item:nth-child(1) {
    animation-delay: 0.05s;
}

.launchpad-overlay.active .lp-app-item:nth-child(2) {
    animation-delay: 0.1s;
}

.launchpad-overlay.active .lp-app-item:nth-child(3) {
    animation-delay: 0.15s;
}

.launchpad-overlay.active .lp-app-item:nth-child(4) {
    animation-delay: 0.2s;
}

.launchpad-overlay.active .lp-app-item:nth-child(5) {
    animation-delay: 0.25s;
}

.launchpad-overlay.active .lp-app-item:nth-child(n+6) {
    animation-delay: 0.3s;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.8);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Locked App Style */
.lp-app-item.locked .lp-app-icon-box {
    filter: grayscale(1);
    opacity: 0.5;
}

.lp-app-item.locked::after {
    content: '🔒';
    position: absolute;
    top: -5px;
    right: 5px;
    font-size: 14px;
}

/* Cleaned up tail */