/* =============================================
   App Launcher — mobile-first
   ============================================= */

/* Botón en el header */
.launcher-btn {
    position: relative;
    align-items: center;
    background: rgba(49, 50, 68, 0.62);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    display: inline-flex;
    gap: 6px;
    height: 38px;
    justify-content: center;
    padding: 0 12px;
    transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.18s;
}

.launcher-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
    transform: translateY(-1px);
}

.launcher-btn:active {
    transform: translateY(0);
}

.adm-theme-light .launcher-btn {
    background: var(--panel);
    border-color: var(--line-strong);
    box-shadow: 0 2px 8px rgba(54, 44, 22, 0.08);
}

.adm-theme-light .launcher-btn:hover {
    background: rgba(44, 95, 141, 0.08);
    border-color: var(--blue);
}

.launcher-badge {
    align-items: center;
    background: var(--blue);
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    font-size: 10px;
    font-weight: 900;
    height: 16px;
    justify-content: center;
    line-height: 1;
    min-width: 16px;
    padding: 0 4px;
}

/* Overlay con backdrop blur */
.launcher-overlay {
    align-items: flex-start;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(0, 0, 0, 0.65);
    bottom: 0;
    display: flex;
    justify-content: center;
    left: 0;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    right: 0;
    top: 0;
    transition: opacity 0.22s ease;
    z-index: 1000;
}

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

/* Panel — móvil: bottom sheet */
.launcher-panel {
    background: var(--bg-deep, #0d0d1a);
    border: 1px solid var(--line);
    border-top: none;
    border-radius: 0 0 20px 20px;
    display: flex;
    flex-direction: column;
    max-height: 92vh;
    overflow: hidden;
    transform: translateY(-24px) scale(0.98);
    transition: transform 0.22s ease;
    width: 100%;
}

.launcher-overlay.active .launcher-panel {
    transform: translateY(0) scale(1);
}

.adm-theme-light .launcher-panel {
    background: #f5f5f8;
    border-color: var(--line-strong);
}

/* Header: buscador + botón cerrar */
.launcher-panel-header {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-shrink: 0;
    gap: 10px;
    padding: 14px 16px;
}

.launcher-search {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    flex: 1;
    font-size: 16px;
    height: 46px;
    outline: none;
    padding: 0 14px;
    transition: border-color 0.15s;
    /* 16px evita el zoom automático en iOS al hacer focus */
}

.launcher-search::placeholder {
    color: var(--muted);
}

.launcher-search:focus {
    border-color: var(--blue);
}

.adm-theme-light .launcher-search {
    background: #fff;
    border-color: var(--line-strong);
}

.launcher-close-btn {
    align-items: center;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--muted);
    display: inline-flex;
    flex-shrink: 0;
    font-size: 18px;
    height: 46px;
    justify-content: center;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
    width: 46px;
}

.launcher-close-btn:hover {
    background: rgba(255, 80, 80, 0.18);
    color: var(--red);
}

.adm-theme-light .launcher-close-btn {
    background: #fff;
    border-color: var(--line-strong);
}

/* Zona scrollable */
.launcher-content {
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    padding: 18px 16px 24px;
}

/* Grid — 3 columnas en móvil */
.launcher-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, 1fr);
}

/* Card de cada app */
.launcher-app-item {
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 72px;
    padding: 12px 8px 10px;
    text-align: center;
    transition: background 0.14s, border-color 0.14s, transform 0.12s;
}

.launcher-app-item:hover {
    background: rgba(99, 179, 237, 0.1);
    border-color: var(--blue);
    transform: scale(1.04);
}

.launcher-app-item:active {
    transform: scale(0.96);
}

.adm-theme-light .launcher-app-item {
    background: #fff;
    border-color: var(--line-strong);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.adm-theme-light .launcher-app-item:hover {
    background: rgba(44, 95, 141, 0.06);
}

.launcher-app-icon {
    font-size: 30px;
    line-height: 1;
}

.launcher-app-name {
    color: var(--text);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
}

/* Sin resultados */
.launcher-empty {
    color: var(--muted);
    font-size: 14px;
    padding: 40px 16px;
    text-align: center;
}

/* =============================================
   Desktop: modal centrado
   ============================================= */
@media (min-width: 600px) {
    .launcher-overlay {
        align-items: center;
    }

    .launcher-panel {
        border-top: 1px solid var(--line);
        border-bottom: 1px solid var(--line);
        border-radius: 20px;
        max-height: 80vh;
        max-width: 580px;
        width: 92%;
    }

    .launcher-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }

    .launcher-app-icon {
        font-size: 34px;
    }

    .launcher-app-name {
        font-size: 12px;
    }
}
